set IsMsgDestruct

This commit is contained in:
wangchuxiao
2023-07-10 11:58:04 +08:00
parent ece2498d18
commit c02f3cc8d5
6 changed files with 454 additions and 426 deletions
+1 -1
View File
@@ -93,5 +93,5 @@ func (c *ConversationGorm) GetConversationsByConversationID(ctx context.Context,
}
func (c *ConversationGorm) GetConversationIDsNeedDestruct(ctx context.Context) (conversations []*relation.ConversationModel, err error) {
return conversations, utils.Wrap(c.db(ctx).Where("UNIX_TIMESTAMP(NOW()) > (msg_destruct_time + UNIX_TIMESTAMP(latest_msg_destruct_time)) && msg_destruct_time != 0").Error, "")
return conversations, utils.Wrap(c.db(ctx).Where("is_msg_destruct = 1 && UNIX_TIMESTAMP(NOW()) > (msg_destruct_time + UNIX_TIMESTAMP(latest_msg_destruct_time)) && msg_destruct_time != 0").Error, "")
}
+2 -1
View File
@@ -25,7 +25,8 @@ type ConversationModel struct {
MaxSeq int64 `gorm:"column:max_seq" json:"maxSeq"`
MinSeq int64 `gorm:"column:min_seq" json:"minSeq"`
CreateTime time.Time `gorm:"column:create_time;index:create_time;autoCreateTime"`
MsgDestructTime int64 `gorm:"column:msg_destruct_time;default:0"`
IsMsgDestruct bool `gorm:"column:is_msg_destruct;default:false"`
MsgDestructTime int64 `gorm:"column:msg_destruct_time;default:604800"`
LatestMsgDestructTime time.Time `gorm:"column:latest_msg_destruct_time;autoCreateTime"`
}