新邀请活动

This commit is contained in:
sk 2024-06-28 18:37:07 +08:00
parent 303f0817ca
commit f1ebe57d04
2 changed files with 5 additions and 2 deletions

View File

@ -115,6 +115,9 @@ func init() {
return err
}
defer session.EndSession(context.Background())
// 事务不支持创建集合和索引,需要提前创建
svc.InviteScoreCollection(log.Platform)
svc.RankInviteCollection(log.Platform)
var notifySnId []int32
// 修改积分

View File

@ -1664,7 +1664,7 @@ func AddInviteScore(client *newMongo.Client, sc newMongo.SessionContext, platfor
}
// 更新排行榜
data := &model.RankInvite{
data := model.RankInvite{
Platform: platform,
SnId: psnId,
Num: res.INum + addNum,
@ -1672,7 +1672,7 @@ func AddInviteScore(client *newMongo.Client, sc newMongo.SessionContext, platfor
Ts: now.Unix(),
Week: common.GetWeekStartTs(now.Unix()),
}
_, err = rankC.UpdateOne(sc, newBson.M{"snid": psnId, "week": data.Week}, data, options.Update().SetUpsert(true))
_, err = rankC.UpdateOne(sc, newBson.M{"snid": psnId, "week": data.Week}, newBson.M{"$set": data}, options.Update().SetUpsert(true))
if err != nil {
logger.Logger.Tracef("SaveRankInvite error:%v", err)
return err