Api/Entity/AuthorizeFunRetEntity.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Api/Util/AuthorizeHelper.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Api/iWare.Authorize.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Api/Entity/AuthorizeFunRetEntity.cs
@@ -35,17 +35,47 @@ public double? remainingDays { get; set; } /// <summary> /// 到期日期 /// </summary> public string expiryDate { get; set; } /// <summary> /// 授权日期 /// </summary> public string issueDate { get; set; } /// <summary> /// 项目名称 /// </summary> public string projectId { get; set; } /// <summary> /// 授权类型 /// </summary> public string type { get; set; } /// <summary> /// 绑定MAC /// </summary> public string macAddress { get; set; } /// <summary> /// 返回成功 /// </summary> /// <param name="_resMsg"></param> /// <returns></returns> public static AuthorizeFunRetEntity Success(string _resMsg, object _resData = null) public static AuthorizeFunRetEntity Success(string _resMsg, AuthorizeFunRetEntity newFun) { return new AuthorizeFunRetEntity() { result = true, resMsg = _resMsg, resData = _resData expiryDate = newFun.expiryDate, issueDate = newFun.issueDate, macAddress = newFun.macAddress, projectId = newFun.projectId, type = newFun.type }; } /// <summary> @@ -53,13 +83,19 @@ /// </summary> /// <param name="_resMsg"></param> /// <returns></returns> public static AuthorizeFunRetEntity Success(string _resMsg, double _remainingDays) public static AuthorizeFunRetEntity Success(string _resMsg, double _remainingDays, AuthorizeFunRetEntity newFun) { return new AuthorizeFunRetEntity() { result = true, resMsg = _resMsg, remainingDays = _remainingDays remainingDays = _remainingDays, expiryDate = newFun.expiryDate, issueDate = newFun.issueDate, macAddress = newFun.macAddress, projectId = newFun.projectId, type = newFun.type }; } @@ -99,13 +135,19 @@ /// </summary> /// <param name="_resMsg"></param> /// <returns></returns> public static AuthorizeFunRetEntity Fail(string _resMsg, double _remainingDays) public static AuthorizeFunRetEntity Fail(string _resMsg, double _remainingDays, AuthorizeFunRetEntity newFun) { return new AuthorizeFunRetEntity() { result = false, resMsg = _resMsg, remainingDays = _remainingDays remainingDays = _remainingDays, expiryDate = newFun.expiryDate, issueDate = newFun.issueDate, macAddress = newFun.macAddress, projectId = newFun.projectId, type = newFun.type }; } } Api/Util/AuthorizeHelper.cs
@@ -1,4 +1,5 @@ using 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); @@ -71,10 +73,10 @@ return AuthorizeFunRetEntity.Success("成功", val.RemainingDays, $"授权剩余天数{val.RemainingDays}小于{waringDays}天"); } } return AuthorizeFunRetEntity.Success("成功", val.RemainingDays); return AuthorizeFunRetEntity.Success("成功", val.RemainingDays, newRet); } else return AuthorizeFunRetEntity.Fail("授权失败", val.RemainingDays); return AuthorizeFunRetEntity.Fail("授权失败", val.RemainingDays, newRet); } Api/iWare.Authorize.csproj
@@ -8,6 +8,7 @@ <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> </ItemGroup>