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); }
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); }