| | |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | } |
| | | |
| | | [HttpPost, Route("swgLogin"), AllowAnonymous] |
| | | public dynamic SwgLogin([FromBody] SwaggerLoginRequest loginRequest) |
| | | { |
| | |
| | | |
| | | try |
| | | { |
| | | LoginInfo loginInfo = new LoginInfo |
| | | { |
| | | Password = loginRequest.pwd, |
| | | UserName = loginRequest.name |
| | | }; |
| | | var result = Service.Login(loginInfo); |
| | | if (result.Status) |
| | | if (loginRequest.name == "admin" && loginRequest.pwd == $"admin!{DateTime.Now.ToString("yyyyMMdd")}") |
| | | { |
| | | HttpContext.SuccessSwagger(); |
| | | Dictionary<string, object>? dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(result.Data.Serialize()); |
| | | if (dict != null) |
| | | { |
| | | HttpContext.SuccessSwaggerJwt((dict.ContainsKey("token") ? dict["token"].ToString() : "") ?? ""); |
| | | } |
| | | string str = HttpContext.GetSuccessSwaggerJwt(); |
| | | return new { result = true }; |
| | | } |
| | | } |
| | |
| | | |
| | | return new { result = false }; |
| | | } |
| | | |
| | | [HttpPost, Route("login"), AllowAnonymous] |
| | | public IActionResult Login([FromBody] LoginInfo loginInfo) |
| | | { |