diff --git a/comm/imodule.go b/comm/imodule.go index 5506cd7a7..9fa563ae3 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -36,7 +36,7 @@ type ( QueryHeroAmount(uId string, heroCfgId string) (amount uint32) //创建指定数量 - CreateRepeatHero(session IUserSession, heroCfgId string, num int32, bPush bool) (code pb.ErrorCode) + CreateRepeatHero(session IUserSession, heroCfgId string, num int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode) // 批量创建英雄 CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (code pb.ErrorCode) // 获取英雄 diff --git a/modules/hero/api_fusion.go b/modules/hero/api_fusion.go index a4b97cd09..718ae94df 100644 --- a/modules/hero/api_fusion.go +++ b/modules/hero/api_fusion.go @@ -72,8 +72,7 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c } // 获得新卡 - newHero, err := this.module.modelHero.createHeroOverlying(session.GetUserId(), conf.Hero, 1) - if err == nil { + if newHero, err := this.module.CreateRepeatHero(session, conf.Hero, 1, false); err == pb.ErrorCode_Success { ChangeList = append(ChangeList, newHero) session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: ChangeList}) } else { diff --git a/modules/hero/module.go b/modules/hero/module.go index c08ffa77a..2a64a6a3c 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -62,16 +62,22 @@ func (this *Hero) Start() (err error) { } //创建单个叠加英雄 -func (this *Hero) CreateRepeatHero(session comm.IUserSession, heroCfgId string, num int32, bPush bool) (code pb.ErrorCode) { +func (this *Hero) CreateRepeatHero(session comm.IUserSession, heroCfgId string, num int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode) { _hero, err := this.modelHero.createHeroOverlying(session.GetUserId(), heroCfgId, num) if err == nil { - go func(uid string, heroCfgId string) { // 携程处理 图鉴数据 if db.IsCross() { this.moduleFetter.SendRpcAddHero(session, heroCfgId) } else { this.moduleFetter.AddHeroFetterData(uid, heroCfgId) } + heroConf := this.modelHero.moduleHero.configure.GetHeroConfig(heroCfgId) + if heroConf == nil { + return + } + if heroConf.Handbook == -1 { // 不需要记录图鉴 + return + } if result, err1 := this.ModuleUser.GetUserExpand(uid); err1 == nil { initUpdate := map[string]interface{}{} sz := result.GetTujian() @@ -244,7 +250,7 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string] if num == 0 { // 数量为0 不做处理 continue } - if code = this.CreateRepeatHero(session, heroCfgId, num, bPush); code != pb.ErrorCode_Success { + if _, code = this.CreateRepeatHero(session, heroCfgId, num, bPush); code != pb.ErrorCode_Success { this.Errorf("create hero %s failed", heroCfgId) } }