修复了聊天数据异常丢失的bug
This commit is contained in:
+3
-1
@@ -12,7 +12,9 @@ var ChatMsg = &chatMessageRepo{}
|
||||
func (*chatMessageRepo) GetUserMsgs(db *gorm.DB, uuid string, limit int) []models.ChatMessage {
|
||||
var msgs []models.ChatMessage
|
||||
// ASC:升序(默认),DESC:降序。
|
||||
db.Order("create_tx ASC").Limit(limit).Where("user_id = ?", uuid).Find(&msgs)
|
||||
db.Order("create_tx ASC").Limit(limit).
|
||||
Where("user_id = ? OR tar_user_id = ?", uuid, uuid).
|
||||
Find(&msgs)
|
||||
return msgs
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user