diff --git a/comm/const.go b/comm/const.go index 862541322..37521c297 100644 --- a/comm/const.go +++ b/comm/const.go @@ -744,6 +744,10 @@ const ( Reddot34101 ReddotType = 34101 //成就奖励可领取 //辉月 Reddot36101 ReddotType = 36101 //当有辉月等级可以升级时,触发辉月系统红点。 + //购物中心 + Reddot31101 ReddotType = 31101 //购物中心日周月礼包 + //如梦战令 + Reddot31104 ReddotType = 31104 //月梦战令待领取奖励 // 主线 Reddot24101 ReddotType = 24101 // 主线章节有奖励没领取 diff --git a/modules/pay/module.go b/modules/pay/module.go index 0c6418f4a..6e022fe63 100644 --- a/modules/pay/module.go +++ b/modules/pay/module.go @@ -258,3 +258,52 @@ func (this *Pay) ActivityOpenNotice(hdlist *pb.DBHuodong) { func (this *Pay) ActivityCloseNotice(hdlist *pb.DBHuodong) { } + +// 红点需求 +func (this *Pay) Reddot(session comm.IUserSession, rid map[comm.ReddotType]struct{}) (items map[comm.ReddotType]*pb.ReddotItem) { + var ( + selfrid []comm.ReddotType = []comm.ReddotType{comm.Reddot31101} + confs []*cfg.GamePayPackageData + info *pb.DBPayDaily + item *pb.PayDailyItem + err error + ok bool + ) + items = make(map[comm.ReddotType]*pb.ReddotItem) + for _, v := range selfrid { + if _, ok = rid[v]; ok { + break + } + } + + if !ok { + return + } + + if confs, err = this.configure.getPayPackageDatas(1); err != nil { + return + } + if info, err = this.modelDaily.queryUserDaily(session.GetUserId()); err != nil { + return + } + + for _, v := range selfrid { + if _, ok = rid[v]; ok { + switch v { + case comm.Reddot31101: + for _, v := range confs { + if v.Packagetype == "" && len(v.Costitem) == 0 { //免费 + if item, ok = info.Items[v.Id]; !ok || item.Buyunm == 0 { + items[comm.Reddot31101] = &pb.ReddotItem{ + Rid: int32(comm.Reddot31101), + Activated: true, + } + } + } + } + break + } + } + } + return +} diff --git a/modules/warorder/module.go b/modules/warorder/module.go index 3a634be37..1daa2c2fb 100644 --- a/modules/warorder/module.go +++ b/modules/warorder/module.go @@ -172,3 +172,63 @@ func (this *Warorder) ActivityCloseNotice(hdlist *pb.DBHuodong) { break } } + +// 红点需求 +func (this *Warorder) Reddot(session comm.IUserSession, rid map[comm.ReddotType]struct{}) (items map[comm.ReddotType]*pb.ReddotItem) { + var ( + selfrid []comm.ReddotType = []comm.ReddotType{comm.Reddot31104} + info *pb.DBWarorders + dwarorder *pb.DreamWarorder + confs []*cfg.GamePassCheckData + err error + ok bool + ) + items = make(map[comm.ReddotType]*pb.ReddotItem) + for _, v := range selfrid { + if _, ok = rid[v]; ok { + break + } + } + + if !ok { + return + } + + if info, err = this.model.getUserWarorders(session.GetUserId()); err != nil { + return + } + + for _, v := range selfrid { + if _, ok = rid[v]; ok { + switch v { + case comm.Reddot31104: + if dwarorder, ok = info.Dreamwarorder[4]; !ok { + break + } + if confs, err = this.configure.getorder(4); err != nil { + return + } + for _, v := range confs { + if v.Parameter <= dwarorder.Lv { + if dwarorder.Freeprogress < v.Parameter { + items[comm.Reddot31104] = &pb.ReddotItem{ + Rid: int32(comm.Reddot31104), + Activated: true, + } + } + if dwarorder.Vip > 0 { + if dwarorder.Payprogress < v.Parameter { + items[comm.Reddot31104] = &pb.ReddotItem{ + Rid: int32(comm.Reddot31104), + Activated: true, + } + } + } + } + } + break + } + } + } + return +}