by Robin at 20241219

This commit is contained in:
Robin 2024-12-19 14:50:29 +08:00
parent ed1874ba45
commit d78ed6a1ce
2 changed files with 13 additions and 7 deletions

View File

@ -6742,11 +6742,11 @@ func (m *Mongo) GetNotifRecentReceive(ctx *gin.Context, id string) (recentReceiv
func (m *Mongo) GetAndUpdateNotifRecentReceive(ctx *gin.Context, id string, upd *dbstruct.NotifRecentReceive) (recentReceive *dbstruct.NotifRecentReceive, err error) {
col := m.getColNotifRecentReceive()
// 如果库中最近接收时间小于目标接收时间,则认为应该更新
// 如果库中最近接收时间小于等于目标接收时间,则认为应该更新(等于的情况以后更新为准)
filter := qmgo.M{
"_id": id,
"rt": qmgo.M{
"$lt": upd.Rt,
"$lte": upd.Rt,
},
}
@ -6761,7 +6761,11 @@ func (m *Mongo) GetAndUpdateNotifRecentReceive(ctx *gin.Context, id string, upd
}
recentReceiveInstance := dbstruct.NotifRecentReceive{}
if err = col.Find(ctx, filter).Apply(change, &recentReceiveInstance); err != nil {
err = col.Find(ctx, filter).Apply(change, &recentReceiveInstance)
if qmgo.IsDup(err) {
err = nil
}
if err != nil {
logger.Error("change error : %v", err)
return
}

View File

@ -175,8 +175,10 @@ func (handler *NotifBuilderHandler) handleSyncNotifBcstVersForUser() {
func (handler *NotifBuilderHandler) handleSyncNotifBcstVersForStreamer() {
handler.handlerMap[consts.CtrlNotifTemp_SyncNotifBcstVersForStreamer] = func(ctx *gin.Context, args ...any) {
account := args[0].(*dbstruct.Account)
DefaultService.utilWriteNotifInfo(ctx, consts.CtrlNotifTemp_SyncNotifBcstVersForStreamer, account.GetMid())
mids := args[0].([]int64)
for _, mid := range mids {
DefaultService.utilWriteNotifInfo(ctx, consts.CtrlNotifTemp_SyncNotifBcstVersForStreamer, mid)
}
}
}
@ -515,14 +517,14 @@ func (handler *NotifBuilderHandler) handleAudProfileChangeApplied() {
func (handler *NotifBuilderHandler) handleAudProfilePassed() {
handler.handlerMap[consts.AudNotifTemp_ProfilePassed] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.ImageAuditTask)
task := args[0].(*dbstruct.TextAuditTask)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ProfilePassed, task.GetMid())
}
}
func (handler *NotifBuilderHandler) handleAudProfileRejected() {
handler.handlerMap[consts.AudNotifTemp_ProfileRejected] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.ImageAuditTask)
task := args[0].(*dbstruct.TextAuditTask)
remarks := args[1].(string)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ProfileRejected, task.GetMid(), remarks)
}