diff --git a/modules/academy/api_receive.go b/modules/academy/api_receive.go index e35212c66..c58975e21 100644 --- a/modules/academy/api_receive.go +++ b/modules/academy/api_receive.go @@ -39,6 +39,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe return } if req.Report.Completetask == nil || len(req.Report.Completetask) != len(level.Task) { + code = pb.ErrorCode_AcademyTaskNoCompleteTask return } diff --git a/modules/academy/api_teachingreceive.go b/modules/academy/api_teachingreceive.go index c09be1f9f..2d851162d 100644 --- a/modules/academy/api_teachingreceive.go +++ b/modules/academy/api_teachingreceive.go @@ -39,6 +39,7 @@ func (this *apiComp) TeachingReceive(session comm.IUserSession, req *pb.AcademyT return } if req.Report.Completetask == nil || len(req.Report.Completetask) != len(level.Task) { + code = pb.ErrorCode_AcademyTaskNoCompleteTask return } if !info.Hero[req.HeroId] { diff --git a/modules/pagoda/api_ranklist.go b/modules/pagoda/api_ranklist.go index 3f6eb0b3b..4832ce907 100644 --- a/modules/pagoda/api_ranklist.go +++ b/modules/pagoda/api_ranklist.go @@ -35,7 +35,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListR pipe *pipe.RedisPipe = conn.Redis.RedisPipe(context.TODO()) ) if req.FloorId == 0 { - rd = pipe.ZRange("pagodaSeasonRank"+strconv.Itoa(int(req.FloorId)), 0, 50) + rd = pipe.ZRange("pagodaSeasonRank", 0, 50) } else { rd = pipe.ZRange("pagodaList"+strconv.Itoa(int(req.FloorId)), 0, 50) } diff --git a/modules/pagoda/comp_configure.go b/modules/pagoda/comp_configure.go index 91a426b12..287d43410 100644 --- a/modules/pagoda/comp_configure.go +++ b/modules/pagoda/comp_configure.go @@ -169,18 +169,15 @@ func (this *configureComp) GetPassCheckByID(id int32) *cfg.GamePassCheckData { } // 获取 -func (this *configureComp) GetPagodaSeasonReward() [][]int32 { - rank := make([][]int32, 0) +func (this *configureComp) GetPagodaSeasonReward() []*cfg.GamePagodaSeasonRewardData { + if v, err := this.GetConfigure(game_pagodaseasonreward); err == nil { var ( configure *cfg.GamePagodaSeasonReward ok bool ) if configure, ok = v.(*cfg.GamePagodaSeasonReward); ok { - for _, v := range configure.GetDataList() { - rank = append(rank, v.Ranking) - } - return rank + return configure.GetDataList() } } return nil diff --git a/modules/pagoda/model_rank.go b/modules/pagoda/model_rank.go index 676a46d80..b91d952a3 100644 --- a/modules/pagoda/model_rank.go +++ b/modules/pagoda/model_rank.go @@ -248,14 +248,19 @@ func (this *ModelRank) seasonSettlement() { if list == nil { return } + + rankReward := this.modulePagoda.configure.GetPagodaSeasonReward() + if rankReward == nil { + return + } if !db.IsCross() { if conn, err := db.Cross(); err == nil { var ( - pipe *pipe.RedisPipe = conn.Redis.RedisPipe(context.TODO()) - //Items []*pb.UserAssets + pipe *pipe.RedisPipe = conn.Redis.RedisPipe(context.TODO()) + Items []*pb.UserAssets ) - rd := pipe.ZRange("pagodaSeasonRank0", 0, 50) + rd := pipe.ZRange("pagodaSeasonRank", 0, 50) if _, err = pipe.Exec(); err != nil { this.modulePagoda.Errorln(err) @@ -263,20 +268,27 @@ func (this *ModelRank) seasonSettlement() { } uids := rd.Val() - if len(uids) > 0 { - //Items = make([]*pb.UserAssets, 0) //TO 排名配置 - // for i, v := range v.RankReward { - // Items[i] = &pb.UserAssets{ - // A: v.A, - // T: v.T, - // N: v.N, - // } - // } - //发邮件 - // this.modulePagoda.mail.SendNewMail(&pb.DBMailData{ - // CreateTime: uint64(configure.Now().Unix()), - // Items: Items, - // }, uids...) + for index, uid := range uids { + Items = make([]*pb.UserAssets, 0) //TO 排名配置 + for _, v := range rankReward { + if len(v.Ranking) != 2 { + continue + } + if index >= int(v.Ranking[0]) && index <= int(v.Ranking[1]) { + for _, v1 := range v.Reward { + Items = append(Items, &pb.UserAssets{ + A: v1.A, + T: v1.T, + N: v1.N, + }) + } + this.modulePagoda.mail.SendNewMail(&pb.DBMailData{ + CreateTime: uint64(configure.Now().Unix()), + Items: Items, + }, uid) + break + } + } } } } diff --git a/modules/pagoda/module.go b/modules/pagoda/module.go index 5a24f6001..122aa5d5c 100644 --- a/modules/pagoda/module.go +++ b/modules/pagoda/module.go @@ -24,7 +24,7 @@ type Pagoda struct { configure *configureComp battle comm.IBattle service base.IRPCXService - //mail comm.Imail + mail comm.Imail } func NewModule() core.IModule { @@ -73,11 +73,14 @@ func (this *Pagoda) Start() (err error) { if module, err = this.service.GetModule(comm.ModuleBattle); err != nil { return } - // if module, err = this.service.GetModule(comm.ModuleMail); err != nil { - // return - // } - //this.mail = module.(comm.Imail) + this.battle = module.(comm.IBattle) + + if module, err = this.service.GetModule(comm.ModuleMail); err != nil { + return + } + this.mail = module.(comm.Imail) + this.service.RegisterFunctionName(string(comm.Rpc_ModuleSeasonPagodaReward), this.Rpc_ModuleSeasonPagodaReward) return } diff --git a/modules/reddot/api_getall.go b/modules/reddot/api_getall.go index 482c86a9b..010bdb508 100644 --- a/modules/reddot/api_getall.go +++ b/modules/reddot/api_getall.go @@ -21,15 +21,15 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) if code = this.GetAllCheck(session, req); code != pb.ErrorCode_Success { return } - reddot[int32(comm.Reddot1)] = true - reddot[int32(comm.Reddot2)] = true - reddot[int32(comm.Reddot3)] = false - reddot[int32(comm.Reddot4)] = true - reddot[int32(comm.Reddot5)] = true - reddot[int32(comm.Reddot6)] = true - // for k, v := range this.module.martialhall.Reddot(session.GetUserId(), comm.Reddot1) { - // reddot[int32(k)] = v - // } + for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot1, comm.Reddot2, comm.Reddot3, comm.Reddot4) { + reddot[int32(k)] = v + } + for k, v := range this.module.mainline.Reddot(session.GetUserId(), comm.Reddot5) { + reddot[int32(k)] = v + } + for k, v := range this.module.pagoda.Reddot(session.GetUserId(), comm.Reddot6) { + reddot[int32(k)] = v + } session.SendMsg(string(this.module.GetType()), "getall", &pb.ReddotGetAllResp{Reddot: reddot}) return } diff --git a/modules/reddot/module.go b/modules/reddot/module.go index 32910a5d0..9d5334943 100644 --- a/modules/reddot/module.go +++ b/modules/reddot/module.go @@ -20,6 +20,8 @@ func NewModule() core.IModule { type Reddot struct { modules.ModuleBase service base.IRPCXService + mainline comm.IMainline + pagoda comm.IPagoda martialhall comm.IMartialhall api_comp *apiComp } @@ -38,6 +40,14 @@ func (this *Reddot) Init(service core.IService, module core.IModule, options cor func (this *Reddot) Start() (err error) { err = this.ModuleBase.Start() var module core.IModule + if module, err = this.service.GetModule(comm.ModuleMainline); err != nil { + return + } + this.mainline = module.(comm.IMainline) + if module, err = this.service.GetModule(comm.ModulePagoda); err != nil { + return + } + this.pagoda = module.(comm.IPagoda) if module, err = this.service.GetModule(comm.ModuleMartialhall); err != nil { return } diff --git a/modules/timer/module.go b/modules/timer/module.go index 56446e8b3..87cb43042 100644 --- a/modules/timer/module.go +++ b/modules/timer/module.go @@ -23,7 +23,7 @@ type Timer struct { cbase.ModuleBase options *Options service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口 - rank *PagodaRank + //rank *PagodaRank rank2 *VikingRank rank3 *HuntingRank chat *ChatComp //俩天系统定时任务 @@ -59,7 +59,7 @@ func (this *Timer) Start() (err error) { func (this *Timer) OnInstallComp() { this.ModuleBase.OnInstallComp() - this.rank = this.RegisterComp(new(PagodaRank)).(*PagodaRank) + //this.rank = this.RegisterComp(new(PagodaRank)).(*PagodaRank) this.rank2 = this.RegisterComp(new(VikingRank)).(*VikingRank) this.rank3 = this.RegisterComp(new(HuntingRank)).(*HuntingRank) this.chat = this.RegisterComp(new(ChatComp)).(*ChatComp) diff --git a/modules/timer/pagodarank.go b/modules/timer/pagodarank.go index 5c5d56eb8..0728f0992 100644 --- a/modules/timer/pagodarank.go +++ b/modules/timer/pagodarank.go @@ -8,7 +8,6 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/lego/core/cbase" - "go_dreamfactory/lego/sys/cron" "go_dreamfactory/lego/sys/log" "go.mongodb.org/mongo-driver/bson" @@ -34,11 +33,8 @@ func (this *PagodaRank) Init(service core.IService, module core.IModule, comp co func (this *PagodaRank) Start() (err error) { err = this.MCompModel.Start() - - cron.AddFunc("*/60 * * * * ?", this.TimerPagoda) //每60s执行一次 - - cron.AddFunc("*/60 * * * * ?", this.TimerSeason) //每60s执行一次 - + //cron.AddFunc("*/60 * * * * ?", this.TimerPagoda) //每60s执行一次 + //cron.AddFunc("*/60 * * * * ?", this.TimerSeason) //每60s执行一次 return } diff --git a/modules/timer/season.go b/modules/timer/season.go index 955be891f..21613d2a3 100644 --- a/modules/timer/season.go +++ b/modules/timer/season.go @@ -9,6 +9,7 @@ import ( "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/sys/db" + "time" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" @@ -53,11 +54,36 @@ func (this *SeasonPagoda) Init(service core.IService, module core.IModule, comp func (this *SeasonPagoda) Start() (err error) { err = this.MCompModel.Start() err = this.MCompConfigure.Start() + configure.RegisterConfigure(game_seasonloop, cfg.NewGameSeasonLoop, nil) configure.RegisterConfigure(game_seasonreward, cfg.NewGamePagodaSeasonReward, nil) cron.AddFunc("0 0 23 L * ?", this.TimerSeasonOver) //每月最后一天23点执行一次 cron.AddFunc("0 0 5 /* * ?", this.TimerSeasonStar) //每月第一天5点执行一次 + conn, err := db.Cross() + if err == nil { + model := db.NewDBModel(comm.TableServerData, 0, conn) + + _len, err1 := model.DB.CountDocuments(comm.TableServerData, bson.M{}) + if err1 == nil && _len == 0 { + fmt.Printf("%v,%v", _len, err1) + server := &pb.DBServerData{ + Id: primitive.NewObjectID().Hex(), + ServerState: 1, + DisposableLoop: 1, + FixedLoop: 0, + SeasonType: 201, + OpenTime: time.Now().Unix(), + } + conf := this.GetSeasonLoop(comm.SeasonType) + if len(conf.DisposableLoop) > 0 { + server.SeasonType = conf.DisposableLoop[0] + } + + model.DB.InsertOne(comm.TableServerData, server) + } + } + return } func (this *SeasonPagoda) CreatTestData(index int) { diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 8d5c5e630..2b0799b5c 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -267,6 +267,8 @@ const ( ErrorCode_WorldtaskNoComplete ErrorCode = 3804 //任务条件未完成 ErrorCode_WorldtaskFinihed ErrorCode = 3805 //任务已完成 ErrorCode_WorldtaskLastUnFinished ErrorCode = 3806 //上个任务未完成 + //academy + ErrorCode_AcademyTaskNoCompleteTask ErrorCode = 3901 //未完成任务 ) // Enum value maps for ErrorCode. @@ -489,6 +491,7 @@ var ( 3804: "WorldtaskNoComplete", 3805: "WorldtaskFinihed", 3806: "WorldtaskLastUnFinished", + 3901: "AcademyTaskNoCompleteTask", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -708,6 +711,7 @@ var ( "WorldtaskNoComplete": 3804, "WorldtaskFinihed": 3805, "WorldtaskLastUnFinished": 3806, + "AcademyTaskNoCompleteTask": 3901, } ) @@ -742,7 +746,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xd1, 0x26, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xf1, 0x26, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -1051,7 +1055,9 @@ var file_errorcode_proto_rawDesc = []byte{ 0x12, 0x15, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x68, 0x65, 0x64, 0x10, 0xdd, 0x1d, 0x12, 0x1c, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, - 0x65, 0x64, 0x10, 0xde, 0x1d, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x65, 0x64, 0x10, 0xde, 0x1d, 0x12, 0x1e, 0x0a, 0x19, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, + 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, + 0x73, 0x6b, 0x10, 0xbd, 0x1e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, }