public IActionResult Login([FromBody] User user) { var req = Request; var result = new MsgResult(); result.data = _accountService.CheckLogin(user.username, user.password); if (string.IsNullOrEmpty(result.data.ToString())) { result.SetCustomErr("登录异常"); } return(Ok(result)); }
public IActionResult GetUserInfo() { var tokenHeader = Request.Headers["Authorization"].ToString(); string token = null; if (tokenHeader != null && tokenHeader.StartsWith("Bearer")) { token = tokenHeader.Substring("Bearer ".Length).Trim(); } var result = new MsgResult(); result.data = _accountService.GetClientAppInfo(token); if (result.data == null) { result.SetCustomErr("尝试重新登录", 401); } return(ReJson(result)); }