设备升级指令,需要单独发布订阅处理

This commit is contained in:
ChenYi 2025-12-31 17:27:59 +08:00
parent 68ad13af77
commit 7f0563c88d

View File

@ -888,6 +888,8 @@ namespace JiShe.IoT.DeviceAggregation
UpgradeSource = DeviceUpgradeSourceTypeEnum.AdminSystem,
UpgradeIdentifier = Yitter.IdGenerator.YitIdHelper.NextId(),
UpgradeDescription = input.UpgradeDescription,
UpgradeStatus = DeviceUpgradeStatusTypeEnum.NotUpgrade,
Id = GuidGenerator.Create()
};
var md5HashRaw = $"{fileObject.Md5Hash}{productInfo.ProductAccesskey}{upgradeRecordInput.UpgradeIdentifier}{fileObject.FileSize}";
@ -897,7 +899,7 @@ namespace JiShe.IoT.DeviceAggregation
Length = fileObject.FileSize,
UpgradeIdentifier = upgradeRecordInput.UpgradeIdentifier,
SignatureValue = md5HashRaw.Md5Fun(),
FirmwareUrl = $"{serverApplicationOptions.DownloadDeviceFirmwareBasicUrl}",
FirmwareUrl = $"{serverApplicationOptions.DownloadDeviceFirmwareBasicUrl}{upgradeRecordInput.Id}",
TimeOut = serverApplicationOptions.DownloadDeviceFirmwareTimeOut,
};
@ -944,6 +946,13 @@ namespace JiShe.IoT.DeviceAggregation
}
await redisPubSubService.PublishReliableAsync(DistributedMessageCenterConst.OneNETCommandIssuedEventName, packetTaskInfo);
//更新状态为升级中
await deviceUpgradeRecordService.UpdateAsync(new UpdateDeviceUpgradeRecordInput()
{
Id = deviceInfo.Id,
UpgradeStatus = DeviceUpgradeStatusTypeEnum.Upgrading,
});
return true;
}
catch (Exception)