Beispiel #1
0
        public Base <object> Edit(UsersQuery model)
        {
            Meta meta     = new Meta();
            bool editNote = true;
            //取token值
            TokenReponse repository = new TokenReponse();
            Token        token      = repository.First(model.Token);

            if (token == null)
            {
                meta.ErrorCode = ErrorCode.LoginError.GetHashCode().ToString();
                meta.ErrorMsg  = EnumHelper.GetDescriptionFromEnumValue(ErrorCode.LoginError);
            }
            else
            {
                editNote = UserService.Edit(model, ref meta);
            }
            Base <object> result = new Base <object>
            {
                Meta = meta,
                Body = editNote
            };

            return(result);
        }
Beispiel #2
0
        public Base <object> Inviter(UsersQuery model)
        {
            Meta meta = new Meta();
            PageModel <Users> list = new PageModel <Users>();

            //取token值
            TokenReponse repository = new TokenReponse();
            Token        token      = repository.First(model.Token);

            if (token == null)
            {
                meta.ErrorCode = ErrorCode.LoginError.GetHashCode().ToString();
                meta.ErrorMsg  = EnumHelper.GetDescriptionFromEnumValue(ErrorCode.LoginError);
            }
            else
            {
                model.UserID = token.UserId;
                list         = UserService.Inviter(model, ref meta);
            }
            Base <object> response = new Base <object>
            {
                Body = list,
                Meta = meta
            };

            return(response);
        }
Beispiel #3
0
        //校验是否丢失 token
        public Token VerifyToken(string token, ref Meta meta)
        {
            TokenReponse repository = new TokenReponse();
            Token        _token     = repository.First(token);

            if (string.IsNullOrEmpty(_token.Key))
            {
                meta.ErrorCode = ErrorCode.Error1017.GetHashCode().ToString();
                meta.ErrorMsg  = EnumHelper.GetDescriptionFromEnumValue(ErrorCode.Error1017);
                return(null);
            }
            return(_token);
        }