初始化充值金额

This commit is contained in:
sk 2024-07-10 15:00:56 +08:00
parent 8c843ecf0b
commit 3c910a4ad7
2 changed files with 5 additions and 2 deletions

View File

@ -114,8 +114,8 @@ func GetMoneyTotal(platform string, snid int32) int64 {
} }
tc := new(m) tc := new(m)
err = c.Pipe([]bson.M{ err = c.Pipe([]bson.M{
{"$match": bson.M{"snid": snid, "state": 1, "consumenum": bson.M{"$gt": 0}}}, {"$match": bson.M{"snid": snid, "state": 1, "consumetypenum": bson.M{"$gt": 0}}},
{"$group": bson.M{"_id": nil, "total": bson.M{"$sum": "$consumenum"}}}, {"$group": bson.M{"_id": nil, "total": bson.M{"$sum": "$consumetypenum"}}},
}).AllowDiskUse().One(tc) }).AllowDiskUse().One(tc)
if err != nil && !errors.Is(err, mgo.ErrNotFound) { if err != nil && !errors.Is(err, mgo.ErrNotFound) {
logger.Logger.Error("GetMoneyTotal error:", err) logger.Logger.Error("GetMoneyTotal error:", err)

View File

@ -73,6 +73,7 @@ func GetItemCount(platform string, snid, id int32, tp int) (count int64) {
swapN = tc.Count swapN = tc.Count
// 比赛返回 // 比赛返回
tc = new(m)
err = c.Pipe([]bson.M{ err = c.Pipe([]bson.M{
{"$match": bson.M{"snid": snid, "logtype": 0, "itemid": id, "typeid": common.GainWay_MatchSignup}}, {"$match": bson.M{"snid": snid, "logtype": 0, "itemid": id, "typeid": common.GainWay_MatchSignup}},
{"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}}, {"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}},
@ -84,6 +85,7 @@ func GetItemCount(platform string, snid, id int32, tp int) (count int64) {
matchN = tc.Count matchN = tc.Count
// 消耗总数量 // 消耗总数量
tc = new(m)
err = c.Pipe([]bson.M{ err = c.Pipe([]bson.M{
{"$match": bson.M{"snid": snid, "logtype": 1, "itemid": id}}, {"$match": bson.M{"snid": snid, "logtype": 1, "itemid": id}},
{"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}}, {"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}},
@ -95,6 +97,7 @@ func GetItemCount(platform string, snid, id int32, tp int) (count int64) {
costN = tc.Count costN = tc.Count
// 获得总数量 // 获得总数量
tc = new(m)
err = c.Pipe([]bson.M{ err = c.Pipe([]bson.M{
{"$match": bson.M{"snid": snid, "logtype": 0, "itemid": id}}, {"$match": bson.M{"snid": snid, "logtype": 0, "itemid": id}},
{"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}}, {"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}},