diff --git a/modules/academy/api_receive.go b/modules/academy/api_receive.go index 3bf33484f..9e573c8be 100644 --- a/modules/academy/api_receive.go +++ b/modules/academy/api_receive.go @@ -66,7 +66,10 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe } this.module.DispenseRes(session, level.Award, true) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype151, 1)) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype151, 1)) + }) } session.SendMsg(string(this.module.GetType()), "receive", &pb.AcademyReceiveResp{Issucc: true}) return diff --git a/modules/arena/api_challengereward.go b/modules/arena/api_challengereward.go index d58b45ff4..5fd46ab2f 100644 --- a/modules/arena/api_challengereward.go +++ b/modules/arena/api_challengereward.go @@ -26,6 +26,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha bulestate pb.BattleRecordState err error iswin bool + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if errdata = this.ChallengeRewardCheck(session, req); errdata != nil { return @@ -288,8 +289,13 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha return } } - + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype128, red.Integral)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype129, red.Dan)) session.SendMsg(string(this.module.GetType()), "challengereward", &pb.ArenaChallengeRewardResp{Issucc: true, Integral: info.Integral, Dan: info.Dan}) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype128, red.Integral), comm.GetBuriedParam(comm.Rtype129, red.Dan)) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + return } diff --git a/modules/battle/module.go b/modules/battle/module.go index a2d472371..916d1992b 100644 --- a/modules/battle/module.go +++ b/modules/battle/module.go @@ -134,9 +134,10 @@ func (this *Battle) CreateEveBattle(session comm.IUserSession, req *pb.BattleEVE // 创建pve战斗 func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVEReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) { var ( - conf *cfg.GameBattleReadyData - conn *db.DBConn - err error + conf *cfg.GameBattleReadyData + conn *db.DBConn + err error + tasks []*pb.BuriedParam ) if !this.IsCross() { conn, err = db.Local() @@ -177,7 +178,7 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE for _, v := range req.Format.Friendformat { if v != "" { flag = true - go this.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype108, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype108, 1)) break } } @@ -186,8 +187,15 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE return } if flag { - go this.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype12, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype12, 1)) + } + if len(tasks) > 0 { + go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.ModuleBuried.TriggerBuried(session, tasks...) + }) + } + return } @@ -316,9 +324,10 @@ func (this *Battle) CreateRtPvpBattle(req *pb.BattleRTPVPReq) (errdata *pb.Error // 创建连续战斗 func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLPVEReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) { var ( - conf *cfg.GameBattleReadyData - conn *db.DBConn - err error + conf *cfg.GameBattleReadyData + conn *db.DBConn + err error + tasks []*pb.BuriedParam ) if !this.IsCross() { conn, err = db.Local() @@ -352,7 +361,7 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP if v != "" { flag = true // this.ModuleBuried.SendToRtask(session, comm.Rtype108, 1) - go this.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype108, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype108, 1)) break } } @@ -368,8 +377,16 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP return } if flag { - go this.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype12, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype12, 1)) + } + + if len(tasks) > 0 { + go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.ModuleBuried.TriggerBuried(session, tasks...) + }) + } + return } @@ -486,6 +503,7 @@ func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.Batt reply *pb.BattleCheckResults ctx context.Context err error + tasks []*pb.BuriedParam ) if report == nil { iswin = false @@ -514,8 +532,13 @@ func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.Batt } this.moonfantasy.Trigger(session, report) for _, v := range report.Completetask { - // this.ModuleBuried.SendToRtask(session, comm.Rtype157, int32(report.Info.Ptype), v) - go this.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype157, int32(report.Info.Ptype), v)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype157, int32(report.Info.Ptype), v)) + } + + if len(tasks) > 0 { + go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.ModuleBuried.TriggerBuried(session, tasks...) + }) } if (report.WinSide == 1 && report.Info.RedCompId == session.GetUserId()) || (report.WinSide == 2 && report.Info.BlueCompId == session.GetUserId()) { diff --git a/modules/buried/module.go b/modules/buried/module.go index 9f1ef9620..d66e44f31 100644 --- a/modules/buried/module.go +++ b/modules/buried/module.go @@ -557,8 +557,8 @@ func (this *Buried) TriggerBuried(session comm.IUserSession, burieds ...*pb.Buri } else { this.trigger(session, burieds...) } - session.Push() - this.service.PutUserSession(session) + // session.Push() + // this.service.PutUserSession(session) } func (this *Buried) trigger(session comm.IUserSession, burieds ...*pb.BuriedParam) { diff --git a/modules/caravan/api_buyorsell.go b/modules/caravan/api_buyorsell.go index 59c8cdfdf..4dbf5ecb5 100644 --- a/modules/caravan/api_buyorsell.go +++ b/modules/caravan/api_buyorsell.go @@ -230,7 +230,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe }) // 任务统计 - var szTask []*pb.BuriedParam + var tasks []*pb.BuriedParam if req.IsBuy { // 209购买指定城市的急需货物X个 @@ -238,7 +238,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe for _, v1 := range v.Exspecial { // 急需的货物 for k2, v2 := range req.Items { if k2 == v1 { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype209, v2, k)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype209, v2, k)) break } } @@ -247,11 +247,12 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe // szTask = append(szTask, comm.GetBuriedParam(comm.Rtype209, req.City, opCount)) } else { // 卖 //向指定X城市贩卖货物,贩卖货物价值需要X虚拟币以上 - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype210, req.City, sellValue)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype210, req.City, sellValue)) // Rtype211 TaskType = 211 // 向指定X城市,贩卖价值X虚拟币以上的对应城市急需货物 - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype211, req.City, sellSpValue)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype211, req.City, sellSpValue)) } - - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/caravan/api_gotocity.go b/modules/caravan/api_gotocity.go index df915b3e4..1486b5b87 100644 --- a/modules/caravan/api_gotocity.go +++ b/modules/caravan/api_gotocity.go @@ -128,8 +128,11 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity resp.Newtask = bNewTask session.SendMsg(string(this.module.GetType()), "gotocity", resp) // 任务统计 - var szTask []*pb.BuriedParam - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype212, req.City)) // 接取任务后,商队抵达指定城市 - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + var tasks []*pb.BuriedParam + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype212, req.City)) // 接取任务后,商队抵达指定城市 + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/chat/api_send.go b/modules/chat/api_send.go index d48b4ee53..54379ba9b 100644 --- a/modules/chat/api_send.go +++ b/modules/chat/api_send.go @@ -80,10 +80,11 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (errda if msg.Ctype == pb.ChatType_Text { //过滤敏感词 msg.Content = wordfilter.Replace(msg.Content, '*') } - go func(_session comm.IUserSession) { + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { this.module.modelChat.sendChatToWorld(msg, max_chat) - this.module.ModuleBuried.TriggerBuried(_session, comm.GetBuriedParam(comm.Rtype62, 1)) - }(session.Clone()) + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype62, 1)) + }) break case pb.ChatChannel_Union: if msg.Ctype == pb.ChatType_Text { //过滤敏感词 @@ -120,10 +121,10 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (errda return } msg.ChannelId = userexpand.Chatchannel //指定频道 - go func() { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { this.module.modelChat.sendChatToCrossServer(msg, max_chat) - this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype106, 1)) - }() + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype106, 1)) + }) break default: this.module.Errorf("不存在的聊天频道类型channel:%d ", req.Channel) diff --git a/modules/dispatch/api_do.go b/modules/dispatch/api_do.go index 9d9269c5a..218cd2de4 100644 --- a/modules/dispatch/api_do.go +++ b/modules/dispatch/api_do.go @@ -83,8 +83,6 @@ func (this *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (errda return } - rsp := &pb.DispatchDoResp{} - if err := this.module.modelDispatch.dispatch(session.GetUserId(), req.TaskId, req.HeroIds, d); err != nil { var errCustom = new(comm.CustomError) var code pb.ErrorCode @@ -106,12 +104,15 @@ func (this *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (errda return } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype186, 1)) - //扣除门票 this.module.ConsumeRes(session, []*cfg.Gameatn{ticketAtn}, true) - rsp.IsSucc = true - session.SendMsg(string(this.module.GetType()), "do", rsp) + session.SendMsg(string(this.module.GetType()), "do", &pb.DispatchDoResp{ + IsSucc: true, + }) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype186, 1)) + }) return } diff --git a/modules/equipment/api_ench.go b/modules/equipment/api_ench.go index 0738f3ac5..43f0e7935 100644 --- a/modules/equipment/api_ench.go +++ b/modules/equipment/api_ench.go @@ -111,8 +111,11 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) ( return } } - // this.module.ModuleRtask.SendToRtask(session, comm.Rtype94, 1) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype94, 1)) + session.SendMsg(string(this.module.GetType()), "ench", &pb.EquipmentEnchResp{Issucc: true, Equipment: equip}) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype94, 1)) + }) return } diff --git a/modules/equipment/api_equip.go b/modules/equipment/api_equip.go index 59d1c4e3d..5c01c6f94 100644 --- a/modules/equipment/api_equip.go +++ b/modules/equipment/api_equip.go @@ -213,10 +213,12 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype42, equipNum, minstar)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype5, equipNum, utils.ToInt32(hero.HeroID))) - if len(tasks) > 0 { - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) - } - session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment, Suits: suits}) + + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype95, 1)) + }) + } return } diff --git a/modules/equipment/api_upgrade.go b/modules/equipment/api_upgrade.go index 733bc0bd8..b12a43f1a 100644 --- a/modules/equipment/api_upgrade.go +++ b/modules/equipment/api_upgrade.go @@ -288,9 +288,13 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade tasks = append(tasks, comm.GetBuriedParam(comm.Rtype96, 1)) } tasks = append(tasks, comm.GetBuriedParam(comm.Rtype92, 1)) - if len(tasks) > 0 { - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) - } + session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments}) + + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype95, 1)) + }) + } return } diff --git a/modules/equipment/api_wash.go b/modules/equipment/api_wash.go index 937b9c4b9..4febc09f9 100644 --- a/modules/equipment/api_wash.go +++ b/modules/equipment/api_wash.go @@ -78,8 +78,11 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) ( break } } - // this.module.ModuleRtask.SendToRtask(session, comm.Rtype95, 1) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype95, 1)) + session.SendMsg(string(this.module.GetType()), "wash", &pb.EquipmentWashResp{Eid: req.Eid, AdverbEntry: adverbEntry}) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype95, 1)) + }) return } diff --git a/modules/equipment/modelEquipment.go b/modules/equipment/modelEquipment.go index 340d6730d..be1c88c31 100644 --- a/modules/equipment/modelEquipment.go +++ b/modules/equipment/modelEquipment.go @@ -137,7 +137,9 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma //异步出发任务启动 if len(tasks) > 0 { - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) } if len(add) > 0 { diff --git a/modules/equipment/module.go b/modules/equipment/module.go index 0ebab3198..cbc107045 100644 --- a/modules/equipment/module.go +++ b/modules/equipment/module.go @@ -266,8 +266,10 @@ func (this *Equipment) AddEquipment(session comm.IUserSession, equip *pb.DB_Equi } else if configure.Pos == 6 { tasks = append(tasks, comm.GetBuriedParam(comm.Rtype101, 1, configure.Color)) } - go this.ModuleBuried.TriggerBuried(session.Clone(), tasks...) this.equipmentsChangePush(session, []*pb.DB_Equipment{equip}) + go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/friend/api_cross_agree.go b/modules/friend/api_cross_agree.go index f7233150e..c22c3924b 100644 --- a/modules/friend/api_cross_agree.go +++ b/modules/friend/api_cross_agree.go @@ -171,15 +171,20 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (e go this.module.ModuleSys.CheckOpenCond(session.Clone(), comm.OpencondTypeFriend, int32(len(self.FriendIds))) // 拥有xx个好友 // this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype10, int32(len(agreeIds))) - var sz []*pb.BuriedParam + var tasks []*pb.BuriedParam for _, v := range req.FriendIds { - sz = append(sz, comm.GetBuriedParam2(comm.Rtype10, v)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype10, v)) } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), sz...) resp := &pb.FriendAgreeResp{ Num: optNum, } session.SendMsg(string(this.module.GetType()), FriendSubTypeAgree, resp) + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } + return } diff --git a/modules/friend/api_cross_assisthero.go b/modules/friend/api_cross_assisthero.go index baf35ddf2..0f27ea0ed 100644 --- a/modules/friend/api_cross_assisthero.go +++ b/modules/friend/api_cross_assisthero.go @@ -112,7 +112,8 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth } // 随机任务Rtype13 - // this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype13, 1) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype13, 1)) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype13, 1)) + }) return } diff --git a/modules/friend/api_cross_zan.go b/modules/friend/api_cross_zan.go index d27dbf2df..3e28733f5 100644 --- a/modules/friend/api_cross_zan.go +++ b/modules/friend/api_cross_zan.go @@ -131,7 +131,8 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (errda session.SendMsg(string(this.module.GetType()), FriendSubTypeZan, rsp) // 赠送X次友情点 - // this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype11, 1) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype11, 1)) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype11, 1)) + }) return } diff --git a/modules/gourmet/api_createfood.go b/modules/gourmet/api_createfood.go index 53a160aae..b402b7860 100644 --- a/modules/gourmet/api_createfood.go +++ b/modules/gourmet/api_createfood.go @@ -94,6 +94,8 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate Cid: curFood, FirstGet: bFirst, }) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype150, 1)) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype150, 1)) + }) return } diff --git a/modules/hero/api_awaken.go b/modules/hero/api_awaken.go index 468a610c6..e353f34ac 100644 --- a/modules/hero/api_awaken.go +++ b/modules/hero/api_awaken.go @@ -101,15 +101,15 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e } else { this.module.Errorf("no found userdata uid:%s", session.GetUserId()) } - var szTask []*pb.BuriedParam + var tasks []*pb.BuriedParam - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype34, _hero.HeroID, _hero.JuexingLv)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype34, _hero.HeroID, _hero.JuexingLv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype119, 1, utils.ToInt32(_hero.HeroID))) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype35, _hero.JuexingLv, utils.ToInt32(_hero.HeroID))) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype118, _hero.Lv, _hero.JuexingLv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype120, 1)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype122, _hero.JuexingLv, _hero.Star)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype119, 1, utils.ToInt32(_hero.HeroID))) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype35, _hero.JuexingLv, utils.ToInt32(_hero.HeroID))) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype118, _hero.Lv, _hero.JuexingLv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype120, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype122, _hero.JuexingLv, _hero.Star)) cfg, err := this.module.configure.GetHeroConfig(_hero.HeroID) if err == nil { @@ -127,13 +127,13 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e if this.module.configure.GetHeroTalentMaxLv(_hero.HeroID) == _l { bManAwaken = true } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype121, 1, cfg.Race)) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype36, _hero.HeroID, cfg.Color, cfg.Job, cfg.Race, _hero.JuexingLv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype121, 1, cfg.Race)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype36, _hero.HeroID, cfg.Color, cfg.Job, cfg.Race, _hero.JuexingLv)) _, err = this.module.configure.GetHeroAwakenConfig(_hero.HeroID, _hero.JuexingLv+1) if err != nil { // 达到满级觉醒 if _hero.Lv == this.module.configure.GetHeroMaxLv(_hero.Star) && bManAwaken { - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype38, _hero.HeroID)) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype37, _hero.HeroID, cfg.Color)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, _hero.HeroID)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, _hero.HeroID, cfg.Color)) } } @@ -145,6 +145,8 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e return } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/hero/api_strengthenUpSkill.go b/modules/hero/api_strengthenUpSkill.go index 5130b42de..9462e3079 100644 --- a/modules/hero/api_strengthenUpSkill.go +++ b/modules/hero/api_strengthenUpSkill.go @@ -128,9 +128,9 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt } // 推送 世界任务消息 - var szTask []*pb.BuriedParam - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype52, 1, utils.ToInt32(_hero.HeroID))) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype53, 1)) + var tasks []*pb.BuriedParam + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype52, 1, utils.ToInt32(_hero.HeroID))) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype53, 1)) // 检查是不是满级技能 maxLv := true @@ -142,17 +142,19 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt } } if maxLv { - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype54, _hero.HeroID)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype54, _hero.HeroID)) //szTask = append(szTask, comm.GetBuriedParam(comm.Rtype57, 1)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype174, 1, _hero.Star)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype174, 1, _hero.Star)) } if cfg, err := this.module.configure.GetHeroConfig(_hero.HeroID); err == nil { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype55, 1, cfg.Color)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype56, 1, 1, cfg.Job)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype116, lvUpCount, cfg.Race)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype55, 1, cfg.Color)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype56, 1, 1, cfg.Job)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype116, lvUpCount, cfg.Race)) } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype117, lvUpCount, utils.ToInt32(_hero.HeroID))) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype117, lvUpCount, utils.ToInt32(_hero.HeroID))) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/hero/api_strengthenUpStar.go b/modules/hero/api_strengthenUpStar.go index b3e2a3a9e..ce4737087 100644 --- a/modules/hero/api_strengthenUpStar.go +++ b/modules/hero/api_strengthenUpStar.go @@ -101,19 +101,21 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr } // 推送 世界任务消息 - var szTask []*pb.BuriedParam - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype6, _hero.Star, utils.ToInt32(_hero.HeroID))) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype25, _hero.HeroID, _hero.Star)) + var tasks []*pb.BuriedParam + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype6, _hero.Star, utils.ToInt32(_hero.HeroID))) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype25, _hero.HeroID, _hero.Star)) if _hero.Star == 4 { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype26, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype26, 1)) } else if _hero.Star == 5 { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype27, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype27, 1)) } else if _hero.Star == 6 { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype28, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype28, 1)) } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype114, _hero.Star, utils.ToInt32(_hero.HeroID))) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype115, 1, _hero.Star)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype114, _hero.Star, utils.ToInt32(_hero.HeroID))) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype115, 1, _hero.Star)) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/hero/api_talentlearn.go b/modules/hero/api_talentlearn.go index e1000da43..09648facc 100644 --- a/modules/hero/api_talentlearn.go +++ b/modules/hero/api_talentlearn.go @@ -188,35 +188,37 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe // 查询英雄相关信息 if heroObj := this.module.QueryHeroByConfId(session.GetUserId(), talent.HeroId); heroObj != nil { - var szTask []*pb.BuriedParam - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype123, heroObj.HeroID, heroObj.Star)) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype124, heroObj.HeroID)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype123, 1, int32(len(talent.Talent)), heroObj.Star)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype124, 1)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype125, 1, utils.ToInt32(heroObj.HeroID))) + var tasks []*pb.BuriedParam + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype123, heroObj.HeroID, heroObj.Star)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype124, heroObj.HeroID)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype123, 1, int32(len(talent.Talent)), heroObj.Star)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype124, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype125, 1, utils.ToInt32(heroObj.HeroID))) cfg, err := this.module.configure.GetHeroConfig(heroObj.HeroID) if err == nil { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype126, 1, cfg.Race)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype126, 1, cfg.Race)) } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype127, 1, heroObj.Star)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype40, 1, int32(len(talent.Talent)))) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype127, 1, heroObj.Star)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype40, 1, int32(len(talent.Talent)))) _, err = this.module.configure.GetHeroAwakenConfig(heroObj.HeroID, heroObj.JuexingLv+1) if err != nil { // 达到满级觉醒 if heroObj.Lv == this.module.configure.GetHeroMaxLv(heroObj.Star) { if this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID) == int32(len(talent.Talent)) { - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype37, heroObj.HeroID, cfg.Color)) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype38, heroObj.HeroID)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, heroObj.HeroID, cfg.Color)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, heroObj.HeroID)) } } } // 满回响 if this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID) == int32(len(talent.Talent)) { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype128, 1, cfg.Race)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype128, 1, cfg.Race)) } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype199, 1)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype199, 1)) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) } return diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 8ae283eed..503143a70 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -478,120 +478,128 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex } _data := this.module.configure.GetHeroLv(curLv) - if _data != nil { - var maxExp int32 + if _data == nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + } + return + } + + var maxExp int32 + maxExp = _data.Heroexp + if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级 + curAddExp = 0 // 已经满级的时候 + //code = pb.ErrorCode_HeroMaxLv // + this.module.Debugf("英雄已经满级 不需要升级heroid:%s,addexp:%d", hero.Id, exp) + return + } + curExp += exp // 先把经验加上 + for { // 死循环判断一键升级 + if _data.Heroexp == 0 { + curAddExp = exp - (curExp - maxExp) // 减去超过部分的经验 + curExp = 0 + break + } maxExp = _data.Heroexp - if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级 - curAddExp = 0 // 已经满级的时候 - //code = pb.ErrorCode_HeroMaxLv // - this.module.Debugf("英雄已经满级 不需要升级heroid:%s,addexp:%d", hero.Id, exp) - return + if maxLv <= curLv && curExp >= maxExp { // 设置最大经验和等级 + curAddExp = exp - (curExp - maxExp) // 减去超过部分的经验 + curLv = maxLv + curExp = maxExp + break } - curExp += exp // 先把经验加上 - for { // 死循环判断一键升级 - if _data.Heroexp == 0 { - curAddExp = exp - (curExp - maxExp) // 减去超过部分的经验 - curExp = 0 + if maxExp > curExp { // 经验不够升级则不能执行升级操作 + break + } else { // 升级操作 + curExp -= maxExp + curLv += 1 // 经验够了 那么等级+1 + _data = this.module.configure.GetHeroLv(curLv) + if _data == nil { // 等级加失败了 回到原来的等级 + curLv -= 1 break } - maxExp = _data.Heroexp - if maxLv <= curLv && curExp >= maxExp { // 设置最大经验和等级 - curAddExp = exp - (curExp - maxExp) // 减去超过部分的经验 - curLv = maxLv - curExp = maxExp - break - } - if maxExp > curExp { // 经验不够升级则不能执行升级操作 - break - } else { // 升级操作 - curExp -= maxExp - curLv += 1 // 经验够了 那么等级+1 - _data = this.module.configure.GetHeroLv(curLv) - if _data == nil { // 等级加失败了 回到原来的等级 - curLv -= 1 - break - } + } + } + + if curAddExp != 0 { + curAddExp = exp // 真正加的经验 + } + + this.module.Debugf("add hero exp :old lv:%d,old exp:%d,new lv:%d,new exp:%d,addexp:%d", hero.Lv, hero.Exp, curLv, curExp, exp) + update["lv"] = curLv + update["exp"] = curExp + + hero.Lv = curLv + hero.Exp = curExp + if curLv-preLv > 0 { // 升级了 统计任务 + this.PropertyCompute(hero) + update["property"] = hero.Property + update["horoscopeProperty"] = hero.HoroscopeProperty + update["talentProperty"] = hero.TalentProperty + update["juexProperty"] = hero.JuexProperty + } + if model != nil { + if err := model.ChangeList(session.GetUserId(), hero.Id, update); err != nil { + this.module.Errorf("add hero exp failed ChangeList %v", err) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), } } - - if curAddExp != 0 { - curAddExp = exp // 真正加的经验 - } - - this.module.Debugf("add hero exp :old lv:%d,old exp:%d,new lv:%d,new exp:%d,addexp:%d", hero.Lv, hero.Exp, curLv, curExp, exp) - update["lv"] = curLv - update["exp"] = curExp - - hero.Lv = curLv - hero.Exp = curExp - if curLv-preLv > 0 { // 升级了 统计任务 - this.PropertyCompute(hero) - update["property"] = hero.Property - update["horoscopeProperty"] = hero.HoroscopeProperty - update["talentProperty"] = hero.TalentProperty - update["juexProperty"] = hero.JuexProperty - } - if model != nil { - if err := model.ChangeList(session.GetUserId(), hero.Id, update); err != nil { - this.module.Errorf("add hero exp failed ChangeList %v", err) - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), - } - } - } else { - if err := this.ChangeList(session.GetUserId(), hero.Id, update); err != nil { - this.module.Errorf("add hero exp failed ChangeList %v", err) - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), - } + } else { + if err := this.ChangeList(session.GetUserId(), hero.Id, update); err != nil { + this.module.Errorf("add hero exp failed ChangeList %v", err) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), } } + } - if curLv-preLv > 0 { // 升级了 统计任务 - var szTask []*pb.BuriedParam - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype113, curLv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID))) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype24, curLv-preLv)) - // szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID))) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) - if cfg, _ := this.module.configure.GetHeroConfig(hero.HeroID); cfg != nil { - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype32, hero.HeroID, cfg.Color, hero.Lv)) - //xx英雄满级、共鸣、觉醒至最高状态 - nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1) - if nextAwaken == nil { // 达到满级觉醒 - if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) { - var _l int32 - talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId()) - if err == nil { - for _, v := range talent { - if v.HeroId == hero.HeroID { - _l = int32(len(v.Talent)) - break - } + if curLv-preLv > 0 { // 升级了 统计任务 + var tasks []*pb.BuriedParam + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype113, curLv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID))) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype24, curLv-preLv)) + // szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID))) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) + if cfg, _ := this.module.configure.GetHeroConfig(hero.HeroID); cfg != nil { + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype32, hero.HeroID, cfg.Color, hero.Lv)) + //xx英雄满级、共鸣、觉醒至最高状态 + nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1) + if nextAwaken == nil { // 达到满级觉醒 + if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) { + var _l int32 + talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId()) + if err == nil { + for _, v := range talent { + if v.HeroId == hero.HeroID { + _l = int32(len(v.Talent)) + break } } - if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l { - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, cfg.Color)) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID)) - } + } + if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l { + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, cfg.Color)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID)) } } } - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype111, hero.HeroID, hero.Lv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype112, 1, hero.Lv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype113, hero.Lv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype33, 1, 1, hero.Lv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype118, hero.Lv, hero.JuexingLv)) - go this.module.passon.HeroUpLv(session.Clone(), hero.HeroID, curLv) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) - } + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype111, hero.HeroID, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype112, 1, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype113, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype33, 1, 1, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype118, hero.Lv, hero.JuexingLv)) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.passon.HeroUpLv(session.Clone(), hero.HeroID, curLv) + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) } return } diff --git a/modules/hero/module.go b/modules/hero/module.go index 2e09c2866..13652dcfc 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -92,9 +92,9 @@ func (this *Hero) Start() (err error) { // 创建单个叠加英雄 func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, errdata *pb.ErrorData) { var ( - err error - szTask []*pb.BuriedParam - cfg *cfg.GameHeroData + err error + tasks []*pb.BuriedParam + cfg *cfg.GameHeroData ) if cfg, err = this.configure.GetHeroConfig(heroCfgId); err != nil { errdata = &pb.ErrorData{ @@ -106,7 +106,7 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, hero, bFirst, atno, err = this.modelHero.createHero(session, heroCfgId, num) if err == nil && bFirst { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype228, cfg.Star)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype228, cfg.Star)) return } if err != nil { @@ -116,10 +116,12 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, Message: err.Error(), } } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype1, 1, utils.ToInt32(heroCfgId))) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype30, heroCfgId, cfg.Color)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype31, num, cfg.Color)) - go this.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype1, 1, utils.ToInt32(heroCfgId))) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype30, heroCfgId, cfg.Color)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype31, num, cfg.Color)) + go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.ModuleBuried.TriggerBuried(session, tasks...) + }) return } @@ -659,7 +661,7 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCount int32, drawtype int32) { // 任务统计 var ( - szTask []*pb.BuriedParam + tasks []*pb.BuriedParam ) if drawtype == comm.DrawCardType0 { //普通招募 @@ -669,33 +671,35 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou sz[star]++ } for k := range sz { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype17, 1, k)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype17, 1, k)) } } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype14, drawCount)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype18, drawCount)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype141, drawCount)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype143, drawCount)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype145, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype14, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype18, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype141, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype143, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype145, drawCount)) } else { // 阵营招募 - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype15, drawCount)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype19, drawCount)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype142, drawCount)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype144, drawCount)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype146, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype15, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype19, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype142, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype144, drawCount)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype146, drawCount)) if drawCount == 10 { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype91, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype91, 1)) } } for _, star := range szStar { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype16, star, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype16, star, 1)) } if drawCount == 10 { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype90, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype90, 1)) } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype89, drawCount)) - go this.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype89, drawCount)) + go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.ModuleBuried.TriggerBuried(session, tasks...) + }) } func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string, fulllvenr int32) (errdata *pb.ErrorData) { diff --git a/modules/horoscope/api_upgrade.go b/modules/horoscope/api_upgrade.go index 3127dd1db..b88c7ff87 100644 --- a/modules/horoscope/api_upgrade.go +++ b/modules/horoscope/api_upgrade.go @@ -20,6 +20,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade front *cfg.GameHoroscopeData ok bool err error + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if errdata = this.UpgradeCheck(session, req); errdata != nil { return @@ -72,7 +73,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade } info.Nodes[conf.NodeId] = conf.Lv + 1 if info.Nodes[conf.NodeId] == 1 { //解锁 - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype173, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype173, 1)) } for _, v := range conf.CostItem { @@ -102,5 +103,11 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade } session.SendMsg(string(this.module.GetType()), "upgrade", &pb.HoroscopeUpgradeResp{Nid: conf.NodeId, Lv: conf.Lv + 1}) + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } + return } diff --git a/modules/hunting/api_challengeover.go b/modules/hunting/api_challengeover.go index 951041cf4..959b8adc4 100644 --- a/modules/hunting/api_challengeover.go +++ b/modules/hunting/api_challengeover.go @@ -200,6 +200,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha tasks = append(tasks, comm.GetBuriedParam(comm.Rtype83, 1, req.BossType, req.Difficulty)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype202, consumPs)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype200, 1)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/items/module.go b/modules/items/module.go index a19c31289..9c0ba1866 100644 --- a/modules/items/module.go +++ b/modules/items/module.go @@ -234,7 +234,9 @@ func (this *Items) AddItems(session comm.IUserSession, items map[string]int32, b } } if len(tasks) > 0 { - go this.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.ModuleBuried.TriggerBuried(session, tasks...) + }) } return } diff --git a/modules/library/api_usegift.go b/modules/library/api_usegift.go index 08f796c62..c5c098f98 100644 --- a/modules/library/api_usegift.go +++ b/modules/library/api_usegift.go @@ -30,6 +30,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe likeStates int32 // 0 普通食物 1 喜欢 2 不喜欢 addExp int32 // 获得的经验 sCount int32 // 赠送开始次数 + tasks []*pb.BuriedParam ) attenuation = make(map[int32]int32, 0) if errdata = this.UseGiftCheck(session, req); errdata != nil { @@ -190,12 +191,15 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe return } } - var szTask []*pb.BuriedParam - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype132, 1, _heroObj.Favorlv)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype133, _heroObj.Favorlv, utils.ToInt32(_heroObj.Heroid))) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype134, upLv)) - szTask = append(szTask, comm.GetBuriedParam2(comm.Rtype132, _heroObj.Heroid, _heroObj.Favorlv)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype132, 1, _heroObj.Favorlv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype133, _heroObj.Favorlv, utils.ToInt32(_heroObj.Heroid))) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype134, upLv)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype132, _heroObj.Heroid, _heroObj.Favorlv)) + } + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) } return diff --git a/modules/mainline/api_challengeover.go b/modules/mainline/api_challengeover.go index 5942e6a77..0a4d23900 100644 --- a/modules/mainline/api_challengeover.go +++ b/modules/mainline/api_challengeover.go @@ -180,7 +180,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh tasks = append(tasks, comm.GetBuriedParam(comm.Rtype60, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype61, 1, int32(req.Level))) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) - go this.module.ModuleSys.CheckOpenCond(session.Clone(), comm.OpencondTypeMaxmapid, req.Level) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + this.module.ModuleSys.CheckOpenCond(session, comm.OpencondTypeMaxmapid, req.Level) + }) return } diff --git a/modules/mainline/api_levelpass.go b/modules/mainline/api_levelpass.go index afef3a4e3..724dad07d 100644 --- a/modules/mainline/api_levelpass.go +++ b/modules/mainline/api_levelpass.go @@ -132,6 +132,9 @@ func (this *apiComp) LevelPass(session comm.IUserSession, req *pb.MainlineLevelP tasks = append(tasks, comm.GetBuriedParam(comm.Rtype60, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype61, 1, int32(req.Level))) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/mline/api_challengeover.go b/modules/mline/api_challengeover.go index 440778e4a..941b3e970 100644 --- a/modules/mline/api_challengeover.go +++ b/modules/mline/api_challengeover.go @@ -256,8 +256,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall } } } - // this.module.ModuleRtask.SendToRtask(session, comm.Rtype160, allStar) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype160, allStar, stageConf.Chapterid)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/modulebase.go b/modules/modulebase.go index 625662d02..9fb693171 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -851,3 +851,10 @@ func (this *ModuleBase) FormatRes(res []*cfg.Gameatn) (ret []*cfg.Gameatn) { } return } + +//异步调用用户处理流 +func (this *ModuleBase) AsynHandleSession(session comm.IUserSession, handle func(session comm.IUserSession)) { + handle(session) + session.Push() + this.PutUserSession(session) +} diff --git a/modules/moonfantasy/api_battle.go b/modules/moonfantasy/api_battle.go index 216579e43..b0181c639 100644 --- a/modules/moonfantasy/api_battle.go +++ b/modules/moonfantasy/api_battle.go @@ -133,6 +133,8 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle Tasks: record.Tasks, }, }) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype88, 1)) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype88, 1)) + }) return } diff --git a/modules/moonfantasy/modelDream.go b/modules/moonfantasy/modelDream.go index 8fe06f136..8ef7db52b 100644 --- a/modules/moonfantasy/modelDream.go +++ b/modules/moonfantasy/modelDream.go @@ -135,7 +135,9 @@ func (this *modelDreamComp) trigger(session comm.IUserSession) { this.module.modelDream.noticeuserfriend(session, mdata.Id, chat) session.SendMsg(string(this.module.GetType()), "trigger", &pb.MoonfantasyTriggerPush{Issucc: true, Mid: mdata.Id, Monster: mdata.Monster}) // this.module.ModuleRtask.SendToRtask(session, comm.Rtype87, 1) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype87, 1)) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype87, 1)) + }) return } @@ -188,8 +190,9 @@ func (this *modelDreamComp) triggerbyid(session comm.IUserSession, boosid string } this.module.modelDream.noticeuserfriend(session, mdata.Id, chat) session.SendMsg(string(this.module.GetType()), "trigger", &pb.MoonfantasyTriggerPush{Issucc: true, Mid: mdata.Id, Monster: mdata.Monster}) - // this.module.ModuleRtask.SendToRtask(session, comm.Rtype87, 1) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype87, 1)) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype87, 1)) + }) return } diff --git a/modules/pagoda/api_challengeover.go b/modules/pagoda/api_challengeover.go index f56f7c483..02be6cc35 100644 --- a/modules/pagoda/api_challengeover.go +++ b/modules/pagoda/api_challengeover.go @@ -182,13 +182,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal this.module.SetPagodaRankList("pagodaList"+strconv.Itoa(int(newData.PagodaId)), pagoda.PagodaId, newData.Id) } - go this.module.ModuleSys.CheckOpenCond(session.Clone(), comm.OpencondTypePagoda, conf.Key) // 通关奖励 errdata = this.module.DispenseRes(session, conf.Reward, true) if errdata != nil { return } - // 任务相关 - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype168, pagoda.Data[conf.Tab], conf.Tab)) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleSys.CheckOpenCond(session, comm.OpencondTypePagoda, conf.Key) + this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype168, pagoda.Data[conf.Tab], conf.Tab)) + }) return } diff --git a/modules/pagoda/api_racechallengeover.go b/modules/pagoda/api_racechallengeover.go index 5ad70c0ad..8261607a2 100644 --- a/modules/pagoda/api_racechallengeover.go +++ b/modules/pagoda/api_racechallengeover.go @@ -179,12 +179,14 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda this.module.SetRacePagodaRankList("race"+strconv.Itoa(int(conf.Restriction)), race.Race[conf.Restriction].Curfloor, session.GetUserId(), newData.Id) } // 任务相关 - var sz []*pb.BuriedParam - sz = append(sz, comm.GetBuriedParam(comm.Rtype232, conf.Restriction, conf.Floors)) + var tasks []*pb.BuriedParam + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype232, conf.Restriction, conf.Floors)) if conf.Restriction >= 10 { - sz = append(sz, comm.GetBuriedParam(comm.Rtype231, conf.Floors)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype231, conf.Floors)) } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), sz...) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/pay/module.go b/modules/pay/module.go index 48bd56932..04b02f326 100644 --- a/modules/pay/module.go +++ b/modules/pay/module.go @@ -200,11 +200,11 @@ func (this *Pay) Rpc_ModulePayDelivery(ctx context.Context, args *pb.PayDelivery return } } - go func(_session comm.IUserSession) { - this.ModuleHero.RechargeMoney(args.Uid, args.Price) - this.ModuleBuried.TriggerBuried(_session, comm.GetBuriedParam(comm.Rtype229, 1, conf.Pid)) - }(session.Clone()) + go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.ModuleHero.RechargeMoney(args.Uid, args.Price) + this.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype229, 1, conf.Pid)) + }) return } diff --git a/modules/practice/api_accept.go b/modules/practice/api_accept.go index 8114f5afe..af82e10c9 100644 --- a/modules/practice/api_accept.go +++ b/modules/practice/api_accept.go @@ -132,6 +132,9 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.PracticeAcceptReq this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify", &pb.PracticeQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 2}, req.Uid) _session, _ := this.module.GetUserSession(req.Uid) - go this.module.ModuleBuried.TriggerBuried(_session.Clone(), comm.GetBuriedParam(comm.Rtype183, 1)) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(_session.Clone(), comm.GetBuriedParam(comm.Rtype183, 1)) + }) return } diff --git a/modules/practice/api_getgymbuff.go b/modules/practice/api_getgymbuff.go index e7a8a3fd1..f2c120a99 100644 --- a/modules/practice/api_getgymbuff.go +++ b/modules/practice/api_getgymbuff.go @@ -21,6 +21,7 @@ func (this *apiComp) GetGymBuff(session comm.IUserSession, req *pb.PracticeGetGy buff *cfg.GamePandamasBuffData room *pb.DBPracticeRoom award []*pb.UserAssets + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) err error ) @@ -40,7 +41,6 @@ func (this *apiComp) GetGymBuff(session comm.IUserSession, req *pb.PracticeGetGy } return } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype185, 1)) if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ @@ -67,7 +67,10 @@ func (this *apiComp) GetGymBuff(session comm.IUserSession, req *pb.PracticeGetGy "lastgymtime": room.Lastgymtime, }) } - + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype185, 1)) session.SendMsg(string(this.module.GetType()), "getgymbuff", &pb.PracticeGetGymBuffResp{Buffid: buff.Id, Award: award}) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/practice/api_gyminfo.go b/modules/practice/api_gyminfo.go index 844fef6b3..08b0fcec5 100644 --- a/modules/practice/api_gyminfo.go +++ b/modules/practice/api_gyminfo.go @@ -16,8 +16,9 @@ func (this *apiComp) GymInfoCheck(session comm.IUserSession, req *pb.PracticeGym // /获取每日一练信息 func (this *apiComp) GymInfo(session comm.IUserSession, req *pb.PracticeGymInfoReq) (errdata *pb.ErrorData) { var ( - err error - room *pb.DBPracticeRoom + err error + room *pb.DBPracticeRoom + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ @@ -33,7 +34,11 @@ func (this *apiComp) GymInfo(session comm.IUserSession, req *pb.PracticeGymInfoR "gymrefresh": room.Gymrefresh, }) } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype185, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype185, 1)) session.SendMsg(string(this.module.GetType()), "gyminfo", &pb.PracticeGymInfoResp{Lastaction: room.Gymaction, Refreshnum: room.Gymrefresh}) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/practice/api_loot.go b/modules/practice/api_loot.go index 3563118ef..d7b9ddadc 100644 --- a/modules/practice/api_loot.go +++ b/modules/practice/api_loot.go @@ -23,7 +23,8 @@ func (this *apiComp) Loot(session comm.IUserSession, req *pb.PracticeLootReq) (e pillarconfigure *cfg.GamePandamasMzData tconfigure *cfg.GamePandamasJxData pconfigure *cfg.GamePandamasJxData - extra int32 = 0 + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) + extra int32 = 0 ) if froom, err = this.module.modelPandata.queryUserMartialhall(req.Friend); err != nil { errdata = &pb.ErrorData{ @@ -125,7 +126,12 @@ func (this *apiComp) Loot(session comm.IUserSession, req *pb.PracticeLootReq) (e } else { this.module.PutUserSession(_session) } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype184, 1)) + + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype184, 1)) session.SendMsg(string(this.module.GetType()), "loot", &pb.PracticeLootResp{Friend: req.Friend, Pillar: froom.Pillarf}) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/practice/api_npcbattklefinish.go b/modules/practice/api_npcbattklefinish.go index 0feab23ca..f98715203 100644 --- a/modules/practice/api_npcbattklefinish.go +++ b/modules/practice/api_npcbattklefinish.go @@ -16,9 +16,10 @@ func (this *apiComp) NPCBattkleFinishCheck(session comm.IUserSession, req *pb.Pr // /npc 战斗结果请求 func (this *apiComp) NPCBattkleFinish(session comm.IUserSession, req *pb.PracticeNPCBattkleFinishReq) (errdata *pb.ErrorData) { var ( - err error - room *pb.DBPracticeRoom - conf *cfg.GameDispatch_BattleData + err error + room *pb.DBPracticeRoom + conf *cfg.GameDispatch_BattleData + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ @@ -58,8 +59,7 @@ func (this *apiComp) NPCBattkleFinish(session comm.IUserSession, req *pb.Practic "npcstate": room.Npcstate, "refresh": room.Refresh, }) - - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype182, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype182, 1)) } else { room.Npcstate = 1 room.Battlenum++ @@ -87,5 +87,9 @@ func (this *apiComp) NPCBattkleFinish(session comm.IUserSession, req *pb.Practic } session.SendMsg(string(this.module.GetType()), "npcbattklefinish", &pb.PracticeNPCBattkleFinishResp{Issucc: true}) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/practice/api_practice.go b/modules/practice/api_practice.go index 4c80ab728..9ecfaea0c 100644 --- a/modules/practice/api_practice.go +++ b/modules/practice/api_practice.go @@ -29,6 +29,7 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic pconfigure *cfg.GamePandamasJxData extra int32 = 0 filed string + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ @@ -234,7 +235,11 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic "knapsack": room.Knapsack, filed: pillar, }) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype149, 1)) + + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype149, 1)) session.SendMsg(string(this.module.GetType()), "practice", &pb.PracticePracticeResp{Pillar: pillar}) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/practice/api_receive.go b/modules/practice/api_receive.go index 683d4c36c..6e48e93d3 100644 --- a/modules/practice/api_receive.go +++ b/modules/practice/api_receive.go @@ -34,6 +34,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR exp1 int32 ants1 []*cfg.Gameatn ants2 []*cfg.Gameatn + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if req.Friend != "" { if froom, err = this.module.modelPandata.queryUserMartialhall(req.Friend); err != nil { @@ -295,7 +296,11 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR this.module.PutUserSession(_session) } } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype135, minutes)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype135, minutes)) session.SendMsg(string(this.module.GetType()), "receive", &pb.PracticeReceiveResp{Pillar: pillar, Knapsack: room.Knapsack}) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/practice/api_unLock.go b/modules/practice/api_unLock.go index 2c595cb16..369b83c56 100644 --- a/modules/practice/api_unLock.go +++ b/modules/practice/api_unLock.go @@ -18,6 +18,7 @@ func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq room *pb.DBPracticeRoom pillar *pb.DBPracticePillar filed string + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ @@ -72,7 +73,12 @@ func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq filed: pillar, "pillarf": room.Pillarf, }) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype152, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype152, 1)) session.SendMsg(string(this.module.GetType()), "unlock", &pb.PracticeUnLockResp{Info: room}) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + return } diff --git a/modules/practice/module.go b/modules/practice/module.go index 7e9b8b64e..b46973cc1 100644 --- a/modules/practice/module.go +++ b/modules/practice/module.go @@ -398,7 +398,9 @@ func (this *Practice) RPC_ModulePracticeUnLockPillar(ctx context.Context, args * } _session, _ := this.GetUserSession(args.Param1) - go this.ModuleBuried.TriggerBuried(_session, comm.GetBuriedParam(comm.Rtype152, 1)) + go this.AsynHandleSession(_session, func(session comm.IUserSession) { + this.ModuleBuried.TriggerBuried(_session, comm.GetBuriedParam(comm.Rtype152, 1)) + }) return } diff --git a/modules/questionnaire/api_answer.go b/modules/questionnaire/api_answer.go index b1aeb4495..897a3a58c 100644 --- a/modules/questionnaire/api_answer.go +++ b/modules/questionnaire/api_answer.go @@ -95,7 +95,6 @@ func (this *apiComp) Answer(session comm.IUserSession, req *pb.QuestionnaireAnsw } tasks = append(tasks, comm.GetBuriedParam(comm.Rtype203, 1, req.Group)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype204, 1)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) } if err = this.module.modelQuestionnaire.updateUserQuestionnaire(session.GetUserId(), info); err != nil { errdata = &pb.ErrorData{ @@ -106,5 +105,11 @@ func (this *apiComp) Answer(session comm.IUserSession, req *pb.QuestionnaireAnsw return } session.SendMsg(string(this.module.GetType()), "answer", &pb.QuestionnaireAnswerResp{Info: info.Group[req.Group], Group: req.Group, Complete: finish, Award: award}) + + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/shop/api_buy.go b/modules/shop/api_buy.go index c0aedfedb..cc028feb9 100644 --- a/modules/shop/api_buy.go +++ b/modules/shop/api_buy.go @@ -222,10 +222,12 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (errdata // this.module.ModuleRtask.SendToRtask(session, comm.Rtype67, v.N, utils.ToInt32(v.T)) } } - if len(tasks) > 0 { - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) - } session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true}) + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/shop/api_getlist.go b/modules/shop/api_getlist.go index 9a4c559fd..60d4f650e 100644 --- a/modules/shop/api_getlist.go +++ b/modules/shop/api_getlist.go @@ -37,6 +37,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) equiconf *cfg.GameEquipData equibuyconf *cfg.GameShopBuyequiCosData leftrefnum int32 + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if errdata = this.GetlistCheck(session, req); errdata != nil { return @@ -220,7 +221,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) } goods = transGoods(items, sdata) // this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype105, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype105, 1)) this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{"refreshnumgoldShop": shopData.RefreshnumgoldShop, "refreshtimegoldShop": shopData.RefreshtimegoldShop, filed: sdata}) } else if !req.IsManualRefresh { // refresh := int(this.module.privilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType2)) @@ -299,8 +300,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) } goods = transGoods(items, sdata) this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{filed: sdata}) - // this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype105, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype105, 1)) } else { //返回以前的商品列表 keys := make([]int32, len(sdata.Items)) for i, v := range sdata.Items { @@ -325,5 +325,12 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) return } session.SendMsg(string(this.module.GetType()), "getlist", &pb.ShopGetListResp{SType: req.SType, IsManualRefresh: req.IsManualRefresh, Goods: goods, SurplusRefreshNum: leftrefnum, Lastrefreshtime: sdata.LastRefreshTime, Leftfreerefreshnum: sdata.Leftfreerefreshnum}) + + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } + return } diff --git a/modules/smithy/api_atlasactivate.go b/modules/smithy/api_atlasactivate.go index db5349b53..d2c3d8bed 100644 --- a/modules/smithy/api_atlasactivate.go +++ b/modules/smithy/api_atlasactivate.go @@ -15,7 +15,7 @@ func (this *apiComp) AtlasActivateCheck(session comm.IUserSession, req *pb.Smith func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtlasActivateReq) (errdata *pb.ErrorData) { var ( addScore int32 // 更新图鉴增加的积分 - szTask []*pb.BuriedParam + tasks []*pb.BuriedParam update map[string]interface{} ) update = make(map[string]interface{}, 0) @@ -114,10 +114,12 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla update["score"] = atlas.Score update["collect"] = atlas.Collect this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype165, 1)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype166, int32(len(atlas.Collect)))) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype167, atlas.Score)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype165, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype166, int32(len(atlas.Collect)))) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype167, atlas.Score)) session.SendMsg(string(this.module.GetType()), "atlasactivate", &pb.SmithyAtlasActivateResp{Data: atlas}) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/smithy/api_forgeequip.go b/modules/smithy/api_forgeequip.go index 0ad71f78b..dd34aa664 100644 --- a/modules/smithy/api_forgeequip.go +++ b/modules/smithy/api_forgeequip.go @@ -302,7 +302,6 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq szTask = append(szTask, comm.GetBuriedParam(comm.Rtype177, 1)) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype179, 1, nextProficiency.Value1)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) } // 是否解锁新套装 if nextProficiency.Type == comm.SmithyReelType4 { @@ -329,7 +328,11 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq // 炉温恢复时间红点推送 i, err := this.module.service.GetModule(comm.ModuleReddot) if err != nil { - this.module.Error(err.Error()) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } if b, y := i.(comm.IReddot); y { @@ -355,7 +358,10 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq tasks = append(tasks, comm.GetBuriedParam(comm.Rtype189, req.Count)) // 进行N次定制打造 } tasks = append(tasks, comm.GetBuriedParam(comm.Rtype148, req.Count)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/smithy/api_rise.go b/modules/smithy/api_rise.go index ce48edad9..9f5f0f643 100644 --- a/modules/smithy/api_rise.go +++ b/modules/smithy/api_rise.go @@ -20,7 +20,8 @@ func (this *apiComp) RiseCheck(session comm.IUserSession, req *pb.SmithyRiseReq) // 炉子升温 func (this *apiComp) Rise(session comm.IUserSession, req *pb.SmithyRiseReq) (errdata *pb.ErrorData) { var ( - cost []*cfg.Gameatn // 消耗材料 + cost []*cfg.Gameatn // 消耗材料 + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if errdata = this.RiseCheck(session, req); errdata != nil { @@ -85,9 +86,12 @@ func (this *apiComp) Rise(session comm.IUserSession, req *pb.SmithyRiseReq) (err Nextchanagetime: stove.RecoveTime, }) } - tasks := make([]*pb.BuriedParam, 0) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype175, stove.Temperature)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + } + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) } return diff --git a/modules/sociaty/api_cross_agree.go b/modules/sociaty/api_cross_agree.go index 1fdb46ad6..35bb56a6a 100644 --- a/modules/sociaty/api_cross_agree.go +++ b/modules/sociaty/api_cross_agree.go @@ -23,6 +23,10 @@ func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.SociatyAgreeR } func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (errdata *pb.ErrorData) { + var ( + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) + ) + if errdata = this.AgreeCheck(session, req); errdata != nil { return } @@ -95,8 +99,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) ( } // 触发任务条件 - // this.module.ModuleRtask.SendToRtask(session, comm.Rtype109, 1) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype109, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype109, 1)) // 发邮件 if err := this.module.modelSociaty.sendMail("GuildApproved", []string{sociaty.Name}, []string{req.Uid}); err != nil { this.module.Error("发送邮件 模板ID:GuildApproved", @@ -113,16 +116,15 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) ( session.SendMsg(string(this.module.GetType()), SociatySubTypeAgree, rsp) - //审核通过推送给申请人 - if err := this.module.SendMsgToUser(string(this.module.GetType()), "pagree", &pb.SociatyPAgreePush{ - Uid: uid, - SociatyId: sociaty.Id, - }, req.Uid); err != nil { - this.module.Error("审核通过推送", - log.Field{Key: "uid", Value: uid}, - log.Field{Key: "申请人", Value: req.Uid}, - log.Field{Key: "sociatyId", Value: sociaty.Id}, - ) - } + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + //审核通过推送给申请人 + if err := this.module.SendMsgToUser(string(this.module.GetType()), "pagree", &pb.SociatyPAgreePush{ + Uid: req.Uid, + SociatyId: sociaty.Id, + }, req.Uid); err != nil { + this.module.Errorln(err) + } + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/sociaty/api_cross_apply.go b/modules/sociaty/api_cross_apply.go index b73c24a6c..5055ab4ef 100644 --- a/modules/sociaty/api_cross_apply.go +++ b/modules/sociaty/api_cross_apply.go @@ -25,6 +25,7 @@ func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.SociatyApplyR func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (errdata *pb.ErrorData) { var ( sociaty *pb.DBSociaty + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) err error ) @@ -143,12 +144,17 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) ( // 无需审核 if !isCheck { // 触发任务条件 - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype109, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype109, 1)) } rsp := &pb.SociatyApplyResp{ Uid: uid, ScoiatyId: req.SociatyId, } session.SendMsg(string(this.module.GetType()), SociatySubTypeApply, rsp) + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/sociaty/api_cross_create.go b/modules/sociaty/api_cross_create.go index 45d6b07bd..21aef7a07 100644 --- a/modules/sociaty/api_cross_create.go +++ b/modules/sociaty/api_cross_create.go @@ -33,6 +33,10 @@ func (this *apiComp) CreateCheck(session comm.IUserSession, req *pb.SociatyCreat } func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) (errdata *pb.ErrorData) { + var ( + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) + ) + if errdata = this.CreateCheck(session, req); errdata != nil { return } @@ -206,8 +210,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) ) return } - - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype188, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype188, 1)) // 初始化玩家公会任务 if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil { this.module.Error("初始化玩家公会任务", @@ -223,5 +226,11 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) Id: sociaty.Id, Uid: uid, }) + + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/stonehenge/api_enterlevel.go b/modules/stonehenge/api_enterlevel.go index 5eb7c317f..9d5362fae 100644 --- a/modules/stonehenge/api_enterlevel.go +++ b/modules/stonehenge/api_enterlevel.go @@ -169,13 +169,17 @@ func (this *apiComp) EnterLevel(session comm.IUserSession, req *pb.StonehengeEnt Room: stone.Rooms, }) - var szTask []*pb.BuriedParam + var tasks []*pb.BuriedParam for _, v := range szEvent { // 首次触发指定ID的事件 if c, e := this.module.configure.GetStoneEventDataById(v); e == nil { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype223, c.EventType, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype223, c.EventType, 1)) } } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/stonehenge/api_event.go b/modules/stonehenge/api_event.go index 66751c210..cc503c06f 100644 --- a/modules/stonehenge/api_event.go +++ b/modules/stonehenge/api_event.go @@ -32,7 +32,8 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq eventConf *cfg.GameStoneEventData reward []*pb.UserAtno curbuff int32 - newbuff int32 // 新获得的buff + newbuff int32 // 新获得的buff + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) update = make(map[string]interface{}) if errdata = this.EventCheck(session, req); errdata != nil { @@ -162,9 +163,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq update["hero"] = stone.Hero this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update) // 战斗失败埋点处理 - var szTask []*pb.BuriedParam - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype225, 1)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype225, 1)) return } if !bWin { // 战斗失败直接返回 @@ -472,9 +471,8 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq }) // 埋点处理 - var szTask []*pb.BuriedParam for k := range stone.Rooms.Eventid { // 首次触发指定ID的事件 - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype215, k)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype215, k)) } var totalhp int32 //上阵英雄都为指定职业 @@ -494,13 +492,13 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq totalhp += v.Currhp * 1000 / maxHp } if job != 0 { // 上阵英雄都为指定职业 - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype216, job, stone.StageID)) //上阵英雄都为指定职业,击败石阵秘境中指定关卡的首领 + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype216, job, stone.StageID)) //上阵英雄都为指定职业,击败石阵秘境中指定关卡的首领 } for _, v := range stone.Webuff { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype217, v, stone.StageID)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype217, v, stone.StageID)) } for _, v := range stone.Enemybuff { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype217, v, stone.StageID)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype217, v, stone.StageID)) } // Rtype218 统计类型 var buffType map[int32]int32 @@ -517,36 +515,40 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq } } for k, v := range buffType { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype218, k, v, stone.StageID)) //携带指定类型、≥指定数量的buff,击败石阵秘境中指定关卡的首领 + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype218, k, v, stone.StageID)) //携带指定类型、≥指定数量的buff,击败石阵秘境中指定关卡的首领 } // 累计击败石阵秘境任意关卡的首领N次 - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype219, stone.StageID)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype219, stone.StageID)) //击败指定关卡的首领时,背包中指定道具数量≥指定数量 if item, err := this.module.ModuleItems.QueryUserPack(session.GetUserId()); err != nil { for _, v := range item { if v.Amount > 0 { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype222, stone.StageID, utils.ToInt32(v.ItemId), int32(v.Amount))) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype226, stone.StageID, utils.ToInt32(v.ItemId), int32(v.Amount))) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype222, stone.StageID, utils.ToInt32(v.ItemId), int32(v.Amount))) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype226, stone.StageID, utils.ToInt32(v.ItemId), int32(v.Amount))) } } } //击败石阵秘境中指定关卡的首领时,每名上阵英雄血量≤比例(千分比) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype224, totalhp, stone.StageID)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype224, totalhp, stone.StageID)) } // 强化商店 if eventConf.EventType == EventType29 { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype220, 1)) // 强化buff 埋点 + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype220, 1)) // 强化buff 埋点 } // 累计获得指定类型buff if eventConf.EventType == EventType25 { if newbuff != 0 { if conf, err := this.module.configure.GetStoneBuffDataById(newbuff); err == nil { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype221, conf.Type, 1)) //累计获得N个指定类型的buff + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype221, conf.Type, 1)) //累计获得N个指定类型的buff } } } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/stonehenge/api_gotoroom.go b/modules/stonehenge/api_gotoroom.go index 9bae05392..48bd13e78 100644 --- a/modules/stonehenge/api_gotoroom.go +++ b/modules/stonehenge/api_gotoroom.go @@ -165,13 +165,16 @@ func (this *apiComp) GotoRoom(session comm.IUserSession, req *pb.StonehengeGotoR }) // 埋点 - var szTask []*pb.BuriedParam + var tasks []*pb.BuriedParam for _, v := range szEvent { // 首次触发指定ID的事件 if c, e := this.module.configure.GetStoneEventDataById(v); e == nil { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype223, c.EventType, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype223, c.EventType, 1)) } } - - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/user/api_create.go b/modules/user/api_create.go index e76fab13c..d2ce58f45 100644 --- a/modules/user/api_create.go +++ b/modules/user/api_create.go @@ -31,6 +31,10 @@ func (this *apiComp) CreateCheck(session comm.IUserSession, req *pb.UserCreateRe // 创角 func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (errdata *pb.ErrorData) { + var ( + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) + ) + if errdata = this.CreateCheck(session, req); errdata != nil { return } @@ -113,41 +117,15 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (e _ = this.module.DispenseRes(session, res, true) } - //初始化用户设置 - // this.module.modelSetting.InitSetting(session.GetUserId()) - - // go func() { - // //初始化公会 date3.10 - // sociaty := this.module.CrossCreateSociaty(uid, req.NickName) - // if sociaty == nil { - // return - // } - // this.module.Debugf("公会ID:%v", sociaty.Id) - // exUpdate := map[string]interface{}{ - // "sociatyId": sociaty.Id, - // } - - // if err := this.module.ModuleUser.ChangeUserExpand(uid, exUpdate); err != nil { - // errdata = &pb.ErrorData{ - // Code: pb.ErrorCode_DBError, - // Title: pb.ErrorCode_DBError.ToString(), - // Message: err.Error(), - // } - // this.module.Error("更新玩家公会ID", - // log.Field{Key: "uid", Value: uid}, - // log.Field{Key: "sociatyId", Value: sociaty.Id}, - // log.Field{Key: "err", Value: err.Error()}, - // ) - // return - // } - - // }() - // resp.IsSucc = true - // this.sendMsg(session, UserSubTypeCreate, resp) session.SendMsg(string(this.module.GetType()), UserSubTypeCreate, &pb.UserCreateResp{}) if req.Figure != 0 { - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype72, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype72, 1)) } this.mail.SendMailByCid(session, comm.Welcomemail, nil) + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/user/api_login.go b/modules/user/api_login.go index b0fb8b0c1..72c036b12 100644 --- a/modules/user/api_login.go +++ b/modules/user/api_login.go @@ -2,8 +2,6 @@ package user import ( "go_dreamfactory/comm" - "go_dreamfactory/lego/sys/event" - "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" "go_dreamfactory/utils" @@ -24,33 +22,31 @@ func (this *apiComp) LoginCheck(session comm.IUserSession, req *pb.UserLoginReq) // 登录 func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (errdata *pb.ErrorData) { - if errdata = this.LoginCheck(session, req); errdata != nil { - return - } var ( - err error user *pb.DBUser + expand *pb.DBUserExpand lastLoginTime int64 + update map[string]interface{} = make(map[string]interface{}) + err error tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) - rsp := &pb.UserLoginResp{} + if errdata = this.LoginCheck(session, req); errdata != nil { + return + } //从mgo查询user user, err = this.module.modelUser.FindByAccount(req.Sid, req.Account) - if err != nil { - if err != mongo.ErrNoDocuments { - log.Error("User_FindByAccount", - log.Field{Key: "uid", Value: req.Sid}, - log.Field{Key: "account", Value: req.Account}, - log.Field{Key: "err", Value: err.Error()}, - ) - return + if err != nil && err != mongo.ErrNoDocuments { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), } + return } - var isNewUser bool - if user == nil { + if err == mongo.ErrNoDocuments { //如果是新玩家,创建一条基础的数据,页面会引导进入创角页面 user = &pb.DBUser{ Sid: req.Sid, @@ -64,10 +60,14 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err } err = this.module.modelUser.User_Create(user) if err != nil { - log.Errorf("User_CreateUser err %v", err) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } - isNewUser = true + expand = &pb.DBUserExpand{} } else { // 玩家是否已在线 if isession, ok := this.module.ModuleBase.GetUserSession(user.Uid); ok { @@ -76,19 +76,57 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err isession.UnBind() this.module.PutUserSession(isession) } - } + lastLoginTime = user.Logintime + user.Logintime = configure.Now().Unix() + user.Lastloginip = session.GetIP() + user.Offlinetime = 0 + user.Area = req.Area + user.Channel = req.Channel + user.Vcode = req.Vcode + user.Vname = req.Vname + update["logintime"] = user.Logintime + update["lastloginip"] = user.Lastloginip + update["offlinetime"] = user.Offlinetime + update["Channel"] = user.Channel + update["vcode"] = user.Vcode + update["vname"] = user.Vname - //bind user - err = session.Bind(user.Uid, this.service.GetId()) - if err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_BindUser, - Title: pb.ErrorCode_BindUser.ToString(), - Message: err.Error(), + if expand, err = this.module.GetUserExpand(session.GetUserId()); err != nil { + if err != mongo.ErrNoDocuments { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + } + + if !utils.IsToday(lastLoginTime) { //当天第一次登录 + user.Nologindays = int32(utils.DiffDays(lastLoginTime, configure.Now().Unix())) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype8, 1)) + this.module.modelExpand.Change(session.GetUserId(), map[string]interface{}{ + "loginAddCount": expand.LoginAddCount + 1, + "globalbuff": 0, + "consumPs": 0, // 重置每日消耗体力 + "loginContinueCount": expand.LoginContinueCount + 1, + }) + // 清理点赞 + + } + err = this.module.modelUser.Change(user.Uid, update) + if err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return } - return } + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype7, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype230, 1, int32(configure.Now().Weekday()))) //缓存user session err = this.module.modelSession.addUserSession(user.Uid, session) if err != nil { @@ -100,82 +138,97 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err } return } + session.SendMsg(string(this.module.GetType()), UserSubTypeLogin, &pb.UserLoginResp{ + Data: user, + Ex: expand, + TimeNow: configure.Now().Unix(), + }) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleFriend.ResetFriend(user.Uid) + this.module.modelSign.UserSign(session) + this.module.ModuleItems.InitItemBagData(session) + this.module.ModuleHero.CheckPeachReward(session, user.Ctime) + if len(tasks) > 0 { + this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + } + }) // 在logintime更新前判断是否是昨天 - if utils.IsYestoday(user.Logintime) { - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype9, 1)) - } else { - this.module.ModuleBuried.ResetBuriedByType(user.Uid, comm.Rtype9) - } + // if utils.IsYestoday(user.Logintime) { + // tasks = append(tasks, comm.GetBuriedParam(comm.Rtype9, 1)) + // } else { + // this.module.ModuleBuried.ResetBuriedByType(user.Uid, comm.Rtype9) + // } //不是新账号 - if !isNewUser { - lastLoginTime = user.Logintime - user.Logintime = configure.Now().Unix() - user.Lastloginip = session.GetIP() - user.Offlinetime = 0 - user.Area = req.Area - user.Channel = req.Channel - user.Vcode = req.Vcode - user.Vname = req.Vname - update := utils.StructToMap(user) //尽量不要更新整个数据 - err = this.module.modelUser.Change(user.Uid, update) - if err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), - } - return - } + // if !isNewUser { + // lastLoginTime = user.Logintime + // user.Logintime = configure.Now().Unix() + // user.Lastloginip = session.GetIP() + // user.Offlinetime = 0 + // user.Area = req.Area + // user.Channel = req.Channel + // user.Vcode = req.Vcode + // user.Vname = req.Vname + // update := utils.StructToMap(user) //尽量不要更新整个数据 + // err = this.module.modelUser.Change(user.Uid, update) + // if err != nil { + // errdata = &pb.ErrorData{ + // Code: pb.ErrorCode_DBError, + // Title: pb.ErrorCode_DBError.ToString(), + // Message: err.Error(), + // } + // return + // } - if this.module.modelUser.isLoginFirst(lastLoginTime) { - this.module.ModuleHero.NoLoginDay(user.Uid, int32(utils.DiffDays(lastLoginTime, configure.Now().Unix()))) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype8, 1)) - this.module.modelExpand.updateLoginDay(user.Uid, lastLoginTime) - // 清理点赞 - this.module.ModuleFriend.ResetFriend(user.Uid) - this.module.modelSign.UserSign(session) - this.module.ModuleItems.InitItemBagData(session) - } + // if this.module.modelUser.isLoginFirst(lastLoginTime) { + // this.module.ModuleHero.NoLoginDay(user.Uid, int32(utils.DiffDays(lastLoginTime, configure.Now().Unix()))) + // tasks = append(tasks, comm.GetBuriedParam(comm.Rtype8, 1)) + // this.module.modelExpand.updateLoginDay(user.Uid, lastLoginTime) + // // 清理点赞 + // this.module.ModuleFriend.ResetFriend(user.Uid) + // this.module.modelSign.UserSign(session) + // this.module.ModuleItems.InitItemBagData(session) + // } - // 判断昨日是否登录 + // // 判断昨日是否登录 - rsp.Data = user + // rsp.Data = user - // 查询玩家扩展数据 - if expand, err := this.module.GetUserExpand(session.GetUserId()); err != nil { - if err != mongo.ErrNoDocuments { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), - } - return - } - } else { - rsp.Ex = expand - } - } else { //新号 - rsp.Ex = &pb.DBUserExpand{} - this.module.modelSign.UserSign(session) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype8, 1)) - } + // // 查询玩家扩展数据 + // if expand, err := this.module.GetUserExpand(session.GetUserId()); err != nil { + // if err != mongo.ErrNoDocuments { + // errdata = &pb.ErrorData{ + // Code: pb.ErrorCode_DBError, + // Title: pb.ErrorCode_DBError.ToString(), + // Message: err.Error(), + // } + // return + // } + // } else { + // rsp.Ex = expand + // } + // } else { //新号 + // rsp.Ex = &pb.DBUserExpand{} + // this.module.modelSign.UserSign(session) + // tasks = append(tasks, comm.GetBuriedParam(comm.Rtype8, 1)) + // } - this.module.ModuleHero.CheckPeachReward(session, user.Ctime) - go this.module.RecoverUserPsStart(session.Clone()) - // 日常登录任务 - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype7, 1)) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype230, 1, int32(configure.Now().Weekday()))) - this.module.ModulePrivilege.CheckDailyPrivilegeMail(session) + // this.module.ModuleHero.CheckPeachReward(session, user.Ctime) + // go this.module.RecoverUserPsStart(session.Clone()) + // // 日常登录任务 + // tasks = append(tasks, comm.GetBuriedParam(comm.Rtype7, 1)) + // tasks = append(tasks, comm.GetBuriedParam(comm.Rtype230, 1, int32(configure.Now().Weekday()))) + // this.module.ModulePrivilege.CheckDailyPrivilegeMail(session) - rsp.Data = user - rsp.TimeNow = configure.Now().Unix() // 设置服务器时间 - session.SendMsg(string(this.module.GetType()), UserSubTypeLogin, rsp) - if len(tasks) > 0 { - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) - } + // rsp.Data = user + // rsp.TimeNow = configure.Now().Unix() // 设置服务器时间 + // session.SendMsg(string(this.module.GetType()), UserSubTypeLogin, rsp) + // if len(tasks) > 0 { + // go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + // } - event.TriggerEvent(comm.EventUserLogin, session.Clone()) + // event.TriggerEvent(comm.EventUserLogin, session.Clone()) return } diff --git a/modules/user/model_expand.go b/modules/user/model_expand.go index 63890dbb3..d5d749094 100644 --- a/modules/user/model_expand.go +++ b/modules/user/model_expand.go @@ -8,7 +8,6 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/configure" "go_dreamfactory/sys/db" - "go_dreamfactory/utils" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/x/bsonx" @@ -94,22 +93,22 @@ func (this *ModelExpand) ChangeUserExpand(uid string, value map[string]interface } -// 累计登录天数 和 全局buff清理 -func (this *ModelExpand) updateLoginDay(uid string, timestamp int64) (err error) { - var de *pb.DBUserExpand - if de, err = this.GetUserExpand(uid); err == nil { - count := de.LoginAddCount + 1 - update := map[string]interface{}{ - "loginAddCount": count, - "globalbuff": 0, - "consumPs": 0, // 重置每日消耗体力 - } +// // 累计登录天数 和 全局buff清理 +// func (this *ModelExpand) updateLoginDay(uid string, timestamp int64) (err error) { +// var de *pb.DBUserExpand +// if de, err = this.GetUserExpand(uid); err == nil { +// count := de.LoginAddCount + 1 +// update := map[string]interface{}{ +// "loginAddCount": count, +// "globalbuff": 0, +// "consumPs": 0, // 重置每日消耗体力 +// } - // 更新连续等登录天数 - if utils.IsYestoday(timestamp) { - update["loginContinueCount"] = de.LoginContinueCount + 1 - } - err = this.ChangeUserExpand(uid, update) - } - return -} +// // 更新连续等登录天数 +// if utils.IsYestoday(timestamp) { +// update["loginContinueCount"] = de.LoginContinueCount + 1 +// } +// err = this.ChangeUserExpand(uid, update) +// } +// return +// } diff --git a/modules/user/model_user.go b/modules/user/model_user.go index d4826f036..154bf35a7 100644 --- a/modules/user/model_user.go +++ b/modules/user/model_user.go @@ -80,10 +80,13 @@ func (this *ModelUser) User_Create(user *pb.DBUser) (err error) { user.Lv = 1 //初始等级 user.Ctime = now user.Logintime = now - _, err = this.DB.InsertOne(comm.TableUser, user) + if _, err = this.DB.InsertOne(comm.TableUser, user); err != nil { + this.module.Errorln("创建用户", log.Field{Key: "sid", Value: user.Sid}, log.Field{Key: "account", Value: user.Binduid}, log.Field{Key: "err", Value: err.Error()}) + return + } key := fmt.Sprintf("%s:%s", this.TableName, user.Uid) if err = this.Redis.HMSet(key, user); err != nil { - this.module.Error("创建用户", log.Field{Key: "sid", Value: user.Sid}, log.Field{Key: "account", Value: user.Binduid}) + this.module.Error("创建用户", log.Field{Key: "sid", Value: user.Sid}, log.Field{Key: "account", Value: user.Binduid}, log.Field{Key: "err", Value: err.Error()}) return } return diff --git a/modules/user/module.go b/modules/user/module.go index f4d87d702..14aa04c07 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -773,7 +773,9 @@ func (this *User) AddAttributeValues(session comm.IUserSession, attrs map[string } if len(tasks) > 0 { - go this.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.ModuleBuried.TriggerBuried(session, tasks...) + }) } return } diff --git a/modules/viking/api_challengeover.go b/modules/viking/api_challengeover.go index f7d0a7b07..e281b9ff4 100644 --- a/modules/viking/api_challengeover.go +++ b/modules/viking/api_challengeover.go @@ -218,30 +218,34 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal this.module.Errorf("no found userdata uid:%s", session.GetUserId()) } // 随机任务统计 - var szTask []*pb.BuriedParam - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype73, 1, req.BossId, req.Difficulty)) + var tasks []*pb.BuriedParam + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype73, 1, req.BossId, req.Difficulty)) //szTask = append(szTask, comm.GetBuriedParam(comm.Rtype74, req.BossId, req.Difficulty)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype78, req.BossId, req.Report.Costtime/1000, req.Difficulty)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype78, req.BossId, req.Report.Costtime/1000, req.Difficulty)) if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { for _, v := range req.Report.Info.Redflist[0].Team { if v.Ishelp { // 判断是否有助战 - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype79, req.Difficulty, req.BossId)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype79, req.Difficulty, req.BossId)) break } } } if req.Auto > 0 { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype75, req.BossId, req.Difficulty)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype172, 1)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype181, 1, req.BossId, req.Difficulty)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype75, req.BossId, req.Difficulty)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype172, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype181, 1, req.BossId, req.Difficulty)) } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype201, consumPs)) - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype76, 1, req.BossId)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype201, consumPs)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype76, 1, req.BossId)) if bHelp { - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype180, req.BossId, 1)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype180, req.BossId, 1)) + } + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) return } diff --git a/modules/wtask/api_battlefinish.go b/modules/wtask/api_battlefinish.go index 8d3334596..e23d24f18 100644 --- a/modules/wtask/api_battlefinish.go +++ b/modules/wtask/api_battlefinish.go @@ -30,6 +30,7 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.WTaskBattle conf *cfg.GameWorldBattleData prop []*cfg.Gameatn award []*pb.UserAssets + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) err error isWin bool ) @@ -99,10 +100,16 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.WTaskBattle return } //触发任务 - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype70, 1, req.BattleConfId)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype70, 1, req.BattleConfId)) } else { - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype227, 1, req.BattleConfId)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype227, 1, req.BattleConfId)) } session.SendMsg(string(this.module.GetType()), "battlefinish", &pb.WTaskBattleFinishResp{BattleConfId: req.BattleConfId, Award: award}) + + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/wtask/api_boxreceive.go b/modules/wtask/api_boxreceive.go index cd7decf9d..60a45cf1f 100644 --- a/modules/wtask/api_boxreceive.go +++ b/modules/wtask/api_boxreceive.go @@ -23,6 +23,7 @@ func (this *apiComp) BoxReceive(session comm.IUserSession, req *pb.WTaskBoxRecei award []*pb.UserAtno ok bool err error + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) if errdata = this.BoxReceiveCheck(session, req); errdata != nil { return @@ -110,8 +111,13 @@ func (this *apiComp) BoxReceive(session comm.IUserSession, req *pb.WTaskBoxRecei } return } - go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype205, 1)) - session.SendMsg(string(this.module.GetType()), "boxreceive", &pb.WTaskBoxReceiveResp{Tid: req.Tid, Boxid: req.Boxid, Award: award}) + + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype205, 1)) + if len(tasks) > 0 { + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + } return } diff --git a/modules/wtask/api_eventcomplete.go b/modules/wtask/api_eventcomplete.go index 84979a8e6..85a0500d8 100644 --- a/modules/wtask/api_eventcomplete.go +++ b/modules/wtask/api_eventcomplete.go @@ -97,7 +97,11 @@ func (this *apiComp) EventComplete(session comm.IUserSession, req *pb.WTaskEvent tasks = append(tasks, comm.GetBuriedParam(comm.Rtype206, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype207, 1, req.Group)) - go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) + session.SendMsg(string(this.module.GetType()), "eventcomplete", &pb.WTaskEventCompleteResp{Group: req.Group, Event: event, Award: award}) return } diff --git a/pb/user_db.pb.go b/pb/user_db.pb.go index 75952763a..a5498d13f 100644 --- a/pb/user_db.pb.go +++ b/pb/user_db.pb.go @@ -155,6 +155,7 @@ type DBUser struct { Deposit int64 `protobuf:"varint,42,opt,name=deposit,proto3" json:"deposit" bson:"deposit"` //储蓄 Profit int64 `protobuf:"varint,43,opt,name=profit,proto3" json:"profit" bson:"profit"` //商队盈利 Integral int64 `protobuf:"varint,44,opt,name=integral,proto3" json:"integral" bson:"integral"` //充值积分 + Nologindays int32 `protobuf:"varint,45,opt,name=nologindays,proto3" json:"nologindays" bson:"nologindays"` //连续多少天未登录 } func (x *DBUser) Reset() { @@ -490,6 +491,13 @@ func (x *DBUser) GetIntegral() int64 { return 0 } +func (x *DBUser) GetNologindays() int32 { + if x != nil { + return x.Nologindays + } + return 0 +} + type DBUserSetting struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -815,7 +823,7 @@ var file_user_user_db_proto_rawDesc = []byte{ 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xa4, 0x08, 0x0a, + 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xc6, 0x08, 0x0a, 0x06, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, @@ -882,46 +890,48 @@ var file_user_user_db_proto_rawDesc = []byte{ 0x16, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, - 0x72, 0x61, 0x6c, 0x22, 0xc7, 0x02, 0x0a, 0x0d, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x75, 0x61, 0x7a, 0x68, - 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x68, 0x75, 0x61, 0x7a, 0x68, 0x69, 0x12, - 0x1c, 0x0a, 0x09, 0x6b, 0x61, 0x6e, 0x67, 0x6a, 0x75, 0x63, 0x68, 0x69, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x09, 0x6b, 0x61, 0x6e, 0x67, 0x6a, 0x75, 0x63, 0x68, 0x69, 0x12, 0x1a, 0x0a, - 0x08, 0x67, 0x61, 0x6f, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x67, 0x61, 0x6f, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x77, 0x75, 0x6c, - 0x69, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x77, 0x75, 0x6c, 0x69, 0x12, 0x14, 0x0a, - 0x05, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x75, - 0x73, 0x69, 0x63, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x67, - 0x75, 0x61, 0x6a, 0x69, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x67, 0x75, 0x61, 0x6a, - 0x69, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x75, 0x62, 0x65, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x05, 0x66, 0x75, 0x62, 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x6e, 0x73, 0x75, - 0x6f, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x74, 0x61, 0x6e, 0x73, 0x75, 0x6f, 0x12, - 0x18, 0x0a, 0x07, 0x68, 0x75, 0x6f, 0x64, 0x6f, 0x6e, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x68, 0x75, 0x6f, 0x64, 0x6f, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x78, 0x75, 0x61, - 0x6e, 0x73, 0x68, 0x61, 0x6e, 0x67, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x78, 0x75, - 0x61, 0x6e, 0x73, 0x68, 0x61, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x61, 0x69, 0x6a, 0x69, - 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x61, 0x69, 0x6a, 0x69, 0x22, 0xb8, 0x01, - 0x0a, 0x06, 0x44, 0x42, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x69, - 0x67, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x69, - 0x67, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, - 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x16, 0x0a, 0x06, - 0x70, 0x75, 0x7a, 0x7a, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x70, 0x75, - 0x7a, 0x7a, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x70, 0x73, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x04, 0x74, 0x69, 0x70, 0x73, 0x22, 0x57, 0x0a, 0x0c, 0x44, 0x42, 0x52, 0x61, - 0x6e, 0x64, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x61, 0x6d, 0x65, - 0x5f, 0x63, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x61, 0x6d, 0x65, 0x43, - 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x72, 0x61, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x6f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x64, 0x61, + 0x79, 0x73, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6e, 0x6f, 0x6c, 0x6f, 0x67, 0x69, + 0x6e, 0x64, 0x61, 0x79, 0x73, 0x22, 0xc7, 0x02, 0x0a, 0x0d, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x75, 0x61, + 0x7a, 0x68, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x68, 0x75, 0x61, 0x7a, 0x68, + 0x69, 0x12, 0x1c, 0x0a, 0x09, 0x6b, 0x61, 0x6e, 0x67, 0x6a, 0x75, 0x63, 0x68, 0x69, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x6b, 0x61, 0x6e, 0x67, 0x6a, 0x75, 0x63, 0x68, 0x69, 0x12, + 0x1a, 0x0a, 0x08, 0x67, 0x61, 0x6f, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x67, 0x61, 0x6f, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x77, + 0x75, 0x6c, 0x69, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x77, 0x75, 0x6c, 0x69, 0x12, + 0x14, 0x0a, 0x05, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x6d, 0x75, 0x73, 0x69, 0x63, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x67, 0x75, 0x61, 0x6a, 0x69, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x67, 0x75, + 0x61, 0x6a, 0x69, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x75, 0x62, 0x65, 0x6e, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x05, 0x66, 0x75, 0x62, 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x6e, + 0x73, 0x75, 0x6f, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x74, 0x61, 0x6e, 0x73, 0x75, + 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x75, 0x6f, 0x64, 0x6f, 0x6e, 0x67, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x68, 0x75, 0x6f, 0x64, 0x6f, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x78, + 0x75, 0x61, 0x6e, 0x73, 0x68, 0x61, 0x6e, 0x67, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, + 0x78, 0x75, 0x61, 0x6e, 0x73, 0x68, 0x61, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x61, 0x69, + 0x6a, 0x69, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x61, 0x69, 0x6a, 0x69, 0x22, + 0xb8, 0x01, 0x0a, 0x06, 0x44, 0x42, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x73, 0x69, 0x67, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x73, 0x69, 0x67, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x10, 0x0a, 0x03, + 0x64, 0x61, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x16, + 0x0a, 0x06, 0x70, 0x75, 0x7a, 0x7a, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, + 0x70, 0x75, 0x7a, 0x7a, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x70, 0x73, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x69, 0x70, 0x73, 0x22, 0x57, 0x0a, 0x0c, 0x44, 0x42, + 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x61, + 0x6d, 0x65, 0x5f, 0x63, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x61, 0x6d, + 0x65, 0x43, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/pb/userexpand.pb.go b/pb/userexpand.pb.go index 6656df329..11cce02cc 100644 --- a/pb/userexpand.pb.go +++ b/pb/userexpand.pb.go @@ -61,7 +61,7 @@ type DBUserExpand struct { Race map[int32]int32 `protobuf:"bytes,37,rep,name=race,proto3" json:"race" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 阵营ID 1~4 value 总好感度 Herofrag map[string]int32 `protobuf:"bytes,38,rep,name=herofrag,proto3" json:"herofrag" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //当获得重复守护者时获得的守护之心次数 Passonlv int32 `protobuf:"varint,39,opt,name=passonlv,proto3" json:"passonlv"` //传功等级 - ConsumPs int32 `protobuf:"varint,40,opt,name=consumPs,proto3" json:"consumPs"` // 今天消耗的体力 + ConsumPs int32 `protobuf:"varint,40,opt,name=consumPs,proto3" json:"consumPs"` //今天消耗的体力 } func (x *DBUserExpand) Reset() {