From 0ecadf2d4500e018ef59c5d7c0eb3b23856580f0 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 27 四月 2026 15:11:11 +0800
Subject: [PATCH] 调整 token自动刷新接口,解决token 无法自动刷新的问题
---
WebAPI/Controllers/WebAPIController.cs | 108 +++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 98 insertions(+), 10 deletions(-)
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index b3dea9d..9e1452f 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -392,7 +392,7 @@
objJsonResult.Message = "鐧诲綍寮傚父锛乀oken 鐢熸垚寮傚父锛屾棤娉曡幏鍙栧叕鍙镐俊鎭紒";
}
- string tokenStr = Utility.JWTHelper.GenerateToken(UserName.Trim(), DBUtility.ClsPub.StrToPsd(PassWord.Trim()));
+ string tokenStr = Utility.JWTHelper.GenerateToken(ds.Tables[0].Rows[0]["Czybm"].ToString(), ds.Tables[0].Rows[0]["Czymc"].ToString());
objjson.code = "0";
@@ -409,7 +409,7 @@
objjson.code = "0";
objjson.count = 0;
- objjson.Message = "[0000-1-074]鐧诲綍寮傚父锛�" + e.Message;
+ objjson.Message = "[0000-1-074]鐧诲綍寮傚父锛�" + e;
objjson.data = null;
return objjson; ;
}
@@ -20473,7 +20473,7 @@
{
objjson.code = "0";
objjson.count = 0;
- objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+ objjson.Message = "鑾峰彇澶辫触" + ex.Message.ToString();
objjson.data = null;
return objjson;
}
@@ -20968,7 +20968,18 @@
{
objjson.code = "0";
objjson.count = 0;
- objjson.Message = "鑾峰彇澶辫触,鏄庣粏鏌ユ棤鏁版嵁";
+ if(Type == "DJ")
+ {
+ objjson.Message = "鑾峰彇澶辫触,妯″叿鏃犵粦瀹氱殑鐐规瑙勭▼";
+ }
+ else if (Type == "BY")
+ {
+ objjson.Message = "鑾峰彇澶辫触,妯″叿鏃犵粦瀹氱殑淇濆吇瑙勭▼";
+ }
+ else
+ {
+ objjson.Message = "鑾峰彇澶辫触,鏄庣粏鏌ユ棤鏁版嵁";
+ }
objjson.data = null;
return objjson;
}
@@ -21169,12 +21180,12 @@
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl");
- if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"]) //鏄惁绠$悊鍛�
- {
- //涓嶆槸绠$悊鍛�
- sWhere += " and 鍒跺崟浜� = '" + user + "'";
- }
+ //ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl");
+ //if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"]) //鏄惁绠$悊鍛�
+ //{
+ // //涓嶆槸绠$悊鍛�
+ // sWhere += " and 鍒跺崟浜� = '" + user + "'";
+ //}
string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere + " order by 鏃ユ湡 desc, hmainid desc");
@@ -22852,6 +22863,7 @@
/// <returns></returns>
[Route("Web/GetModuleName")]
[HttpGet]
+ [AllowAnonymous]
public object GetModuleName(string HModuleType)
{
try
@@ -23992,5 +24004,81 @@
}
}
#endregion
+
+ /// <summary>
+ /// APP鐧诲綍鏉冮檺楠岃瘉鎺ュ彛
+ /// </summary>
+ [Route("Auth/CheckAppLoginAuth")]
+ [HttpPost]
+ public object CheckAppLoginAuth()
+ {
+ try
+ {
+ // 鑾峰彇璇锋眰鍙傛暟
+ string orgID = HttpContext.Current.Request.Form["orgID"] ?? "";
+ string orgName = HttpContext.Current.Request.Form["orgName"] ?? "";
+ string serverUrl = HttpContext.Current.Request.Form["serverUrl"] ?? "";
+ string phoneType = HttpContext.Current.Request.Form["phoneType"] ?? "";
+ string userAccount = HttpContext.Current.Request.Form["userAccount"] ?? "";
+ string other = HttpContext.Current.Request.Form["other"] ?? "";
+ // 鍙傛暟楠岃瘉
+ if (string.IsNullOrEmpty(userAccount))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "璐﹀彿涓嶈兘涓虹┖!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrEmpty(orgID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "缁勭粐ID涓嶈兘涓虹┖!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ // 鍙傛暟瀹夊叏澶勭悊锛堥槻姝㈡敞鍏ワ級
+ orgID = orgID.Replace("'", "''");
+ orgName = orgName.Replace("'", "''");
+ serverUrl = serverUrl.Replace("'", "''");
+ phoneType = phoneType.Replace("'", "''");
+ userAccount = userAccount.Replace("'", "''");
+
+ // 鎵ц鍥哄畾瀛樺偍杩囩▼
+ string sql = $"EXEC SP_CheckAppLoginAuth '{orgID}', '{orgName}', '{serverUrl}', '{phoneType}','{userAccount}','{other}'";
+ ds = oCN.RunProcReturn(sql, "SP_CheckAppLoginAuth");
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ int result = Convert.ToInt32(ds.Tables[0].Rows[0]["Result"]);
+ string message = ds.Tables[0].Rows[0]["Message"].ToString();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = message;
+ objJsonResult.data = ds.Tables[0];
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "楠岃瘉鎺ュ彛杩斿洖寮傚父!";
+ objJsonResult.data = null;
+ }
+
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
}
}
--
Gitblit v1.9.1