lora mesh 发送即收到

This commit is contained in:
2025-10-20 19:31:19 +08:00
parent be8275b936
commit a32749cef8
4 changed files with 23 additions and 2 deletions

View File

@@ -113,6 +113,13 @@ func (g *GeneralDeviceService) Switch(device *models.Device, action DeviceAction
DeviceID: areaController.ID,
SentAt: time.Now(),
}
if sendResult.AcknowledgedAt != nil {
logRecord.AcknowledgedAt = sendResult.AcknowledgedAt
}
if sendResult.ReceivedSuccess != nil {
logRecord.ReceivedSuccess = *sendResult.ReceivedSuccess
}
if err := g.deviceCommandLogRepo.Create(logRecord); err != nil {
// 记录日志失败是一个需要关注的问题,但可能不应该中断主流程。
// 我们记录一个错误日志,然后成功返回。