diff --git a/internal/logic/domain/message/repo/message_repo.go b/internal/logic/domain/message/repo/message_repo.go index a3be6c9..8d5f6b7 100644 --- a/internal/logic/domain/message/repo/message_repo.go +++ b/internal/logic/domain/message/repo/message_repo.go @@ -62,12 +62,8 @@ func (d *messageRepo) GetMessage(senderId, seq int64) (*model.Message, error) { // GetMessageSeqForSendTime 获取消息状态 func (d *messageRepo) GetMessageSeqForSendTime(userId int64, sendTime time.Time) (int64, error) { - utils.FilePutContents("GetMessageSeqForSendTime", utils.SerializeStr(map[string]interface{}{ - "userId": userId, - "sendTime": sendTime, - })) var message model.Message - if err := db.DB.Where("user_id = ? and send_time = ?", userId, sendTime). + if err := db.DB.Table(d.tableName(userId)).Where("user_id = ? and send_time = ?", userId, sendTime). First(&message).Error; err != nil { return 0, gerrors.WrapError(err) } @@ -82,7 +78,7 @@ func (d *messageRepo) GetMessageSeqForSendTime(userId int64, sendTime time.Time) // UpdateStatus 更新消息状态 func (d *messageRepo) UpdateStatus(userId int64, sendTime time.Time, status int) (int64, error) { - db := db.DB.Model(&model.Message{}).Where("user_id = ? and send_time = ?", userId, sendTime). + db := db.DB.Model(&model.Message{}).Table(d.tableName(userId)).Where("user_id = ? and send_time = ?", userId, sendTime). Update("status", status) if db.Error != nil { return 0, gerrors.WrapError(db.Error)