diff --git a/modules/battle/modelBattle.go b/modules/battle/modelBattle.go index b5b5c165b..fae41d389 100644 --- a/modules/battle/modelBattle.go +++ b/modules/battle/modelBattle.go @@ -117,7 +117,7 @@ func (this *modelBattleComp) createpve(session comm.IUserSession, conn *db.DBCon } else { record.Buleflist[i] = &pb.DBBattleFormt{ Leadpos: mf.CaptainId, - Team: make([]*pb.BattleRole, len(req.Mformat)), + Team: make([]*pb.BattleRole, len(mf.MonsterList)), } for i1, v1 := range mf.MonsterList { if v1 == -1 { diff --git a/modules/timer/season.go b/modules/timer/season.go index 782e6951a..71e685ab8 100644 --- a/modules/timer/season.go +++ b/modules/timer/season.go @@ -16,6 +16,8 @@ import ( "go_dreamfactory/lego/sys/log" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo/options" ) var ( @@ -49,10 +51,25 @@ func (this *SeasonPagoda) Start() (err error) { // _data := this.GetSeasonLoop(2) // this.module.Debugf("%v", _data) - + // for i := 0; i < 10000; i++ { + // this.CreatTestData(i) + // } this.TimerSeasonOver() return } +func (this *SeasonPagoda) CreatTestData(index int) { + seasonPagoda := &pb.DBSeasonPagoda{} + seasonPagoda.Id = primitive.NewObjectID().Hex() + + seasonPagoda.Uid = "dfmxf_634f8f28609d489230fb40fa" + seasonPagoda.PagodaId = int32(index) // 初始数据0层 + seasonPagoda.Type = 201 // TODO 新的塔数据根据配置文件获取 + if err := this.Add(seasonPagoda.Uid, seasonPagoda); err != nil { + this.module.Errorf("err:%v", err) + return + } +} + func (this *SeasonPagoda) GetSeasonLoop(id int32) *cfg.GameSeasonLoopData { if v, err := this.GetConfigure(game_seasonloop); err != nil { @@ -101,6 +118,13 @@ func (this *SeasonPagoda) TimerSeasonOver() { this.DB.UpdateOne(comm.TableServerData, bson.M{}, serverData) } + + //star := time.Now() + this.DB.DeleteMany(comm.TableSeasonPagoda, bson.M{}, options.Delete()) + //this.module.Debugf("=====%d,", time.Since(star).Milliseconds()) + + //清除redis + } // 赛季塔开始