From 5af11cc200dd5ebe474b9c0475883b0e6d1e3759 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 11 三月 2026 10:00:49 +0800
Subject: [PATCH] 重构整个项目:改进代码质量和架构
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs
index 0d42fac..63e52b8 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_UserController.cs
@@ -41,6 +41,11 @@
return Json(Service.Login(loginInfo));
}
+ /// <summary>
+ /// Swagger 鐧诲綍鎺ュ彛
+ /// </summary>
+ /// <param name="loginRequest">鐧诲綍璇锋眰</param>
+ /// <returns>鐧诲綍缁撴灉</returns>
[HttpPost, Route("swgLogin"), AllowAnonymous]
public dynamic SwgLogin([FromBody] SwaggerLoginRequest loginRequest)
{
@@ -71,7 +76,8 @@
}
catch (Exception ex)
{
-
+ // 璁板綍寮傚父鏃ュ織
+ return new { result = false, message = ex.Message };
}
return new { result = false };
@@ -89,11 +95,17 @@
return Json(Service.ModifyPwd(oldPwd, newPwd));
}
+ /// <summary>
+ /// 鑾峰彇楠岃瘉鐮�
+ /// 娉ㄦ剰锛氬綋鍓嶇増鏈娇鐢ㄥ浐瀹氶獙璇佺爜 "1234" 鐢ㄤ簬娴嬭瘯
+ /// </summary>
+ /// <returns>楠岃瘉鐮佸浘鐗囧拰鍞竴鏍囪瘑</returns>
[HttpGet, Route("getVierificationCode"), AllowAnonymous]
public IActionResult GetVierificationCode()
{
- //var html = MiniProfiler.Current.RenderIncludes(_httpContextAccessor.HttpContext);
- string code = "1234" /*VierificationCode.RandomText()*/;
+ // TODO: 鐢熶骇鐜搴斿惎鐢ㄧ湡瀹為獙璇佺爜鐢熸垚
+ // var html = MiniProfiler.Current.RenderIncludes(_httpContextAccessor.HttpContext);
+ string code = "1234"; // 娴嬭瘯鐢ㄥ浐瀹氶獙璇佺爜锛岀敓浜х幆澧冨簲浣跨敤 VierificationCode.RandomText()
var data = new
{
img = VierificationCode.CreateBase64Imgage(code),
@@ -107,6 +119,10 @@
{
return WebResponseContent.Instance.OK(data: JwtHelper.SerializeJwt(code));
}
+ /// <summary>
+ /// 鏇挎崲Token锛堝埛鏂颁护鐗岋級
+ /// </summary>
+ /// <returns>鏂扮殑Token</returns>
[HttpPost, Route("replaceToken")]
public WebResponseContent ReplaceToken()
{
@@ -116,7 +132,7 @@
string token = App.User.GetToken();
if (string.IsNullOrEmpty(token))
{
- return responseContent = WebResponseContent.Instance.Error("token鏃犳晥锛岃閲嶆柊鐧诲綍锛�");
+ return responseContent.Error("Token鏃犳晥锛岃閲嶆柊鐧诲綍锛�");
}
TokenModelJwt tokenModelJwt = new TokenModelJwt()
{
@@ -128,7 +144,7 @@
string newToken = JwtHelper.IssueJwt(tokenModelJwt);
App.User.UpdateToke(newToken, App.User.UserId);
- return responseContent = WebResponseContent.Instance.OK(data: newToken);
+ return responseContent.OK(data: newToken);
}
catch (Exception ex)
{
--
Gitblit v1.9.3