예제 #1
0
        public ResponseMessage Signin([FromBody] SigninModel model)
        {
            var user = _UserManage.GetModelByEmail(model.username);

            if (user != null && user.Password == model.password)
            {
                // 登录操作
                user.LoginKey      = Guid.NewGuid().ToString("N");
                user.LastLoginTime = DateTimeUtility.GetTimeMilliseconds(DateTime.Now);
                _UserManage.Update(user);
                return(new ResponseMessage(MessageResult.Success, "登录成功", new
                {
                    user.Email,
                    user.LoginKey,
                    user.ID
                }));
            }
            return(new ResponseMessage(MessageResult.Error, "用户名或密码错误"));
        }