From 232a0fc1e50d22463ed5c85afbec041aab1a5989 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 19 Oct 2022 19:39:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=B0=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gm/module.go | 1 + modules/hero/api_fusion.go | 2 +- modules/timer/season.go | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 modules/timer/season.go diff --git a/modules/gm/module.go b/modules/gm/module.go index f4b6d5ccf..24e28774a 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -65,6 +65,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC keys := strings.Split(cmd, ":") if len(keys) == 2 { if keys[0] == "bingo" { + this.Debugf("create CMD :%s", cmd) // 打印个日志方便查询 datas := strings.Split(keys[1], ",") if len(datas) == 3 && (datas[0] == comm.AttrType || datas[0] == comm.ItemType || datas[0] == comm.HeroType || datas[0] == comm.EquipmentType) { diff --git a/modules/hero/api_fusion.go b/modules/hero/api_fusion.go index 15ab7b8d8..ab464843f 100644 --- a/modules/hero/api_fusion.go +++ b/modules/hero/api_fusion.go @@ -50,7 +50,7 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c _costMaphero[k] = _obj } for _, v := range conf.Pointhero { - if _, ok := mapHero[v]; !ok { + if _, ok := mapHero[v]; ok { mapHero[v] -= 1 } else { code = pb.ErrorCode_ReqParameterError diff --git a/modules/timer/season.go b/modules/timer/season.go new file mode 100644 index 000000000..bec57add1 --- /dev/null +++ b/modules/timer/season.go @@ -0,0 +1,34 @@ +package timer + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/modules" + + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/cron" +) + +type SeasonPagoda struct { + modules.MCompModel + service core.IService + dbName string +} + +//组件初始化接口 +func (this *SeasonPagoda) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.TableName = comm.TableSeasonPagoda + this.MCompModel.Init(service, module, comp, options) + this.service = service + return +} + +func (this *SeasonPagoda) Start() (err error) { + err = this.MCompModel.Start() + cron.AddFunc("0 0 23 L * ?", this.Timer) //每月最后一天23点执行一次 + return +} + +// 处理排行榜排序 +func (this *SeasonPagoda) Timer() { + +} From c247137d7e9fedcc05cd010829322c3b91e13894 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 19 Oct 2022 19:43:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index 0c29cb2c9..d6304dae5 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -344,19 +344,33 @@ func (this *Hero) CreateMonster(heroCid string, star, lv int32) (hero *pb.DBHero // 只通过唯一id 查询英雄信息 func (this *Hero) QueryCrossHeroinfo(oid string) (hero *pb.DBHero, err error) { - for _, tag := range db.GetServerTags() { - conn, err1 := db.ServerDBConn(tag) // 遍历连接对象 - if err1 != nil { - continue + + if this.modelHero.moduleHero.IsCross() { + for _, tag := range db.GetServerTags() { + conn, err1 := db.ServerDBConn(tag) // 遍历连接对象 + if err1 != nil { + continue + } + + sr := conn.Mgo.FindOne(comm.TableHero, bson.M{ + "_id": oid, + }) + hero = &pb.DBHero{} + if err = sr.Decode(hero); err != nil { + if err != mongo.ErrNoDocuments { + return + } + } } - filter := bson.M{ + } else { // 不是跨服就查本服 + if res := this.modelHero.DB.FindOne(comm.TableHero, bson.M{ "_id": oid, - } - sr := conn.Mgo.FindOne(comm.TableHero, filter) - hero = &pb.DBHero{} - if err = sr.Decode(hero); err != nil { - if err != mongo.ErrNoDocuments { - return + }); res == nil { + hero = &pb.DBHero{} + if err = res.Decode(hero); err != nil { + if err != mongo.ErrNoDocuments { + return + } } } }