From 693796439b5e6f016c20d34309fa32da437648c7 Mon Sep 17 00:00:00 2001 From: “wangming” <“wangming@antissoft.com”> Date: Wed, 3 Sep 2025 17:57:41 +0800 Subject: [PATCH] 新增获取客户端ID功能,区分生产环境和开发环境,优化MQTT连接时的客户端ID设置,更新相关文档以反映新功能。 --- .DS_Store | Bin 12292 -> 0 bytes antis-ncc-admin/src/views/login/index.vue | 397 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------ antis-ncc-admin/src/views/uavAppUpdateInfo/index.vue | 213 ++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- antis-ncc-admin/src/views/uavDevice/index.vue | 434 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- antis-ncc-admin/src/views/uavDeviceCell/AdjustTimeDialog.vue | 499 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ antis-ncc-admin/src/views/uavDeviceCell/Form.vue | 262 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------- antis-ncc-admin/src/views/uavDeviceCell/index.vue | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------- antis-ncc-admin/src/views/uavDeviceCell/index_new.vue | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ netcore/.DS_Store | Bin 10244 -> 0 bytes netcore/src/.DS_Store | Bin 12292 -> 0 bytes netcore/src/Application/.DS_Store | Bin 10244 -> 0 bytes netcore/src/Application/NCC.API/.DS_Store | Bin 14340 -> 0 bytes netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/AdjustUpdateTimeInput.cs | 20 ++++++++++++++++++++ netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellInfoOutput.cs | 9 ++++++++- netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellListOutput.cs | 9 +++++++++ netcore/src/Modularity/Extend/NCC.Extend/MqttPublisherService.cs | 27 +++++++++++++++++++++++++-- netcore/src/Modularity/Extend/NCC.Extend/NCC.Extend.xml | 13 +++++++++++++ netcore/src/Modularity/Extend/NCC.Extend/UavDeviceCellService.cs | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 18 files changed, 1592 insertions(+), 663 deletions(-) create mode 100644 antis-ncc-admin/src/views/uavDeviceCell/AdjustTimeDialog.vue create mode 100644 antis-ncc-admin/src/views/uavDeviceCell/index_new.vue create mode 100644 netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/AdjustUpdateTimeInput.cs diff --git a/.DS_Store b/.DS_Store index de1aaf0..76bb5ce 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/antis-ncc-admin/src/views/login/index.vue b/antis-ncc-admin/src/views/login/index.vue index 1199e79..bd819fd 100755 --- a/antis-ncc-admin/src/views/login/index.vue +++ b/antis-ncc-admin/src/views/login/index.vue @@ -1,30 +1,54 @@ @@ -963,15 +827,7 @@ box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.2), 0 4px 6px -2px rgba(59, 130, 246, 0.1); } -.modern-device-card.offline { - opacity: 0.7; - background: #f8fafc; -} -.modern-device-card.offline:hover { - border-color: #ef4444; - box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.1), 0 4px 6px -2px rgba(239, 68, 68, 0.05); -} .device-checkbox { width: 100%; @@ -1017,49 +873,7 @@ align-items: center; } -.device-status { - display: flex; - align-items: center; - gap: 3px; - font-size: 11px; - font-weight: 500; - padding: 3px 6px; - border-radius: 4px; -} -.device-status.online { - background: rgba(16, 185, 129, 0.1); - color: #10b981; -} - -.device-status.offline { - background: rgba(239, 68, 68, 0.1); - color: #ef4444; -} - -.modern-device-card.selected .device-status.online { - background: rgba(255, 255, 255, 0.2); - color: white; -} - -.status-dot { - width: 6px; - height: 6px; - border-radius: 50%; - display: inline-block; -} - -.device-status.online .status-dot { - background-color: #10b981; -} - -.device-status.offline .status-dot { - background-color: #ef4444; -} - -.modern-device-card.selected .device-status.online .status-dot { - background-color: white; -} .device-version { font-size: 11px; @@ -1127,10 +941,7 @@ font-weight: 500; } -.online-count { - color: #10b981; - font-weight: 500; -} + .outdated-count { color: #f59e0b; diff --git a/antis-ncc-admin/src/views/uavDevice/index.vue b/antis-ncc-admin/src/views/uavDevice/index.vue index 0c63b74..a95e999 100644 --- a/antis-ncc-admin/src/views/uavDevice/index.vue +++ b/antis-ncc-admin/src/views/uavDevice/index.vue @@ -29,35 +29,6 @@
- - 刷新在线状态 - - - -
-
- 在线: - {{ onlineDeviceCount }} -
-
- 离线: - {{ offlineDeviceCount }} -
-
- 总数: - {{ totalDeviceCount }} -
-
- 在线率: - {{ onlineRate }}% -
-
@@ -74,14 +45,17 @@
名称:{{ item.deviceName }} -
+
- {{ item.isOnline ? '在线' : '离线' }} + {{ item.isOnline ? '在线' : '离线' }}
编号:{{ item.deviceCode ? item.deviceCode.toUpperCase() : '' }} - +
+ + +
代理商:{{ item.belongUserName }} @@ -196,37 +170,13 @@ export default { showQr: false, qrImgUrl: '',// 二维码图片地址 qrmessage: '暂无二维码', // 二维码提示信息 - statusLoading: false, // 在线状态加载状态 - deviceStats: { - onlineCount: 0, - offlineCount: 0, - totalCount: 0 - } // 设备统计数据 - } - }, - computed: { - // 计算在线设备数量 - onlineDeviceCount() { - return this.deviceStats.onlineCount || 0; - }, - // 计算离线设备数量 - offlineDeviceCount() { - return this.deviceStats.offlineCount || 0; - }, - // 计算总设备数量 - totalDeviceCount() { - return this.deviceStats.totalCount || 0; - }, - // 计算在线率 - onlineRate() { - if (this.totalDeviceCount === 0) return 0; - return Math.round((this.onlineDeviceCount / this.totalDeviceCount) * 100); + } }, + created() { this.initData() this.getsiteIdOptions(); - this.getDeviceStats(); // 获取设备统计数据 }, methods: { getStatusColor(status) { @@ -362,7 +312,6 @@ export default { sidx: "", } this.initData() - this.getDeviceStats() // 更新统计数据 }, refresh(isrRefresh) { this.formVisible = false @@ -380,286 +329,63 @@ export default { } this.initData() - this.getDeviceStats() // 更新统计数据 }, - // 刷新在线状态 - refreshOnlineStatus() { - this.statusLoading = true; - this.getDeviceOnlineStatus(); - this.getDeviceOnlineStatusAsync(); // 直接调用异步获取在线状态 + // 推送APP更新 + pushAppUpdate(device) { + if (!device.isOnline) { + this.$message.warning('设备离线,无法推送更新'); + return; + } - // 延迟结束loading状态 - setTimeout(() => { - this.statusLoading = false; - }, 1000); - }, - - // 获取设备统计数据(快速版本) - getDeviceStats() { - // 先获取设备总数,快速显示 - request({ - url: `/api/Extend/UavDevice`, - method: 'GET', - data: { - currentPage: 1, - pageSize: 1, // 只获取1条数据来获取总数 - sort: "desc", - sidx: "", - ...this.query - } - }).then(res => { - if (res.data && res.data.pagination) { - const totalCount = res.data.pagination.total || 0; - - // 先显示总数,在线状态默认为0 - this.deviceStats = { - onlineCount: 0, - offlineCount: totalCount, - totalCount: totalCount - }; - - // 如果有设备,异步获取在线状态 - if (totalCount > 0) { - this.getDeviceOnlineStatusAsync(); + this.$confirm(`确定要推送APP更新到设备 "${device.deviceName}" 吗?`, '确认推送', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$message.info('正在推送APP更新,请稍候...'); + + // 调用推送更新接口 + request({ + url: `/api/Extend/UavDevice/PushAppUpdate`, + method: 'POST', + data: { + deviceCode: device.deviceCode, + downloadUrl: "" // 可选参数,传空字符串使用默认下载地址 } - } else { - this.deviceStats = { - onlineCount: 0, - offlineCount: 0, - totalCount: 0 - }; - } - }).catch(error => { - console.error('获取设备总数失败:', error); - this.deviceStats = { - onlineCount: 0, - offlineCount: 0, - totalCount: 0 - }; - }); - }, - - // 异步获取设备在线状态 - getDeviceOnlineStatusAsync() { - // 获取所有设备 - request({ - url: `/api/Extend/UavDevice`, - method: 'GET', - data: { - currentPage: 1, - pageSize: 10000, - sort: "desc", - sidx: "", - ...this.query - } - }).then(res => { - if (res.data && res.data.list) { - const allDevices = res.data.list; - const deviceCodes = allDevices.map(item => item.deviceCode).filter(code => code); - - if (deviceCodes.length > 0) { - // 显示查询提示 - this.$message.info('正在查询设备在线状态,请稍候...'); + }).then(res => { + if (res.code === 200) { + this.$message.success(`APP更新推送成功!设备:${device.deviceName}`); - request({ - url: `/api/Extend/UavDevice/BatchCheckOnlineStatus`, - method: 'POST', - data: { - deviceIds: deviceCodes - } - }).then(statusRes => { - if (statusRes.data && statusRes.data.length > 0) { - let onlineCount = 0; - let offlineCount = 0; - - statusRes.data.forEach(statusInfo => { - if (statusInfo.isOnline) { - onlineCount++; - } else { - offlineCount++; - } - }); - - // 更新统计数据 - this.deviceStats = { - onlineCount: onlineCount, - offlineCount: offlineCount, - totalCount: allDevices.length - }; - - // 显示查询结果 - this.$message.success(`设备状态查询完成,在线:${onlineCount}个,离线:${offlineCount}个`); - } else { - this.deviceStats = { - onlineCount: 0, - offlineCount: allDevices.length, - totalCount: allDevices.length - }; - } - }).catch(error => { - console.error('获取设备在线状态失败:', error); - this.$message.warning('在线状态查询失败,将显示为离线状态'); - }); + // 可选:刷新设备状态 + setTimeout(() => { + this.getDeviceOnlineStatus(); + }, 2000); + } else { + this.$message.error(res.msg || 'APP更新推送失败'); } - } - }).catch(error => { - console.error('获取设备列表失败:', error); + }).catch(error => { + console.error('推送APP更新失败:', error); + this.$message.error('APP更新推送失败,请检查网络连接'); + }); + }).catch(() => { + this.$message.info('已取消推送'); }); - } + }, + + } } \ No newline at end of file diff --git a/antis-ncc-admin/src/views/uavDeviceCell/AdjustTimeDialog.vue b/antis-ncc-admin/src/views/uavDeviceCell/AdjustTimeDialog.vue new file mode 100644 index 0000000..aa6d2f9 --- /dev/null +++ b/antis-ncc-admin/src/views/uavDeviceCell/AdjustTimeDialog.vue @@ -0,0 +1,499 @@ + + + + + diff --git a/antis-ncc-admin/src/views/uavDeviceCell/Form.vue b/antis-ncc-admin/src/views/uavDeviceCell/Form.vue index c33750d..5b07f32 100644 --- a/antis-ncc-admin/src/views/uavDeviceCell/Form.vue +++ b/antis-ncc-admin/src/views/uavDeviceCell/Form.vue @@ -1,32 +1,52 @@  @@ -73,6 +93,31 @@ this.deviceIdOptions = res.data }); }, + + // 获取设备名称 + getDeviceName(deviceId) { + if (!deviceId || !this.deviceIdOptions.length) return '--'; + const device = this.deviceIdOptions.find(item => item.F_Id === deviceId); + return device ? device.F_DeviceName : '--'; + }, + + // 获取状态名称 + getStatusName(status) { + const statusItem = this.statusOptions.find(item => item.id === status); + return statusItem ? statusItem.fullName : '未知'; + }, + + // 获取状态颜色 + getStatusColor(status) { + const colorMap = { + 1: 'success', // 空闲 - 绿色 + 2: 'info', // 停用 - 灰色 + 3: 'warning', // 充电 - 橙色 + 4: 'danger', // 损坏 - 红色 + 5: 'primary' // 已租接 - 蓝色 + } + return colorMap[status] || 'success' + }, goBack() { this.$emit('refresh') }, @@ -134,3 +179,178 @@ } } + + diff --git a/antis-ncc-admin/src/views/uavDeviceCell/index.vue b/antis-ncc-admin/src/views/uavDeviceCell/index.vue index 28bef96..695032d 100644 --- a/antis-ncc-admin/src/views/uavDeviceCell/index.vue +++ b/antis-ncc-admin/src/views/uavDeviceCell/index.vue @@ -1,4 +1,4 @@ - + \ No newline at end of file + + + diff --git a/antis-ncc-admin/src/views/uavDeviceCell/index_new.vue b/antis-ncc-admin/src/views/uavDeviceCell/index_new.vue new file mode 100644 index 0000000..b81b440 --- /dev/null +++ b/antis-ncc-admin/src/views/uavDeviceCell/index_new.vue @@ -0,0 +1,218 @@ + + + + + diff --git a/netcore/.DS_Store b/netcore/.DS_Store index 121bf43..f8dd301 100644 Binary files a/netcore/.DS_Store and b/netcore/.DS_Store differ diff --git a/netcore/src/.DS_Store b/netcore/src/.DS_Store index 24c4e10..9f75ce5 100644 Binary files a/netcore/src/.DS_Store and b/netcore/src/.DS_Store differ diff --git a/netcore/src/Application/.DS_Store b/netcore/src/Application/.DS_Store index c599f52..b83c3eb 100644 Binary files a/netcore/src/Application/.DS_Store and b/netcore/src/Application/.DS_Store differ diff --git a/netcore/src/Application/NCC.API/.DS_Store b/netcore/src/Application/NCC.API/.DS_Store index 783dc51..785875a 100644 Binary files a/netcore/src/Application/NCC.API/.DS_Store and b/netcore/src/Application/NCC.API/.DS_Store differ diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/AdjustUpdateTimeInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/AdjustUpdateTimeInput.cs new file mode 100644 index 0000000..f23c53a --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/AdjustUpdateTimeInput.cs @@ -0,0 +1,20 @@ +using System; + +namespace NCC.Extend.Entitys.Dto.UavDeviceCell +{ + /// + /// 调整格位修改时间输入参数 + /// + public class AdjustUpdateTimeInput + { + /// + /// 格位ID + /// + public string CellId { get; set; } + + /// + /// 新的修改时间 + /// + public DateTime NewUpdateTime { get; set; } + } +} diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellInfoOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellInfoOutput.cs index 08013d5..c7f5039 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellInfoOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellInfoOutput.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using NCC.Common.Extension; +using NCC.Extend.Entitys.Enums; namespace NCC.Extend.Entitys.Dto.UavDeviceCell { @@ -26,7 +28,12 @@ namespace NCC.Extend.Entitys.Dto.UavDeviceCell /// /// 格子状态(1空闲,2租赁中,3故障) /// - public string status { get; set; } + public int status { get; set; } + + /// + /// 格子状态中文描述 + /// + public string statusName { get; set; } /// /// 备注 diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellListOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellListOutput.cs index 278c70b..2ed7cc5 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellListOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavDeviceCell/Dto/UavDeviceCellListOutput.cs @@ -75,6 +75,15 @@ namespace NCC.Extend.Entitys.Dto.UavDeviceCell /// public string uavCode { get; set; } + /// + /// 创建时间 + /// + public DateTime? createTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime? updateTime { get; set; } } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend/MqttPublisherService.cs b/netcore/src/Modularity/Extend/NCC.Extend/MqttPublisherService.cs index e2c7d23..f2c00f7 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/MqttPublisherService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/MqttPublisherService.cs @@ -90,6 +90,28 @@ public class MqttPublisherService : IMqttPublisherService, ITransient, IDisposab private const int RETRY_INTERVAL_MINUTES = 5; // 重试间隔5分钟 /// + /// 获取客户端ID,区分生产环境和开发环境 + /// + /// 客户端ID + private string GetClientId() + { + // 手动设置:true为生产环境,false为开发环境 + bool isProduction = false; // 这里可以手动调整 + + if (isProduction) + { + // 生产环境使用固定ID + return "server_publisher"; + } + else + { + // 开发环境使用带机器名的ID,避免冲突 + var machineName = Environment.MachineName; + return $"dev_publisher_{machineName}"; + } + } + + /// /// 构造函数:初始化客户端和配置、注册事件 /// public MqttPublisherService(IServiceProvider serviceProvider, ISqlSugarClient db) @@ -101,10 +123,11 @@ public class MqttPublisherService : IMqttPublisherService, ITransient, IDisposab _mqttClient = factory.CreateMqttClient(); // 构建连接配置(MQTT 服务器地址、端口、用户名密码、客户端 ID) + var clientId = GetClientId(); _mqttOptions = new MqttClientOptionsBuilder() .WithTcpServer("mqtt.cqjiangzhichao.cn", 1883) // Broker 地址 .WithCredentials("wrjservice", "P@ssw0rd") // 账号密码 - .WithClientId("server_publisher") // 客户端 ID,必须唯一 + .WithClientId(clientId) // 客户端 ID,必须唯一 .WithKeepAlivePeriod(TimeSpan.FromSeconds(60)) // 保持连接心跳 .WithCleanSession(false) // 保持会话状态 .Build(); @@ -112,7 +135,7 @@ public class MqttPublisherService : IMqttPublisherService, ITransient, IDisposab // 连接成功事件:订阅所有设备的响应主题(如 device/xxx/response) _mqttClient.UseConnectedHandler(async e => { - Log.Information("MQTT 已连接成功"); + Log.Information($"MQTT 已连接成功,客户端ID: {_mqttOptions.ClientId}"); _subscriptionVerified = false; // 重置订阅验证状态 // 订阅所有设备的响应主题(+ 代表通配符) diff --git a/netcore/src/Modularity/Extend/NCC.Extend/NCC.Extend.xml b/netcore/src/Modularity/Extend/NCC.Extend/NCC.Extend.xml index 42eee6b..4de97eb 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/NCC.Extend.xml +++ b/netcore/src/Modularity/Extend/NCC.Extend/NCC.Extend.xml @@ -157,6 +157,12 @@ MQTT 连接参数配置 + + + 获取客户端ID,区分生产环境和开发环境 + + 客户端ID + 构造函数:初始化客户端和配置、注册事件 @@ -623,6 +629,13 @@ + + + 调整格位修改时间 + + 调整时间输入参数 + + 设备串口日志服务 diff --git a/netcore/src/Modularity/Extend/NCC.Extend/UavDeviceCellService.cs b/netcore/src/Modularity/Extend/NCC.Extend/UavDeviceCellService.cs index f7ae88b..0040a55 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/UavDeviceCellService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/UavDeviceCellService.cs @@ -82,6 +82,8 @@ namespace NCC.Extend.UavDeviceCell rfid1 = it.Rfid1, rfid2 = it.Rfid2, uavCode = it.UavCode, + createTime = it.CreateTime, + updateTime = it.UpdateTime, }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(data); } @@ -133,6 +135,53 @@ namespace NCC.Extend.UavDeviceCell var isOk = await _db.Deleteable().Where(d => d.Id == id).ExecuteCommandAsync(); if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1002); } + #endregion + + #region 调整格位修改时间 + /// + /// 调整格位修改时间 + /// + /// 调整时间输入参数 + /// + [HttpPost("AdjustUpdateTime")] + public async Task AdjustUpdateTime([FromBody] AdjustUpdateTimeInput input) + { + try + { + if (input == null) + { + throw NCCException.Oh(ErrorCode.COM1000, "输入参数不能为空"); + } + + if (string.IsNullOrEmpty(input.CellId)) + { + throw NCCException.Oh(ErrorCode.COM1000, "格位ID不能为空"); + } + + var entity = await _db.Queryable().FirstAsync(p => p.Id == input.CellId); + _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005, "格位不存在"); + + // 记录原始时间用于调试 + var originalTime = entity.UpdateTime; + + // 更新修改时间 + entity.UpdateTime = input.NewUpdateTime; + + var isOk = await _db.Updateable(entity) + .UpdateColumns(it => new { it.UpdateTime }) + .ExecuteCommandAsync(); + + if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001, "更新失败"); + + // 这里可以添加日志记录 + // TODO: 添加操作日志记录 + } + catch (Exception ex) + { + // 记录异常日志 + throw NCCException.Oh(ErrorCode.COM1000, $"调整修改时间失败: {ex.Message}"); + } + } + #endregion } - #endregion } -- libgit2 0.21.4