From a95ce44baa9452c7d4c1bbd1c7bdfb76ea01b610 Mon Sep 17 00:00:00 2001 From: wbc <2597324127@qq.com> Date: 星期四, 29 五月 2025 15:24:58 +0800 Subject: [PATCH] 修改异常 --- MES.Service/service/SysUpdateManager.cs | 39 +++++++++++++++++++ MESApplication/bin/Debug/net8.0/MESApplication.pdb | 0 MESApplication/bin/Debug/net8.0/MESApplication.exe | 0 MESApplication/Controllers/Base/UpdateController.cs | 31 ++++----------- MESApplication/bin/Debug/net8.0/MES.Service.pdb | 0 MESApplication/bin/Debug/net8.0/MESApplication.dll | 0 MES.Service/bin/Debug/net8.0/MES.Service.dll | 0 MESApplication/bin/Debug/net8.0/MES.Service.dll | 0 MES.Service/bin/Debug/net8.0/MES.Service.pdb | 0 9 files changed, 47 insertions(+), 23 deletions(-) diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.dll b/MES.Service/bin/Debug/net8.0/MES.Service.dll index 32dfbf5..d22604f 100644 --- a/MES.Service/bin/Debug/net8.0/MES.Service.dll +++ b/MES.Service/bin/Debug/net8.0/MES.Service.dll Binary files differ diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.pdb b/MES.Service/bin/Debug/net8.0/MES.Service.pdb index 996f0a4..e8542cf 100644 --- a/MES.Service/bin/Debug/net8.0/MES.Service.pdb +++ b/MES.Service/bin/Debug/net8.0/MES.Service.pdb Binary files differ diff --git a/MES.Service/service/SysUpdateManager.cs b/MES.Service/service/SysUpdateManager.cs new file mode 100644 index 0000000..348eb6b --- /dev/null +++ b/MES.Service/service/SysUpdateManager.cs @@ -0,0 +1,39 @@ +锘縰sing MES.Service.DB; +using MES.Service.Dto.@base; +using MES.Service.Dto.service; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.util; +using Microsoft.Data.SqlClient; +using SqlSugar; +using System.Data; +using System.Dynamic; + +namespace MES.Service.service +{ + public class SysUpdateManager : Repository<SysUser> + { + + // 鑾峰彇鏈�鏂扮増鏈俊鎭� + public VersionInfo GetLatestVersion(string platform) + { + // 杩欓噷鍙互浠庢暟鎹簱鎴栭厤缃枃浠朵腑璇诲彇 + // 绀轰緥涓洿鎺ヨ繑鍥炵‖缂栫爜鐨勭増鏈俊鎭� + return new VersionInfo + { + Version = "1.0.1", + UpdateInfo = "1. 淇浜嗕竴浜涘凡鐭ラ棶棰榎n2. 浼樺寲浜嗙敤鎴蜂綋楠孿n3. 鏂板浜嗕竴浜涘姛鑳�", + WgtUrl = "http://192.168.1.223:8085/updates/app_update_1.0.1.wgt", + IsForceUpdate = false + }; + } + + // 姣旇緝鐗堟湰鍙� + public int CompareVersion(string version1, string version2) + { + var v1 = new Version(version1); + var v2 = new Version(version2); + return v1.CompareTo(v2); + } + } +} diff --git a/MESApplication/Controllers/Base/UpdateController.cs b/MESApplication/Controllers/Base/UpdateController.cs index 9290acf..edec59a 100644 --- a/MESApplication/Controllers/Base/UpdateController.cs +++ b/MESApplication/Controllers/Base/UpdateController.cs @@ -11,6 +11,11 @@ [Route("api/[controller]")] public class UpdateController : ControllerBase { + + + private readonly SysUpdateManager _sysUpdateManager = new SysUpdateManager(); + + [HttpPost] [Route("checkUpdate")] public ResponseResult CheckUpdate([FromBody] UpdateCheckRequest request) @@ -18,10 +23,10 @@ try { // 浠庨厤缃枃浠舵垨鏁版嵁搴撹幏鍙栨渶鏂扮増鏈俊鎭� - var latestVersion = GetLatestVersion(request.platform); + var latestVersion = _sysUpdateManager.GetLatestVersion(request.platform); // 姣旇緝鐗堟湰鍙� - if (CompareVersion(request.version, latestVersion.Version) < 0) + if (_sysUpdateManager.CompareVersion(request.version, latestVersion.Version) < 0) { // 闇�瑕佹洿鏂� return new ResponseResult @@ -55,26 +60,6 @@ } } - // 鑾峰彇鏈�鏂扮増鏈俊鎭� - public VersionInfo GetLatestVersion(string platform) - { - // 杩欓噷鍙互浠庢暟鎹簱鎴栭厤缃枃浠朵腑璇诲彇 - // 绀轰緥涓洿鎺ヨ繑鍥炵‖缂栫爜鐨勭増鏈俊鎭� - return new VersionInfo - { - Version = "1.0.1", - UpdateInfo = "1. 淇浜嗕竴浜涘凡鐭ラ棶棰榎n2. 浼樺寲浜嗙敤鎴蜂綋楠孿n3. 鏂板浜嗕竴浜涘姛鑳�", - WgtUrl = "https://192.168.1.223:8085/updates/app_update_1.0.1.wgt", - IsForceUpdate = false - }; - } - - // 姣旇緝鐗堟湰鍙� - private int CompareVersion(string version1, string version2) - { - var v1 = new Version(version1); - var v2 = new Version(version2); - return v1.CompareTo(v2); - } + } diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.dll b/MESApplication/bin/Debug/net8.0/MES.Service.dll index 32dfbf5..d22604f 100644 --- a/MESApplication/bin/Debug/net8.0/MES.Service.dll +++ b/MESApplication/bin/Debug/net8.0/MES.Service.dll Binary files differ diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.pdb b/MESApplication/bin/Debug/net8.0/MES.Service.pdb index 996f0a4..e8542cf 100644 --- a/MESApplication/bin/Debug/net8.0/MES.Service.pdb +++ b/MESApplication/bin/Debug/net8.0/MES.Service.pdb Binary files differ diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.dll b/MESApplication/bin/Debug/net8.0/MESApplication.dll index 661da81..f7e00a3 100644 --- a/MESApplication/bin/Debug/net8.0/MESApplication.dll +++ b/MESApplication/bin/Debug/net8.0/MESApplication.dll Binary files differ diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.exe b/MESApplication/bin/Debug/net8.0/MESApplication.exe index 689dc15..d730051 100644 --- a/MESApplication/bin/Debug/net8.0/MESApplication.exe +++ b/MESApplication/bin/Debug/net8.0/MESApplication.exe Binary files differ diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.pdb b/MESApplication/bin/Debug/net8.0/MESApplication.pdb index 6228cea..f9fe5ee 100644 --- a/MESApplication/bin/Debug/net8.0/MESApplication.pdb +++ b/MESApplication/bin/Debug/net8.0/MESApplication.pdb Binary files differ -- Gitblit v1.9.3