| | |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Caching.Memory; |
| | | using Newtonsoft.Json; |
| | | using StackExchange.Profiling; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Authorization; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_Core.Caches; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_Core.Extensions; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.HttpContextUser; |
| | | using WIDESEA_Core.Utilities; |
| | |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers |
| | | { |
| | | /// <summary> |
| | | /// 鐢ㄦ埛 |
| | | /// </summary> |
| | | [Route("api/User")] |
| | | [ApiController] |
| | | public class Sys_UserController : ApiBaseController<ISys_UserService, Sys_User> |
| | |
| | | public IActionResult Login([FromBody] LoginInfo loginInfo) |
| | | { |
| | | return Json(Service.Login(loginInfo)); |
| | | } |
| | | |
| | | [HttpPost, Route("swgLogin"), AllowAnonymous] |
| | | public dynamic SwgLogin([FromBody] SwaggerLoginRequest loginRequest) |
| | | { |
| | | if (loginRequest is null) |
| | | { |
| | | return new { result = false }; |
| | | } |
| | | |
| | | try |
| | | { |
| | | if (loginRequest.name == "admin" && loginRequest.pwd == $"admin!{DateTime.Now.ToString("yyyyMMdd")}") |
| | | { |
| | | HttpContext.SuccessSwagger(); |
| | | return new { result = true }; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | |
| | | return new { result = false }; |
| | | } |
| | | |
| | | [HttpPost, Route("getCurrentUserInfo")] |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | public class SwaggerLoginRequest |
| | | { |
| | | public string name { get; set; } |
| | | public string pwd { get; set; } |
| | | } |
| | | } |