商队赛季数据
This commit is contained in:
parent
85004bc35b
commit
18778c8a5d
@ -220,10 +220,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 减少虚拟币
|
|
||||||
// caravan.Merchantmoney -= addScore
|
|
||||||
// update["merchantmoney"] = caravan.Merchantmoney
|
|
||||||
if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{{
|
if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{{
|
||||||
A: "attr",
|
A: "attr",
|
||||||
T: "merchantmoney",
|
T: "merchantmoney",
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
"math"
|
"math"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"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()},
|
log.Field{Key: "args", Value: args.String()},
|
||||||
)
|
)
|
||||||
go func() {
|
go func() {
|
||||||
sTime := time.Now()
|
|
||||||
var (
|
var (
|
||||||
rankIndex int32
|
rankIndex int32
|
||||||
stag string
|
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{})
|
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 := bson.M{}
|
||||||
Query["merchantmoney"] = 0
|
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)
|
Query["profit"] = 0
|
||||||
if err != nil {
|
|
||||||
|
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)
|
this.Errorf("Update Merchantmoney Many error: %v", err)
|
||||||
}
|
}
|
||||||
Query = bson.M{}
|
return
|
||||||
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 // 每周一零点
|
// 0 0 0 ? * MON // 每周一零点
|
||||||
cron.AddFunc("0 0 0 ? * MON", this.TimerSeason)
|
cron.AddFunc("0 0 0 ? * MON", this.TimerSeason)
|
||||||
|
|
||||||
|
this.TimerSeason()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,24 +331,23 @@ func (this *ModelUser) CleanUserMerchantmoney(session comm.IUserSession) (err er
|
|||||||
}
|
}
|
||||||
if db.IsCross() {
|
if db.IsCross() {
|
||||||
if model, err = this.module.GetDBModelByUid(uid, this.TableName); err == nil {
|
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)
|
this.module.Errorf("err:%v", err)
|
||||||
}
|
}
|
||||||
err = model.Change(uid, update)
|
|
||||||
return
|
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
} else {
|
} 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)
|
this.module.Errorf("err:%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = this.Change(uid, update)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 玩家信息监听
|
// 玩家信息监听
|
||||||
|
Loading…
Reference in New Issue
Block a user