|
@@ -60,9 +60,9 @@ func (d *messageRepo) GetMessage(senderId, seq int64) (*model.Message, error) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// GetMessageSeqForSendTime 获取消息状态 |
|
|
// GetMessageSeqForSendTime 获取消息状态 |
|
|
func (d *messageRepo) GetMessageSeqForSendTime(senderId int64, sendTime time.Time) (int64, error) { |
|
|
|
|
|
|
|
|
func (d *messageRepo) GetMessageSeqForSendTime(userId int64, sendTime time.Time) (int64, error) { |
|
|
var message model.Message |
|
|
var message model.Message |
|
|
if err := db.DB.Where("sender_id = ? and send_time = ?", senderId, sendTime). |
|
|
|
|
|
|
|
|
if err := db.DB.Where("user_id = ? and send_time = ?", userId, sendTime). |
|
|
First(&message).Error; err != nil { |
|
|
First(&message).Error; err != nil { |
|
|
return 0, gerrors.WrapError(err) |
|
|
return 0, gerrors.WrapError(err) |
|
|
} |
|
|
} |
|
@@ -70,8 +70,8 @@ func (d *messageRepo) GetMessageSeqForSendTime(senderId int64, sendTime time.Tim |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// UpdateStatus 更新消息状态 |
|
|
// UpdateStatus 更新消息状态 |
|
|
func (d *messageRepo) UpdateStatus(senderId int64, sendTime time.Time, status int) (int64, error) { |
|
|
|
|
|
db := db.DB.Model(&model.Message{}).Where("sender_id = ? and send_time = ?", senderId, sendTime). |
|
|
|
|
|
|
|
|
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). |
|
|
Update("status", status) |
|
|
Update("status", status) |
|
|
if db.Error != nil { |
|
|
if db.Error != nil { |
|
|
return 0, gerrors.WrapError(db.Error) |
|
|
return 0, gerrors.WrapError(db.Error) |
|
|