async public Task <ApiResult> Login([FromForm] string username, [FromForm] string password) { var user = await AuthUser.Where(a => a.Username == username).FirstAsync(); if (user == null) { return(ApiResult.Failed.SetMessage("账户不存在")); } if (user.Status == AuthUserStatus.禁用) { return(ApiResult.Failed.SetMessage("该账户已禁用,请联系管理员")); } if (user.Password != Util.MD5(password)) { return(ApiResult.Failed.SetMessage("密码错误")); } user.LoginIp = base.Ip; user.LoginTime = DateTime.Now; await user.UpdateAsync(); return(ApiResult <object> .Success.SetData(new { token = base.GetUserToken(user) })); }