Пример #1
0
        public ResponseBase JDRegister(UserModel data)
        {
            var resp = new ResponseBase();

            if (string.IsNullOrEmpty(data.LoginName) || string.IsNullOrEmpty(data.PassWord))
            {
                throw CustomErrorException.Create(ProtocolError.ParamIsEmpty);
            }

            int result = this._userFactory.Register(data.LoginName, data.PassWord);

            if (result > 0)
            {
                resp.Message = "注册成功";
            }
            return(resp);
        }
Пример #2
0
        public ResponseDataBase Login(UserModel user)
        {
            var resp = new ResponseDataBase();

            if (string.IsNullOrEmpty(user.LoginName) || string.IsNullOrEmpty(user.PassWord))
            {
                throw CustomErrorException.Create(ProtocolError.ParamIsEmpty);
            }

            var model = this._iUserService.Login(user.LoginName, user.PassWord);

            if (model == null)
            {
                throw CustomErrorException.Create(ProtocolError.LoginFailed);
            }
            else
            {
                resp.Data = model;
            }

            return(resp);
        }