This commit is contained in:
liwei 2023-07-11 15:14:41 +08:00
commit a878db2faf
3 changed files with 26 additions and 1 deletions

View File

@ -18,6 +18,7 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
var (
bChange bool
sesaon int32 // 循环塔id
)
list, err := this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId())
if err != nil {
@ -38,6 +39,20 @@ func (this *apiComp) GetRace(session comm.IUserSession, req *pb.PagodaGetRaceReq
bChange = true
}
}
if k >= 10 {
sesaon = k
}
}
if sesaon == 0 {
list.Race[10] = &pb.RaceData{
Race: 10,
Task: []int32{},
Rtime: configure.Now().Unix(),
Defeat: 0,
Endtime: this.module.GetSeasonData(),
Curfloor: 0,
}
bChange = true
}
if bChange {
mapData := make(map[string]interface{}, 0)

View File

@ -30,7 +30,9 @@ func (this *ModelRace) Init(service core.IService, module core.IModule, comp cor
// 获取爬塔信息
func (this *ModelRace) getPagodaRaceList(uid string) (result *pb.DBPagodaRace, err error) {
result = &pb.DBPagodaRace{}
result = &pb.DBPagodaRace{
Race: map[int32]*pb.RaceData{},
}
if err = this.Get(uid, result); err != nil && err == mgo.MongodbNil { // 初始一条数据
result.Id = primitive.NewObjectID().Hex()
result.Uid = uid

View File

@ -10,6 +10,7 @@ import (
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/db"
"go_dreamfactory/utils"
"github.com/go-redis/redis/v8"
)
@ -196,3 +197,10 @@ func (this *Pagoda) CheckPagodaMaxFloor(uid string, pagodaType int32) int32 {
}
return 0
}
func (this *Pagoda) GetSeasonData() (endSeasonTime int64) {
_, endSeasonTime = utils.GetMonthStartEnd() //+ int64((6-d)*3600*24)
return endSeasonTime
}