根据配置表中数据来判断是否需要记录图鉴数据

This commit is contained in:
meixiongfeng 2022-11-18 10:32:29 +08:00
parent 48935873b0
commit 1f4cc5aa8c
3 changed files with 11 additions and 6 deletions

View File

@ -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)
// 获取英雄

View File

@ -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 {

View File

@ -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)
}
}