修复聊天消息不显示最新数据:所有列表查询排序从 created_at DESC 改为 id DESC,记录创建函数显式设置 CreatedAt,后端 v1.2.1 / 前端 v0.3.1

This commit is contained in:
2026-08-07 22:21:26 +08:00
parent b6fabf59b7
commit 92e766dfa8
11 changed files with 19 additions and 12 deletions
+2
View File
@@ -1291,6 +1291,7 @@ func textMessageFromRecord(record map[string]any, clientInfo MQTTClientInfo) (*T
MQTTRemoteHost: clientFields.MQTTRemoteHost,
MQTTRemotePort: clientFields.MQTTRemotePort,
ContentJSON: common.ContentJSON,
CreatedAt: time.Now(),
}, nil
}
@@ -1401,6 +1402,7 @@ func AppendPacketFieldsFromRecord(record map[string]any, wantType string, client
DecryptSuccess: nullableBool(record["decrypt_success"]),
DecryptStatus: NullableString(record["decrypt_status"]),
ContentJSON: string(contentJSON),
CreatedAt: time.Now(),
}, MQTTClientRecordFields{
MQTTClientID: NullableString(clientInfo.ClientID),
MQTTUsername: NullableString(clientInfo.Username),