diff --git a/modules/parkour/model_parkour.go b/modules/parkour/model_parkour.go index ab041a74b..dafd2415a 100644 --- a/modules/parkour/model_parkour.go +++ b/modules/parkour/model_parkour.go @@ -11,6 +11,7 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" + "go_dreamfactory/sys/db" "math/rand" "sync" "time" @@ -155,8 +156,14 @@ func (this *ModelParkourComp) refreshlist() { } func (this *ModelParkourComp) queryinfo(uid string) (result *pb.DBParkour, err error) { + var ( + model *db.DBModel + ) result = &pb.DBParkour{} - if err = this.Get(uid, result); err != nil && err != mgo.MongodbNil { + if model, err = this.module.GetCrossDBModel(this.TableName); err != nil { + return + } + if err = model.Get(uid, result); err != nil && err != mgo.MongodbNil { this.module.Errorln(err) return } @@ -175,7 +182,7 @@ func (this *ModelParkourComp) queryinfo(uid string) (result *pb.DBParkour, err e Property: make(map[string]int32), Weekreward: make(map[int32]bool), } - if err = this.Add(uid, result); err != nil { + if err = model.Add(uid, result); err != nil { this.module.Errorln(err) return } diff --git a/modules/parkour/module.go b/modules/parkour/module.go index fb3164d67..224c93e8f 100644 --- a/modules/parkour/module.go +++ b/modules/parkour/module.go @@ -8,6 +8,7 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/event" "go_dreamfactory/lego/sys/log" + "go_dreamfactory/lego/sys/mgo" "go_dreamfactory/lego/sys/timewheel" "go_dreamfactory/modules" "go_dreamfactory/pb" @@ -835,3 +836,57 @@ func (this *Parkour) resurrectiontimer(task *timewheel.Task, args ...interface{} this.Error("战斗结束 复活失效", log.Field{Key: "bid", Value: battleid}) } } + +// 红点需求 +func (this *Parkour) Reddot(session comm.IUserSession, rid map[comm.ReddotType]struct{}) (items map[comm.ReddotType]*pb.ReddotItem) { + var ( + selfrid []comm.ReddotType = []comm.ReddotType{comm.Reddot38102} + confs []*cfg.GameDragonWeeklyrewardData + info *pb.DBParkour + 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.getGameDragonWeeklyrewards(); err != nil { + + return + } + if info, err = this.parkourComp.queryinfo(session.GetUserId()); err != nil && err != mgo.MongodbNil { + return + } + + for _, v := range selfrid { + if _, ok = rid[v]; ok { + switch v { + case comm.Reddot38102: + + for _, v := range confs { + if ok = info.Weekreward[v.Id]; ok { + continue + } + + if info.Weekintegral < v.Point { + continue + } + items[comm.Reddot38102] = &pb.ReddotItem{ + Rid: int32(comm.Reddot38102), + Activated: true, + } + break + } + + break + } + } + } + return +} diff --git a/modules/warorder/module.go b/modules/warorder/module.go index 1daa2c2fb..f2724442a 100644 --- a/modules/warorder/module.go +++ b/modules/warorder/module.go @@ -215,6 +215,7 @@ func (this *Warorder) Reddot(session comm.IUserSession, rid map[comm.ReddotType] Rid: int32(comm.Reddot31104), Activated: true, } + break } if dwarorder.Vip > 0 { if dwarorder.Payprogress < v.Parameter { @@ -222,6 +223,7 @@ func (this *Warorder) Reddot(session comm.IUserSession, rid map[comm.ReddotType] Rid: int32(comm.Reddot31104), Activated: true, } + break } } }