Пример #1
0
        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));
        }
Пример #2
0
        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));
        }