| | |
| | |  |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Caching.Memory; |
| | | using StackExchange.Profiling; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Authorization; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.HttpContextUser; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_IServices; |
| | | using WIDESEA_Model; |
| | | using WIDESEA_Model.Models; |
| | | namespace WIDESEA_WMSServer.Controllers; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers |
| | | [Route("api/Sys_User")] |
| | | [ApiController] |
| | | public class Sys_UserController : ApiBaseController<ISys_UserService, Sys_User> |
| | | { |
| | | [Route("api/User")] |
| | | [ApiController] |
| | | public class Sys_UserController : ApiBaseController<ISys_UserService, Sys_User> |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | |
| | | public Sys_UserController(ISys_UserService userService, IHttpContextAccessor httpContextAccessor) : base(userService) |
| | | { |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | |
| | | public Sys_UserController(ISys_UserService userService, IHttpContextAccessor httpContextAccessor) : base(userService) |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | } |
| | | |
| | | [HttpPost, Route("login"), AllowAnonymous] |
| | | public IActionResult Login([FromBody] LoginInfo loginInfo) |
| | | { |
| | | return Json(Service.Login(loginInfo)); |
| | | } |
| | | [HttpPost, Route("getCurrentUserInfo")] |
| | | public WebResponseContent GetCurrentUser() |
| | | { |
| | | return Service.GetCurrentUserInfo(); |
| | | } |
| | | |
| | | [HttpPost, Route("modifyPwd")] |
| | | public IActionResult ModifyPwd(string oldPwd, string newPwd) |
| | | { |
| | | return Json( Service.ModifyPwd(oldPwd, newPwd)); |
| | | } |
| | | |
| | | [HttpGet, Route("getVierificationCode"), AllowAnonymous] |
| | | public IActionResult GetVierificationCode() |
| | | { |
| | | //var html = MiniProfiler.Current.RenderIncludes(_httpContextAccessor.HttpContext); |
| | | string code = "1234" /*VierificationCode.RandomText()*/; |
| | | var data = new |
| | | { |
| | | img = VierificationCode.CreateBase64Imgage(code), |
| | | uuid = Guid.NewGuid() |
| | | }; |
| | | |
| | | return Json(data); |
| | | } |
| | | [HttpGet, Route("SerializeJwt"), AllowAnonymous] |
| | | public WebResponseContent SerializeJwt(string code) |
| | | { |
| | | return WebResponseContent.Instance.OK(data: JwtHelper.SerializeJwt(code)); |
| | | } |
| | | _httpContextAccessor = httpContextAccessor; |
| | | } |
| | | } |
| | | |
| | | [HttpPost, Route("login"), AllowAnonymous] |
| | | public IActionResult Login([FromBody] LoginInfo loginInfo) |
| | | { |
| | | return Json(Service.Login(loginInfo)); |
| | | } |
| | | |
| | | [HttpPost, Route("getCurrentUserInfo")] |
| | | public WebResponseContent GetCurrentUser() |
| | | { |
| | | return Service.GetCurrentUserInfo(); |
| | | } |
| | | |
| | | [HttpPost, Route("modifyPwd")] |
| | | public IActionResult ModifyPwd(string oldPwd, string newPwd) |
| | | { |
| | | return Json(Service.ModifyPwd(oldPwd, newPwd)); |
| | | } |
| | | [HttpPost, Route("UpdateInfo")] |
| | | public IActionResult UpdateInfo(int user_Id, string roleName, string userName, string userTrueName, string address, int gender, string remark) |
| | | { |
| | | return Json(Service.UpdateInfo(user_Id, roleName, userName, userTrueName, address, gender, remark)); |
| | | } |
| | | |
| | | [HttpGet, Route("getVierificationCode"), AllowAnonymous] |
| | | public IActionResult GetVierificationCode() |
| | | { |
| | | //var html = MiniProfiler.Current.RenderIncludes(_httpContextAccessor.HttpContext); |
| | | string code = "1234" /*VierificationCode.RandomText()*/; |
| | | var data = new |
| | | { |
| | | img = VierificationCode.CreateBase64Imgage(code), |
| | | uuid = Guid.NewGuid() |
| | | }; |
| | | |
| | | return Json(data); |
| | | } |
| | | |
| | | [HttpGet, Route("SerializeJwt"), AllowAnonymous] |
| | | public WebResponseContent SerializeJwt(string code) |
| | | { |
| | | return WebResponseContent.Instance.OK(data: JwtHelper.SerializeJwt(code)); |
| | | } |
| | | } |