wbc
2025-05-29 a95ce44baa9452c7d4c1bbd1c7bdfb76ea01b610
修改异常
已添加1个文件
已修改8个文件
68 ■■■■■ 文件已修改
MES.Service/bin/Debug/net8.0/MES.Service.dll 补丁 | 查看 | 原始文档 | blame | 历史
MES.Service/bin/Debug/net8.0/MES.Service.pdb 补丁 | 查看 | 原始文档 | blame | 历史
MES.Service/service/SysUpdateManager.cs 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
MESApplication/Controllers/Base/UpdateController.cs 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
MESApplication/bin/Debug/net8.0/MES.Service.dll 补丁 | 查看 | 原始文档 | blame | 历史
MESApplication/bin/Debug/net8.0/MES.Service.pdb 补丁 | 查看 | 原始文档 | blame | 历史
MESApplication/bin/Debug/net8.0/MESApplication.dll 补丁 | 查看 | 原始文档 | blame | 历史
MESApplication/bin/Debug/net8.0/MESApplication.exe 补丁 | 查看 | 原始文档 | blame | 历史
MESApplication/bin/Debug/net8.0/MESApplication.pdb 补丁 | 查看 | 原始文档 | blame | 历史
MES.Service/bin/Debug/net8.0/MES.Service.dll
Binary files differ
MES.Service/bin/Debug/net8.0/MES.Service.pdb
Binary files differ
MES.Service/service/SysUpdateManager.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,39 @@
using 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);
        }
    }
}
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);
    }
}
MESApplication/bin/Debug/net8.0/MES.Service.dll
Binary files differ
MESApplication/bin/Debug/net8.0/MES.Service.pdb
Binary files differ
MESApplication/bin/Debug/net8.0/MESApplication.dll
Binary files differ
MESApplication/bin/Debug/net8.0/MESApplication.exe
Binary files differ
MESApplication/bin/Debug/net8.0/MESApplication.pdb
Binary files differ