diff --git a/comm/const.go b/comm/const.go index fe88fce3a..e2d6bc8f7 100644 --- a/comm/const.go +++ b/comm/const.go @@ -323,7 +323,7 @@ const ( Reddot15 ReddotType = 10015 //装备----可附魔红点 前端处理 Reddot16 ReddotType = 10016 //装备----可洗炼红点 前端处理 Reddot17 ReddotType = 10017 //星座图----红点 - Reddot18 ReddotType = 10018 //英雄招募----红点 + Reddot18 ReddotType = 10018 //英雄招募----红点 // 前端处理 Reddot19 ReddotType = 10019 //竞技场----挑战红点 Reddot20 ReddotType = 10020 //丛林美食馆----可挂机红点 Reddot21 ReddotType = 10021 //丛林美食馆----可升级红点 diff --git a/comm/imodule.go b/comm/imodule.go index 6df78fa5c..1e45bf0e8 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -282,9 +282,14 @@ type ( // 任务完成通知 TaskFinishNotify(uid string, taskId, groupId int32) error } + //竞技场 IArena interface { ///红点 IReddot } + IGourmet interface { + ///红点 + IReddot + } ) diff --git a/modules/gourmet/module.go b/modules/gourmet/module.go index 6c6a1dffd..86418be02 100644 --- a/modules/gourmet/module.go +++ b/modules/gourmet/module.go @@ -48,3 +48,103 @@ func (this *Gourmet) ModifyGourmetData(uid string, data map[string]interface{}) } return } + +//红点查询 +func (this *Gourmet) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { + reddot = make(map[comm.ReddotType]bool) + for _, v := range rid { + switch v { + case comm.Reddot20: + reddot[comm.Reddot20] = this.CheckPoint20(session.GetUserId()) + break + case comm.Reddot21: + reddot[comm.Reddot21] = this.CheckPoint21(session.GetUserId()) + break + case comm.Reddot22: + reddot[comm.Reddot22] = this.CheckPoint22(session.GetUserId()) + break + } + } + + return +} +func (this *Gourmet) CheckPoint20(uid string) bool { + + cfgCom := this.configure.GetGlobalConf() // 获取总的下单时长 + if cfgCom == nil { + return false + } + _gourmet, err := this.modelGourmet.getGourmetList(uid) + if err != nil { + return false + } + if cfgCom.Gourmet < _gourmet.OrderCostTime { // 大于总时长是不允许的 + return false + } + return true +} + +func (this *Gourmet) CheckPoint21(uid string) bool { + + _gourmet, err := this.modelGourmet.getGourmetList(uid) + if err != nil { + + return false + } + for skillType := range _gourmet.Skill { + skilllv, _ := _gourmet.Skill[skillType] + if this.configure.GetGourmetConfigData(skillType, skillType+1) == nil { // 下一级是否存在 + + return false + } + _skillCfg := this.configure.GetGourmetConfigData(skillType, skilllv) // 获取技能配置 + for _, v := range _skillCfg.SkillConsume { + if v.A == comm.AttrType { //用户属性资源 + if amount := this.ModuleUser.QueryAttributeValue(uid, v.T); amount < int64(v.N) { + + return false + } + } else if v.A == comm.ItemType { //道具资源 + if amount := this.ModuleItems.QueryItemAmount(uid, v.T); amount < uint32(v.N) { + + return false + } + } + } + } + // 特殊技能判断 + for skillType := range _gourmet.SpecialSkill { + skilllv, _ := _gourmet.Skill[skillType] + if this.configure.GetGourmetConfigData(skillType, skillType+1) == nil { // 下一级是否存在 + + return false + } + _skillCfg := this.configure.GetGourmetConfigData(skillType, skilllv) // 获取技能配置 + for _, v := range _skillCfg.SkillConsume { + if v.A == comm.AttrType { //用户属性资源 + if amount := this.ModuleUser.QueryAttributeValue(uid, v.T); amount < int64(v.N) { + + return false + } + } else if v.A == comm.ItemType { //道具资源 + if amount := this.ModuleItems.QueryItemAmount(uid, v.T); amount < uint32(v.N) { + + return false + } + } + } + } + return true +} + +func (this *Gourmet) CheckPoint22(uid string) bool { + _gourmet, err := this.modelGourmet.getGourmetList(uid) + if err != nil { + + return false + } + if len(_gourmet.Items) > 0 { // 有可领取的 直接返回 + return true + } + return false +} diff --git a/modules/pagoda/module.go b/modules/pagoda/module.go index 325595916..aafff4eda 100644 --- a/modules/pagoda/module.go +++ b/modules/pagoda/module.go @@ -152,12 +152,22 @@ func (this *Pagoda) SetPagodaRankList(tableName string, score int32, uid string) //红点查询 func (this *Pagoda) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { reddot = make(map[comm.ReddotType]bool) + for _, v := range rid { + switch v { + case comm.Reddot6: + reddot[comm.Reddot6] = this.CheckPoint6(session.GetUserId()) + break + case comm.Reddot7: + reddot[comm.Reddot7] = this.CheckPoint7(session.GetUserId()) + break + } + } return } // 红点检测 -func (this *Pagoda) CheckPoint(uid string) bool { +func (this *Pagoda) CheckPoint6(uid string) bool { list, err := this.modelPagoda.getPagodaList(uid) if err != nil { return false @@ -178,7 +188,26 @@ func (this *Pagoda) CheckPoint(uid string) bool { } return true } + func (this *Pagoda) Rpc_ModuleSeasonPagodaReward(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) { this.Debug("Rpc_ModuleSeasonPagodaReward", log.Fields{"args": args.String()}) this.modulerank.seasonSettlement() } + +func (this *Pagoda) CheckPoint7(uid string) bool { + list, _ := this.modelPagoda.getPagodaList(uid) + if list.Id == "" { // 普通塔 + return false + } + if len(list.Reward) > 0 { + return true + } + season, _ := this.modelSeasonPagoda.getSeasonPagodaList(uid) + if season.Id == "" { // 普通塔 + return false + } + if len(season.Reward) > 0 { + return true + } + return true +}