diff --git a/comm/imodule.go b/comm/imodule.go index 75088af9f..5556c1668 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -175,7 +175,7 @@ type ( ModifyHeroFetterData(uid string, obj string, data map[string]interface{}) (code pb.ErrorCode) // 修改羁绊信息 QueryHeroFetter(uid string) (data []*pb.DBHeroFetter) // 查询所有的羁绊信息 //QueryOneHeroFetter(uid string, cid string) *pb.DBHeroFetter // 通过英雄配置id 查询羁绊信息 - AddHeroFetterData(session IUserSession, heroConfId string) (code pb.ErrorCode) // 创建一条羁绊信息 + AddHeroFetterData(session IUserSession, heroConfId ...string) (code pb.ErrorCode) // 创建一条羁绊信息 } //月子秘境 IMoonFantasy interface { diff --git a/modules/hero/module.go b/modules/hero/module.go index 7059d88ae..61124c448 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -238,59 +238,17 @@ func (this *Hero) EventUserOffline(session comm.IUserSession) { // 批量创建多个英雄 func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]int32, bPush bool) (code pb.ErrorCode) { - changeHero := make([]*pb.DBHero, 0) for heroCfgId, num := range heros { if num == 0 { // 数量为0 不做处理 continue } - hero, err := this.modelHero.createHeroOverlying(session.GetUserId(), heroCfgId, num) - if err != nil { - code = pb.ErrorCode_HeroCreate - continue - } - changeHero = append(changeHero, hero) - // 查品质 - cfg := this.configure.GetHeroConfig(heroCfgId) - if cfg != nil { - - this.ModuleRtask.SendToRtask(session, comm.Rtype30, 1, cfg.Color) - this.ModuleRtask.SendToRtask(session, comm.Rtype31, 1, cfg.Color) + if code = this.CreateRepeatHero(session, heroCfgId, num, bPush); code != pb.ErrorCode_Success { + this.Errorf("create hero %s failed", heroCfgId) } } - for k := range heros { - this.moduleFetter.AddHeroFetterData(session, k) - } - // 添加图鉴 - go func(uid string, heros map[string]int32) { // 携程处理 图鉴数据 - if result, err1 := this.ModuleUser.GetUserExpand(uid); err1 == nil { - initUpdate := map[string]interface{}{} - sz := result.GetTujian() - if len(sz) == 0 { - sz = make(map[string]int32, 0) - } - for k := range heros { - - if _, ok := result.GetTujian()[k]; !ok { - sz[k] = 0 - initUpdate["tujian"] = sz - } - } - if len(initUpdate) != 0 { - this.ModuleUser.ChangeUserExpand(uid, initUpdate) - } - } - }(session.GetUserId(), heros) - for k := range heros { // 任务统计 - this.ModuleRtask.SendToRtask(session, comm.Rtype1, utils.ToInt32(k)) - - } - - if bPush && len(changeHero) > 0 { //推送 - session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeHero}) - } - return } + func (this *Hero) AddHeroExp(session comm.IUserSession, heroObjID string, exp int32) (code pb.ErrorCode) { var ( _hero *pb.DBHero diff --git a/modules/library/module.go b/modules/library/module.go index 83fb10b23..45688acce 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -175,7 +175,8 @@ func (this *Library) AddHeroFetterData(session comm.IUserSession, heroConfId str } rsp.Data = append(rsp.Data, obj) } - session.SendMsg(string(this.GetType()), LibraryChangePush, rsp) + this.SendMsgToUser(string(this.GetType()), LibraryChangePush, rsp, uid) + //session.SendMsg(string(this.GetType()), LibraryChangePush, rsp) } }