商队赛季数据
This commit is contained in:
parent
85004bc35b
commit
18778c8a5d
@ -220,10 +220,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 减少虚拟币
|
||||
// caravan.Merchantmoney -= addScore
|
||||
// update["merchantmoney"] = caravan.Merchantmoney
|
||||
if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{{
|
||||
A: "attr",
|
||||
T: "merchantmoney",
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
"go_dreamfactory/utils"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
@ -447,7 +446,6 @@ func (this *Caravan) Rpc_ModuleCaravanSettlement(ctx context.Context, args *pb.E
|
||||
log.Field{Key: "args", Value: args.String()},
|
||||
)
|
||||
go func() {
|
||||
sTime := time.Now()
|
||||
var (
|
||||
rankIndex int32
|
||||
stag string
|
||||
@ -501,26 +499,19 @@ func (this *Caravan) Rpc_ModuleCaravanSettlement(ctx context.Context, args *pb.E
|
||||
this.mail.SendMailByUID(temp.Uid, "CaravanRewards", res, []string{})
|
||||
}
|
||||
}
|
||||
model.DB.UpdateOne(comm.TableCaravanRank, bson.M{"_id": temp.Id}, bson.M{"$set": bson.M{
|
||||
"merchantmoney": 0,
|
||||
}})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Query := bson.M{}
|
||||
Query["merchantmoney"] = 0
|
||||
_, err = this.modelCaravan.DB.UpdateMany(core.SqlTable(comm.TableUser), bson.M{"merchantmoney": bson.M{"$gt": 0}}, bson.M{"$set": Query}, options.MergeUpdateOptions().SetUpsert(true)) //, new(options.UpdateOptions).SetUpsert(true)
|
||||
if err != nil {
|
||||
Query["profit"] = 0
|
||||
|
||||
if _, err = model.DB.UpdateMany(core.SqlTable(comm.TableUser), bson.M{"merchantmoney": bson.M{"$gt": 0}}, bson.M{"$set": Query}, options.MergeUpdateOptions().SetUpsert(true)); err != nil {
|
||||
this.Errorf("Update Merchantmoney Many error: %v", err)
|
||||
}
|
||||
Query = bson.M{}
|
||||
Query["profit"] = 0
|
||||
_, err = this.modelCaravan.DB.UpdateMany(core.SqlTable(comm.TableUser), bson.M{"profit": bson.M{"$gt": 0}}, bson.M{"$set": Query}, options.MergeUpdateOptions().SetUpsert(true)) //, new(options.UpdateOptions).SetUpsert(true)
|
||||
if err != nil {
|
||||
this.Errorf("Update Profit Many error: %v", err)
|
||||
}
|
||||
this.Debugf("sub time:%d", time.Now().Local().Sub(sTime).Milliseconds())
|
||||
return
|
||||
}()
|
||||
|
||||
return
|
||||
|
@ -79,6 +79,7 @@ func (this *CaravanRank) Start() (err error) {
|
||||
// 0 0 0 ? * MON // 每周一零点
|
||||
cron.AddFunc("0 0 0 ? * MON", this.TimerSeason)
|
||||
|
||||
this.TimerSeason()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -331,24 +331,23 @@ func (this *ModelUser) CleanUserMerchantmoney(session comm.IUserSession) (err er
|
||||
}
|
||||
if db.IsCross() {
|
||||
if model, err = this.module.GetDBModelByUid(uid, this.TableName); err == nil {
|
||||
if err := this.Get(uid, user); err != nil {
|
||||
if err := this.Get(uid, user); err == nil {
|
||||
err = model.Change(uid, update)
|
||||
} else {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
err = model.Change(uid, update)
|
||||
return
|
||||
} else {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if err := this.Get(uid, user); err != nil {
|
||||
if err := this.Get(uid, user); err == nil {
|
||||
err = this.Change(uid, update)
|
||||
} else {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
}
|
||||
err = this.Change(uid, update)
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
// 玩家信息监听
|
||||
|
Loading…
Reference in New Issue
Block a user