From 74090a619fa7c7e37e78cc927db0f7b19762e5ae Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 02 4月 2025 19:46:24 +0800 Subject: [PATCH] 提交 --- Api/Util/AuthorizeHelper.cs | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Api/Util/AuthorizeHelper.cs b/Api/Util/AuthorizeHelper.cs index 631cf72..df116b5 100644 --- a/Api/Util/AuthorizeHelper.cs +++ b/Api/Util/AuthorizeHelper.cs @@ -1,4 +1,5 @@ 锘縰sing iWare.Authorize.Dto; +using Newtonsoft.Json; using ProjectCode; namespace iWare.Authorize @@ -33,12 +34,13 @@ string rst = EnDecode.ReadAndValidateLicenseFile(firstFile.FullName); if (!string.IsNullOrEmpty(rst)) { + AuthorizeFunRetEntity newRet = JsonConvert.DeserializeObject<AuthorizeFunRetEntity>(rst); if (EnDecode.ValidatePermanentLicense(firstFile.FullName)) { - return AuthorizeFunRetEntity.Success("鎴愬姛"); + return AuthorizeFunRetEntity.Success("鎴愬姛", newRet); } else - return ValidateLicenseForDev(firstFile.FullName, input); + return ValidateLicenseForDev(firstFile.FullName, input, newRet); } else { @@ -57,7 +59,7 @@ /// </summary> /// <param name="filePath"></param> /// <returns></returns> - private static AuthorizeFunRetEntity ValidateLicenseForDev(string filePath, ValidateLicenseInput input) + private static AuthorizeFunRetEntity ValidateLicenseForDev(string filePath, ValidateLicenseInput input, AuthorizeFunRetEntity newRet) { //璇诲彇 寮�鍙戞巿鏉� var val = EnDecode.ValidateDevLicense(filePath); @@ -68,14 +70,19 @@ int waringDays = (int)input.WaringDays; if (waringDays >= val.RemainingDays) { - return AuthorizeFunRetEntity.Success("鎴愬姛", val.RemainingDays, $"鎺堟潈鍓╀綑澶╂暟{val.RemainingDays}灏忎簬{waringDays}澶�"); + return AuthorizeFunRetEntity.Success("鎴愬姛", val.RemainingDays, $"鎺堟潈鍓╀綑澶╂暟{val.RemainingDays}灏忎簬{waringDays}澶╋紝鍒版湡鏃newRet.expiryDate}"); } } - return AuthorizeFunRetEntity.Success("鎴愬姛", val.RemainingDays); + return AuthorizeFunRetEntity.Success("鎴愬姛", val.RemainingDays, newRet); } else - return AuthorizeFunRetEntity.Fail("鎺堟潈澶辫触", val.RemainingDays); - + { + if (string.IsNullOrEmpty(newRet.expiryDate)) + { + return AuthorizeFunRetEntity.Fail($"鎺堟潈澶辫触", val.RemainingDays, newRet); + } + return AuthorizeFunRetEntity.Fail($"鎺堟潈澶辫触,鍒版湡鏃newRet.expiryDate}", val.RemainingDays, newRet); + } } } -- Gitblit v1.9.3