|
|
@@ -59,6 +59,16 @@ func (d *messageRepo) GetMessage(senderId, seq int64) (*model.Message, error) { |
|
|
|
return &message, nil |
|
|
|
} |
|
|
|
|
|
|
|
// GetMessageSeqForSendTime 获取消息状态 |
|
|
|
func (d *messageRepo) GetMessageSeqForSendTime(senderId int64, sendTime time.Time) (int64, error) { |
|
|
|
var message model.Message |
|
|
|
if err := db.DB.Where("sender_id = ? and send_time = ?", senderId, sendTime). |
|
|
|
First(&message).Error; err != nil { |
|
|
|
return 0, gerrors.WrapError(err) |
|
|
|
} |
|
|
|
return message.Seq, nil |
|
|
|
} |
|
|
|
|
|
|
|
// 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). |
|
|
@@ -66,5 +76,6 @@ func (d *messageRepo) UpdateStatus(senderId int64, sendTime time.Time, status in |
|
|
|
if db.Error != nil { |
|
|
|
return 0, gerrors.WrapError(db.Error) |
|
|
|
} |
|
|
|
|
|
|
|
return db.RowsAffected, nil |
|
|
|
} |