From 53f6b93f6b6a98a06352171a292b97428dbc05cd Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 29 Jun 2022 19:31:52 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_heroResonance.go | 5 +- modules/hero/api_heroResonanceReset.go | 5 +- modules/hero/api_heroResonanceSelect.go | 4 + modules/hero/api_heroSkillUp.go | 4 + modules/hero/api_heroStarUp.go | 4 + modules/hero/api_heroStrengthen.go | 22 +++- pb/hero_msg.pb.go | 152 ++++++++++-------------- 7 files changed, 100 insertions(+), 96 deletions(-) diff --git a/modules/hero/api_heroResonance.go b/modules/hero/api_heroResonance.go index 04ef478ec..c3bbcb1fc 100644 --- a/modules/hero/api_heroResonance.go +++ b/modules/hero/api_heroResonance.go @@ -135,6 +135,9 @@ func (this *apiComp) Resonance(session comm.IUserSession, agrs map[string]interf } } } - + err = this.moduleHero.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化 + if err != nil { + log.Errorf("PushHeroProperty err!") + } return } diff --git a/modules/hero/api_heroResonanceReset.go b/modules/hero/api_heroResonanceReset.go index fdd567d40..1ea8d8a64 100644 --- a/modules/hero/api_heroResonanceReset.go +++ b/modules/hero/api_heroResonanceReset.go @@ -88,6 +88,9 @@ func (this *apiComp) ResonanceReset(session comm.IUserSession, agrs map[string]i if err != nil { log.Errorf("update hero skill failed:%v", err) } - + err = this.moduleHero.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化 + if err != nil { + log.Errorf("PushHeroProperty err!") + } return } diff --git a/modules/hero/api_heroResonanceSelect.go b/modules/hero/api_heroResonanceSelect.go index fb39941ab..18dc8e30c 100644 --- a/modules/hero/api_heroResonanceSelect.go +++ b/modules/hero/api_heroResonanceSelect.go @@ -53,5 +53,9 @@ func (this *apiComp) ResonanceUseEnergy(session comm.IUserSession, agrs map[stri log.Errorf("update hero skill failed:%v", err) } + err = this.moduleHero.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化 + if err != nil { + log.Errorf("PushHeroProperty err!") + } return } diff --git a/modules/hero/api_heroSkillUp.go b/modules/hero/api_heroSkillUp.go index 3e697990c..801179e14 100644 --- a/modules/hero/api_heroSkillUp.go +++ b/modules/hero/api_heroSkillUp.go @@ -139,5 +139,9 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, agrs map[strin code = pb.ErrorCode_DBError return } + err = this.moduleHero.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化 + if err != nil { + log.Errorf("PushHeroProperty err!") + } return } diff --git a/modules/hero/api_heroStarUp.go b/modules/hero/api_heroStarUp.go index 08931fd7e..60d713991 100644 --- a/modules/hero/api_heroStarUp.go +++ b/modules/hero/api_heroStarUp.go @@ -151,5 +151,9 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string code = pb.ErrorCode_DBError log.Errorf("update hero skill failed:%v", err) } + err = this.moduleHero.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化 + if err != nil { + log.Errorf("PushHeroProperty err!") + } return } diff --git a/modules/hero/api_heroStrengthen.go b/modules/hero/api_heroStrengthen.go index a140488f7..8b5e51cfd 100644 --- a/modules/hero/api_heroStrengthen.go +++ b/modules/hero/api_heroStrengthen.go @@ -101,6 +101,7 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero "curExp": curExp, "curLv": curLv, "addExp": addExp, + "heroObj": _hero, //"atn": atn, } return @@ -115,15 +116,21 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]i addExp int32 // 需要增加的经验 //atn = map[string]interface{}{} ) - defer func() { - if code == pb.ErrorCode_Success { - session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{}) - } - }() + costGold = agrs["costGold"].(int32) curLv = agrs["curLv"].(int32) curExp = agrs["curExp"].(int32) addExp = agrs["addExp"].(int32) + _hero := agrs["heroObj"].(*pb.DBHero) + if _hero == nil { + code = pb.ErrorCode_HeroNoExist + return + } + defer func() { + if code == pb.ErrorCode_Success { + session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{Hero: _hero}) + } + }() log.Debugf("升级后当前等级: %d,经验: %d,需要消耗的金币: %d,增加的经验: %d", curLv, curExp, costGold, addExp) // 执行升级逻辑 code = this.moduleHero.modelHero.moduleHero.AddCardExp(session.GetUserId(), req.HeroObjID, addExp) // 加经验 @@ -140,6 +147,9 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]i if code != pb.ErrorCode_Success { return } - + err := this.moduleHero.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化 + if err != nil { + log.Errorf("PushHeroProperty err!") + } return } diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index b36b06e1c..535178fed 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -1323,64 +1323,40 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, - 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x16, 0x0a, 0x06, - 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x65, 0x6e, - 0x65, 0x72, 0x67, 0x79, 0x12, 0x2a, 0x0a, 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, - 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, - 0x48, 0x65, 0x72, 0x6f, 0x52, 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, 0x72, 0x64, - 0x22, 0x34, 0x0a, 0x14, 0x48, 0x65, 0x72, 0x6f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, - 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, - 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x4f, 0x0a, 0x15, 0x48, 0x65, 0x72, 0x6f, 0x47, 0x6f, - 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, - 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, - 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x22, 0x70, 0x0a, 0x18, 0x48, 0x65, 0x72, 0x6f, 0x47, - 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x55, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, - 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, - 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x75, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, - 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3b, 0x0a, 0x19, 0x48, 0x65, 0x72, - 0x6f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x55, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, - 0x67, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, - 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x5a, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x4a, 0x75, - 0x65, 0x78, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, - 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, - 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x74, - 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x49, - 0x74, 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x6d, - 0x65, 0x73, 0x22, 0x31, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x4a, 0x75, 0x65, 0x78, 0x69, 0x6e, - 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, - 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, - 0x75, 0x6b, 0x61, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, - 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, - 0x48, 0x65, 0x72, 0x6f, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x22, 0xa4, 0x02, 0x0a, - 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x16, 0x0a, - 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, - 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, - 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x65, 0x72, - 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, - 0x79, 0x12, 0x43, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x65, 0x72, 0x6f, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x5a, 0x0a, 0x0e, + 0x48, 0x65, 0x72, 0x6f, 0x4a, 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x12, 0x1c, + 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x09, + 0x63, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x09, 0x63, + 0x6f, 0x73, 0x74, 0x49, 0x74, 0x6d, 0x65, 0x73, 0x22, 0x31, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, + 0x4a, 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, + 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, + 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x48, + 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x0e, + 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, + 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, + 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, + 0x65, 0x73, 0x22, 0xa4, 0x02, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x70, 0x62, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x43, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, + 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, + 0x62, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x41, + 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1397,32 +1373,32 @@ func file_hero_hero_msg_proto_rawDescGZIP() []byte { var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_hero_hero_msg_proto_goTypes = []interface{}{ - (*HeroInfoReq)(nil), // 0: pb.HeroInfoReq - (*HeroInfoRsp)(nil), // 1: pb.HeroInfoRsp - (*HeroListReq)(nil), // 2: pb.HeroListReq - (*HeroListRsp)(nil), // 3: pb.HeroListRsp - (*ItemData)(nil), // 4: pb.ItemData - (*HeroStrengthenUplvReq)(nil), // 5: pb.HeroStrengthenUplvReq - (*HeroStrengthenUplvResp)(nil), // 6: pb.HeroStrengthenUplvResp - (*CostCardData)(nil), // 7: pb.CostCardData - (*HeroStrengthenUpStarReq)(nil), // 8: pb.HeroStrengthenUpStarReq - (*HeroStrengthenUpStarResp)(nil), // 9: pb.HeroStrengthenUpStarResp - (*HeroStrengthenUpSkillReq)(nil), // 10: pb.HeroStrengthenUpSkillReq - (*HeroStrengthenUpSkillResp)(nil), // 11: pb.HeroStrengthenUpSkillResp - (*HeroGongmingReq)(nil), // 12: pb.HeroGongmingReq - (*HeroGongmingResp)(nil), // 13: pb.HeroGongmingResp - (*HeroGongmingResetReq)(nil), // 14: pb.HeroGongmingResetReq - (*HeroGongmingResetResp)(nil), // 15: pb.HeroGongmingResetResp - (*HeroGongmingUseEnergyReq)(nil), // 16: pb.HeroGongmingUseEnergyReq - (*HeroGongmingUseEnergyResp)(nil), // 17: pb.HeroGongmingUseEnergyResp - (*HeroJuexingReq)(nil), // 18: pb.HeroJuexingReq - (*HeroJuexingResp)(nil), // 19: pb.HeroJuexingResp - (*HeroChoukaReq)(nil), // 20: pb.HeroChoukaReq - (*HeroChoukaResp)(nil), // 21: pb.HeroChoukaResp - (*HeroProperty)(nil), // 22: pb.HeroProperty - nil, // 23: pb.HeroProperty.PropertyEntry - nil, // 24: pb.HeroProperty.AddPropertyEntry - (*DBHero)(nil), // 25: pb.DBHero + (*HeroInfoReq)(nil), // 0: pb.HeroInfoReq + (*HeroInfoRsp)(nil), // 1: pb.HeroInfoRsp + (*HeroListReq)(nil), // 2: pb.HeroListReq + (*HeroListRsp)(nil), // 3: pb.HeroListRsp + (*ItemData)(nil), // 4: pb.ItemData + (*HeroStrengthenUplvReq)(nil), // 5: pb.HeroStrengthenUplvReq + (*HeroStrengthenUplvResp)(nil), // 6: pb.HeroStrengthenUplvResp + (*CostCardData)(nil), // 7: pb.CostCardData + (*HeroStrengthenUpStarReq)(nil), // 8: pb.HeroStrengthenUpStarReq + (*HeroStrengthenUpStarResp)(nil), // 9: pb.HeroStrengthenUpStarResp + (*HeroStrengthenUpSkillReq)(nil), // 10: pb.HeroStrengthenUpSkillReq + (*HeroStrengthenUpSkillResp)(nil), // 11: pb.HeroStrengthenUpSkillResp + (*HeroResonanceReq)(nil), // 12: pb.HeroResonanceReq + (*HeroResonanceResp)(nil), // 13: pb.HeroResonanceResp + (*HeroResonanceResetReq)(nil), // 14: pb.HeroResonanceResetReq + (*HeroResonanceResetResp)(nil), // 15: pb.HeroResonanceResetResp + (*HeroResonanceUseEnergyReq)(nil), // 16: pb.HeroResonanceUseEnergyReq + (*HeroResonanceUseEnergyResp)(nil), // 17: pb.HeroResonanceUseEnergyResp + (*HeroJuexingReq)(nil), // 18: pb.HeroJuexingReq + (*HeroJuexingResp)(nil), // 19: pb.HeroJuexingResp + (*HeroChoukaReq)(nil), // 20: pb.HeroChoukaReq + (*HeroChoukaResp)(nil), // 21: pb.HeroChoukaResp + (*HeroProperty)(nil), // 22: pb.HeroProperty + nil, // 23: pb.HeroProperty.PropertyEntry + nil, // 24: pb.HeroProperty.AddPropertyEntry + (*DBHero)(nil), // 25: pb.DBHero } var file_hero_hero_msg_proto_depIdxs = []int32{ 25, // 0: pb.HeroInfoRsp.base:type_name -> pb.DBHero @@ -1432,10 +1408,10 @@ var file_hero_hero_msg_proto_depIdxs = []int32{ 7, // 4: pb.HeroStrengthenUpStarReq.heroRace:type_name -> pb.CostCardData 25, // 5: pb.HeroStrengthenUpStarResp.hero:type_name -> pb.DBHero 25, // 6: pb.HeroStrengthenUpSkillResp.hero:type_name -> pb.DBHero - 25, // 7: pb.HeroGongmingResp.hero:type_name -> pb.DBHero - 25, // 8: pb.HeroGongmingResp.upStarCard:type_name -> pb.DBHero - 25, // 9: pb.HeroGongmingResetResp.hero:type_name -> pb.DBHero - 25, // 10: pb.HeroGongmingUseEnergyResp.hero:type_name -> pb.DBHero + 25, // 7: pb.HeroResonanceResp.hero:type_name -> pb.DBHero + 25, // 8: pb.HeroResonanceResp.upStarCard:type_name -> pb.DBHero + 25, // 9: pb.HeroResonanceResetResp.hero:type_name -> pb.DBHero + 25, // 10: pb.HeroResonanceUseEnergyResp.hero:type_name -> pb.DBHero 4, // 11: pb.HeroJuexingReq.costItmes:type_name -> pb.ItemData 25, // 12: pb.HeroJuexingResp.hero:type_name -> pb.DBHero 25, // 13: pb.HeroChoukaResp.heroes:type_name -> pb.DBHero From 59304f44173c49d8ad8604bde51419bd4f9e7fb6 Mon Sep 17 00:00:00 2001 From: zhaocy Date: Wed, 29 Jun 2022 19:54:55 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/comp_model.go | 6 +- modules/user/api_login.go | 3 +- modules/user/model_user.go | 3 +- pb/hero_msg.pb.go | 152 ++++++++++++++++--------------------- 4 files changed, 69 insertions(+), 95 deletions(-) diff --git a/modules/comp_model.go b/modules/comp_model.go index 04e2b1e0a..76843f096 100644 --- a/modules/comp_model.go +++ b/modules/comp_model.go @@ -113,10 +113,10 @@ func (this *MCompModel) Add(uid string, data interface{}, attrs ...*cache.Operat return } if ret := cache.OperationAttrs(attrs).Find(cache.ATTR_EXPIRE).Unwrap_Or(nil); ret != nil { - this.Redis.Expire(this.ukey(uid), ret.(time.Duration)) + err = this.Redis.Expire(this.ukey(uid), ret.(time.Duration)) } if ret := cache.OperationAttrs(attrs).Find(cache.ATTR_MGOLOG).Unwrap_Or(nil); ret == nil { - err = this.InsertModelLogs(this.TableName, uid, data) + err = this.InsertModelLogs(this.TableName, uid, []interface{}{data}) } return } @@ -131,7 +131,7 @@ func (this *MCompModel) AddList(uid string, id string, data interface{}, attrs . return } if ret := cache.OperationAttrs(attrs).Find(cache.ATTR_EXPIRE).Unwrap_Or(nil); ret != nil { - this.Redis.Expire(this.ukey(uid), ret.(time.Duration)) + err = this.Redis.Expire(this.ukey(uid), ret.(time.Duration)) } if ret := cache.OperationAttrs(attrs).Find(cache.ATTR_MGOLOG).Unwrap_Or(nil); ret == nil { err = this.InsertModelLogs(this.TableName, uid, []interface{}{data}) diff --git a/modules/user/api_login.go b/modules/user/api_login.go index fe0055b9f..5c70c6b41 100644 --- a/modules/user/api_login.go +++ b/modules/user/api_login.go @@ -37,8 +37,6 @@ func (this *apiComp) Login(session comm.IUserSession, result map[string]interfac } }() - // user := decodeUserData(req.Sec) - //从mgo查询user user, err = this.module.modelUser.User_FindByAccount(req.Sid, req.Account) if err != nil { @@ -49,6 +47,7 @@ func (this *apiComp) Login(session comm.IUserSession, result map[string]interfac if user == nil { //如果是新玩家,创建一条基础的数据,页面会引导进入创角页面 + user = &pb.DBUser{} err = this.module.modelUser.User_Create(user) if err != nil { log.Errorf("User_CreateUser err %v", err) diff --git a/modules/user/model_user.go b/modules/user/model_user.go index 4bcf6f68f..702ab5ac5 100644 --- a/modules/user/model_user.go +++ b/modules/user/model_user.go @@ -44,8 +44,7 @@ func (this *ModelUser) User_Create(user *pb.DBUser) (err error) { user.Uid = fmt.Sprintf("%d_%s", user.Sid, _id) user.Uuid = uuid.NewV4().String() user.Ctime = time.Now().Unix() - _, err = this.DB.InsertOne(TableUser, user) - return err + return this.Add(user.Uid,user) } //获取用户 diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index b36b06e1c..535178fed 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -1323,64 +1323,40 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, - 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x16, 0x0a, 0x06, - 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x65, 0x6e, - 0x65, 0x72, 0x67, 0x79, 0x12, 0x2a, 0x0a, 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, - 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, - 0x48, 0x65, 0x72, 0x6f, 0x52, 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, 0x72, 0x64, - 0x22, 0x34, 0x0a, 0x14, 0x48, 0x65, 0x72, 0x6f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, - 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, - 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x4f, 0x0a, 0x15, 0x48, 0x65, 0x72, 0x6f, 0x47, 0x6f, - 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, - 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, - 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x22, 0x70, 0x0a, 0x18, 0x48, 0x65, 0x72, 0x6f, 0x47, - 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x55, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, - 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, - 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x75, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, - 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3b, 0x0a, 0x19, 0x48, 0x65, 0x72, - 0x6f, 0x47, 0x6f, 0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x55, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, - 0x67, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, - 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x5a, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x4a, 0x75, - 0x65, 0x78, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, - 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, - 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x74, - 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x49, - 0x74, 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x6d, - 0x65, 0x73, 0x22, 0x31, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x4a, 0x75, 0x65, 0x78, 0x69, 0x6e, - 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, - 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, - 0x75, 0x6b, 0x61, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, - 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, - 0x48, 0x65, 0x72, 0x6f, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x22, 0xa4, 0x02, 0x0a, - 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x16, 0x0a, - 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, - 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, - 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x65, 0x72, - 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, - 0x79, 0x12, 0x43, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x65, 0x72, 0x6f, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x5a, 0x0a, 0x0e, + 0x48, 0x65, 0x72, 0x6f, 0x4a, 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x12, 0x1c, + 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x09, + 0x63, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x09, 0x63, + 0x6f, 0x73, 0x74, 0x49, 0x74, 0x6d, 0x65, 0x73, 0x22, 0x31, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, + 0x4a, 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, + 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, + 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x48, + 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x0e, + 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, + 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, + 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, + 0x65, 0x73, 0x22, 0xa4, 0x02, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x70, 0x62, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x43, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, + 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, + 0x62, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x41, + 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1397,32 +1373,32 @@ func file_hero_hero_msg_proto_rawDescGZIP() []byte { var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_hero_hero_msg_proto_goTypes = []interface{}{ - (*HeroInfoReq)(nil), // 0: pb.HeroInfoReq - (*HeroInfoRsp)(nil), // 1: pb.HeroInfoRsp - (*HeroListReq)(nil), // 2: pb.HeroListReq - (*HeroListRsp)(nil), // 3: pb.HeroListRsp - (*ItemData)(nil), // 4: pb.ItemData - (*HeroStrengthenUplvReq)(nil), // 5: pb.HeroStrengthenUplvReq - (*HeroStrengthenUplvResp)(nil), // 6: pb.HeroStrengthenUplvResp - (*CostCardData)(nil), // 7: pb.CostCardData - (*HeroStrengthenUpStarReq)(nil), // 8: pb.HeroStrengthenUpStarReq - (*HeroStrengthenUpStarResp)(nil), // 9: pb.HeroStrengthenUpStarResp - (*HeroStrengthenUpSkillReq)(nil), // 10: pb.HeroStrengthenUpSkillReq - (*HeroStrengthenUpSkillResp)(nil), // 11: pb.HeroStrengthenUpSkillResp - (*HeroGongmingReq)(nil), // 12: pb.HeroGongmingReq - (*HeroGongmingResp)(nil), // 13: pb.HeroGongmingResp - (*HeroGongmingResetReq)(nil), // 14: pb.HeroGongmingResetReq - (*HeroGongmingResetResp)(nil), // 15: pb.HeroGongmingResetResp - (*HeroGongmingUseEnergyReq)(nil), // 16: pb.HeroGongmingUseEnergyReq - (*HeroGongmingUseEnergyResp)(nil), // 17: pb.HeroGongmingUseEnergyResp - (*HeroJuexingReq)(nil), // 18: pb.HeroJuexingReq - (*HeroJuexingResp)(nil), // 19: pb.HeroJuexingResp - (*HeroChoukaReq)(nil), // 20: pb.HeroChoukaReq - (*HeroChoukaResp)(nil), // 21: pb.HeroChoukaResp - (*HeroProperty)(nil), // 22: pb.HeroProperty - nil, // 23: pb.HeroProperty.PropertyEntry - nil, // 24: pb.HeroProperty.AddPropertyEntry - (*DBHero)(nil), // 25: pb.DBHero + (*HeroInfoReq)(nil), // 0: pb.HeroInfoReq + (*HeroInfoRsp)(nil), // 1: pb.HeroInfoRsp + (*HeroListReq)(nil), // 2: pb.HeroListReq + (*HeroListRsp)(nil), // 3: pb.HeroListRsp + (*ItemData)(nil), // 4: pb.ItemData + (*HeroStrengthenUplvReq)(nil), // 5: pb.HeroStrengthenUplvReq + (*HeroStrengthenUplvResp)(nil), // 6: pb.HeroStrengthenUplvResp + (*CostCardData)(nil), // 7: pb.CostCardData + (*HeroStrengthenUpStarReq)(nil), // 8: pb.HeroStrengthenUpStarReq + (*HeroStrengthenUpStarResp)(nil), // 9: pb.HeroStrengthenUpStarResp + (*HeroStrengthenUpSkillReq)(nil), // 10: pb.HeroStrengthenUpSkillReq + (*HeroStrengthenUpSkillResp)(nil), // 11: pb.HeroStrengthenUpSkillResp + (*HeroResonanceReq)(nil), // 12: pb.HeroResonanceReq + (*HeroResonanceResp)(nil), // 13: pb.HeroResonanceResp + (*HeroResonanceResetReq)(nil), // 14: pb.HeroResonanceResetReq + (*HeroResonanceResetResp)(nil), // 15: pb.HeroResonanceResetResp + (*HeroResonanceUseEnergyReq)(nil), // 16: pb.HeroResonanceUseEnergyReq + (*HeroResonanceUseEnergyResp)(nil), // 17: pb.HeroResonanceUseEnergyResp + (*HeroJuexingReq)(nil), // 18: pb.HeroJuexingReq + (*HeroJuexingResp)(nil), // 19: pb.HeroJuexingResp + (*HeroChoukaReq)(nil), // 20: pb.HeroChoukaReq + (*HeroChoukaResp)(nil), // 21: pb.HeroChoukaResp + (*HeroProperty)(nil), // 22: pb.HeroProperty + nil, // 23: pb.HeroProperty.PropertyEntry + nil, // 24: pb.HeroProperty.AddPropertyEntry + (*DBHero)(nil), // 25: pb.DBHero } var file_hero_hero_msg_proto_depIdxs = []int32{ 25, // 0: pb.HeroInfoRsp.base:type_name -> pb.DBHero @@ -1432,10 +1408,10 @@ var file_hero_hero_msg_proto_depIdxs = []int32{ 7, // 4: pb.HeroStrengthenUpStarReq.heroRace:type_name -> pb.CostCardData 25, // 5: pb.HeroStrengthenUpStarResp.hero:type_name -> pb.DBHero 25, // 6: pb.HeroStrengthenUpSkillResp.hero:type_name -> pb.DBHero - 25, // 7: pb.HeroGongmingResp.hero:type_name -> pb.DBHero - 25, // 8: pb.HeroGongmingResp.upStarCard:type_name -> pb.DBHero - 25, // 9: pb.HeroGongmingResetResp.hero:type_name -> pb.DBHero - 25, // 10: pb.HeroGongmingUseEnergyResp.hero:type_name -> pb.DBHero + 25, // 7: pb.HeroResonanceResp.hero:type_name -> pb.DBHero + 25, // 8: pb.HeroResonanceResp.upStarCard:type_name -> pb.DBHero + 25, // 9: pb.HeroResonanceResetResp.hero:type_name -> pb.DBHero + 25, // 10: pb.HeroResonanceUseEnergyResp.hero:type_name -> pb.DBHero 4, // 11: pb.HeroJuexingReq.costItmes:type_name -> pb.ItemData 25, // 12: pb.HeroJuexingResp.hero:type_name -> pb.DBHero 25, // 13: pb.HeroChoukaResp.heroes:type_name -> pb.DBHero From 00c3c9b9be5a3d856629c3ac7c2deff78c7ef760 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 30 Jun 2022 09:36:27 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/{api_heroResonance.go => api_resonance.go} | 0 modules/hero/{api_heroResonanceReset.go => api_resonanceReset.go} | 0 .../hero/{api_heroResonanceSelect.go => api_resonanceSelect.go} | 0 modules/hero/{api_heroSkillUp.go => api_skillUp.go} | 0 modules/hero/{api_heroStarUp.go => api_starUp.go} | 0 modules/hero/{api_heroStrengthen.go => api_strengthen.go} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename modules/hero/{api_heroResonance.go => api_resonance.go} (100%) rename modules/hero/{api_heroResonanceReset.go => api_resonanceReset.go} (100%) rename modules/hero/{api_heroResonanceSelect.go => api_resonanceSelect.go} (100%) rename modules/hero/{api_heroSkillUp.go => api_skillUp.go} (100%) rename modules/hero/{api_heroStarUp.go => api_starUp.go} (100%) rename modules/hero/{api_heroStrengthen.go => api_strengthen.go} (100%) diff --git a/modules/hero/api_heroResonance.go b/modules/hero/api_resonance.go similarity index 100% rename from modules/hero/api_heroResonance.go rename to modules/hero/api_resonance.go diff --git a/modules/hero/api_heroResonanceReset.go b/modules/hero/api_resonanceReset.go similarity index 100% rename from modules/hero/api_heroResonanceReset.go rename to modules/hero/api_resonanceReset.go diff --git a/modules/hero/api_heroResonanceSelect.go b/modules/hero/api_resonanceSelect.go similarity index 100% rename from modules/hero/api_heroResonanceSelect.go rename to modules/hero/api_resonanceSelect.go diff --git a/modules/hero/api_heroSkillUp.go b/modules/hero/api_skillUp.go similarity index 100% rename from modules/hero/api_heroSkillUp.go rename to modules/hero/api_skillUp.go diff --git a/modules/hero/api_heroStarUp.go b/modules/hero/api_starUp.go similarity index 100% rename from modules/hero/api_heroStarUp.go rename to modules/hero/api_starUp.go diff --git a/modules/hero/api_heroStrengthen.go b/modules/hero/api_strengthen.go similarity index 100% rename from modules/hero/api_heroStrengthen.go rename to modules/hero/api_strengthen.go From 3e53851962a4d27a5a9bc644208cb116ae9e50bb Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 30 Jun 2022 09:55:41 +0800 Subject: [PATCH 4/8] subType --- modules/hero/api.go | 13 +++++++++---- modules/hero/api_resonance.go | 2 +- modules/hero/api_resonanceReset.go | 2 +- modules/hero/api_resonanceSelect.go | 2 +- modules/hero/api_skillUp.go | 2 +- modules/hero/api_starUp.go | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/modules/hero/api.go b/modules/hero/api.go index a3a4bab6d..436069e9f 100644 --- a/modules/hero/api.go +++ b/modules/hero/api.go @@ -14,10 +14,15 @@ type apiComp struct { } const ( //消息回复的头名称 - StrengthenUplv = "strengthenherolv" - HeroSubTypeInfo = "info" //英雄卡片信息 - HeroSubTypeList = "list" //英雄列表 - HeroSubTypeChouka = "chouka" //抽卡 + StrengthenUplv = "strengthenherolv" + HeroSubTypeInfo = "info" //英雄卡片信息 + HeroSubTypeList = "list" //英雄列表 + HeroSubTypeChouka = "chouka" //抽卡 + ResonanceUseEnergy = "resonanceuseenergy" // 使用共鸣能量 + Resonance = "resonance" // 英雄共鸣属性 + ResonanceReset = "resonancereset" // 共鸣重置 + StrengthenUpSkill = "strengthenupskill" // 技能强化 + StrengthenUpStar = "strengthensupstar" // 英雄升星 ) //组件初始化接口 diff --git a/modules/hero/api_resonance.go b/modules/hero/api_resonance.go index c3bbcb1fc..1ebaf27f6 100644 --- a/modules/hero/api_resonance.go +++ b/modules/hero/api_resonance.go @@ -88,7 +88,7 @@ func (this *apiComp) Resonance(session comm.IUserSession, agrs map[string]interf } defer func() { if code == pb.ErrorCode_Success { - session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroResonanceResp{Hero: _hero}) + session.SendMsg(string(this.moduleHero.GetType()), Resonance, &pb.HeroResonanceResp{Hero: _hero}) } }() diff --git a/modules/hero/api_resonanceReset.go b/modules/hero/api_resonanceReset.go index 1ea8d8a64..6fa264b0f 100644 --- a/modules/hero/api_resonanceReset.go +++ b/modules/hero/api_resonanceReset.go @@ -66,7 +66,7 @@ func (this *apiComp) ResonanceReset(session comm.IUserSession, agrs map[string]i defer func() { if code == pb.ErrorCode_Success { - session.SendMsg(string(this.moduleHero.GetType()), "ResonanceReset", &pb.HeroResonanceResetResp{Hero: _hero, Energy: _hero.ResonateNum}) + session.SendMsg(string(this.moduleHero.GetType()), ResonanceReset, &pb.HeroResonanceResetResp{Hero: _hero, Energy: _hero.ResonateNum}) } }() diff --git a/modules/hero/api_resonanceSelect.go b/modules/hero/api_resonanceSelect.go index 18dc8e30c..a2a32db77 100644 --- a/modules/hero/api_resonanceSelect.go +++ b/modules/hero/api_resonanceSelect.go @@ -32,7 +32,7 @@ func (this *apiComp) ResonanceUseEnergy(session comm.IUserSession, agrs map[stri defer func() { if code == pb.ErrorCode_Success { - session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroResonanceUseEnergyResp{Hero: _hero}) + session.SendMsg(string(this.moduleHero.GetType()), ResonanceUseEnergy, &pb.HeroResonanceUseEnergyResp{Hero: _hero}) } }() diff --git a/modules/hero/api_skillUp.go b/modules/hero/api_skillUp.go index 801179e14..08cccaf07 100644 --- a/modules/hero/api_skillUp.go +++ b/modules/hero/api_skillUp.go @@ -74,7 +74,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, agrs map[strin } defer func() { if code == pb.ErrorCode_Success { - session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroStrengthenUpSkillResp{Hero: _hero}) + session.SendMsg(string(this.moduleHero.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero}) } }() log.Debugf("英雄:%d 技能升级", tagHero) diff --git a/modules/hero/api_starUp.go b/modules/hero/api_starUp.go index 60d713991..ce513b89b 100644 --- a/modules/hero/api_starUp.go +++ b/modules/hero/api_starUp.go @@ -112,7 +112,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string } defer func() { if code == pb.ErrorCode_Success { - session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroStrengthenUpStarResp{Hero: _hero}) + session.SendMsg(string(this.moduleHero.GetType()), StrengthenUpStar, &pb.HeroStrengthenUpStarResp{Hero: _hero}) } }() From cde0da8b0a6619cfa3aa28b55bf01d820529e151 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 30 Jun 2022 10:54:24 +0800 Subject: [PATCH 5/8] update --- modules/hero/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hero/api.go b/modules/hero/api.go index 436069e9f..35fd4d2e6 100644 --- a/modules/hero/api.go +++ b/modules/hero/api.go @@ -14,7 +14,7 @@ type apiComp struct { } const ( //消息回复的头名称 - StrengthenUplv = "strengthenherolv" + StrengthenUplv = "strengthenuplv" HeroSubTypeInfo = "info" //英雄卡片信息 HeroSubTypeList = "list" //英雄列表 HeroSubTypeChouka = "chouka" //抽卡 From bc5cf00841c4c351ab661ec2f7389abe355443c1 Mon Sep 17 00:00:00 2001 From: zhaocy Date: Thu, 30 Jun 2022 10:55:06 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=BD=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_chouka.go | 2 +- pb/hero_msg.pb.go | 61 +++++++++++++++++++++--------------- pb/proto/hero/hero_msg.proto | 4 +-- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/modules/hero/api_chouka.go b/modules/hero/api_chouka.go index d862b0cfa..74aba8336 100644 --- a/modules/hero/api_chouka.go +++ b/modules/hero/api_chouka.go @@ -25,7 +25,7 @@ func (this *apiComp) Chouka(session comm.IUserSession, result map[string]interfa utils.TraceFunc(session.GetUserId(), string(this.moduleHero.GetType()), HeroSubTypeChouka, req, rsp) }() - heroCfgIds := []int32{15001, 25001} + heroCfgIds := req.HeroIds if err := this.moduleHero.modelHero.createMultiHero(session.GetUserId(), heroCfgIds...); err != nil { code = pb.ErrorCode_HeroCreate return diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index 535178fed..46b850f12 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -1089,6 +1089,8 @@ type HeroChoukaReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + HeroIds []int32 `protobuf:"varint,1,rep,packed,name=heroIds,proto3" json:"heroIds"` } func (x *HeroChoukaReq) Reset() { @@ -1123,6 +1125,13 @@ func (*HeroChoukaReq) Descriptor() ([]byte, []int) { return file_hero_hero_msg_proto_rawDescGZIP(), []int{20} } +func (x *HeroChoukaReq) GetHeroIds() []int32 { + if x != nil { + return x.HeroIds + } + return nil +} + type HeroChoukaResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1332,31 +1341,33 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x6f, 0x73, 0x74, 0x49, 0x74, 0x6d, 0x65, 0x73, 0x22, 0x31, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x4a, 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, - 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x48, - 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x0e, - 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, - 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, - 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, - 0x65, 0x73, 0x22, 0xa4, 0x02, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x70, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, - 0x70, 0x62, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x43, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, - 0x62, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x41, - 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x29, 0x0a, 0x0d, 0x48, + 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, + 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x68, + 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x22, 0x34, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, + 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, + 0x48, 0x65, 0x72, 0x6f, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x22, 0xa4, 0x02, 0x0a, + 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x16, 0x0a, + 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, + 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, + 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x65, 0x72, + 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, + 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, + 0x79, 0x12, 0x43, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x65, 0x72, 0x6f, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, + 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, + 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, + 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, + 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/pb/proto/hero/hero_msg.proto b/pb/proto/hero/hero_msg.proto index 72aab6e0c..c8a0e28b5 100644 --- a/pb/proto/hero/hero_msg.proto +++ b/pb/proto/hero/hero_msg.proto @@ -66,7 +66,7 @@ message HeroStrengthenUpSkillResp { message HeroResonanceReq { string heroObjID = 1; // 英雄对象ID string costObjID = 2; // 消耗对象 - int32 amount = 3;// 消耗的数量 + int32 amount = 3; // 消耗的数量 } message HeroResonanceResp { @@ -108,7 +108,7 @@ message HeroJuexingResp { } //抽卡 -message HeroChoukaReq {} +message HeroChoukaReq { repeated int32 heroIds = 1; } message HeroChoukaResp { repeated DBHero heroes = 1; } From 449dd5ed05617abca080cddc9d24058b4d8e169c Mon Sep 17 00:00:00 2001 From: zhaocy Date: Thu, 30 Jun 2022 10:55:27 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/robot/hero.go | 42 ++++++++++++++++++++++++++++++++++++++---- cmd/robot/robot.go | 9 ++++++++- cmd/robot/user.go | 2 +- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/cmd/robot/hero.go b/cmd/robot/hero.go index 71faaa594..0df8b2e32 100644 --- a/cmd/robot/hero.go +++ b/cmd/robot/hero.go @@ -1,9 +1,12 @@ package robot import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/modules/hero" "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" ) var ( @@ -14,7 +17,13 @@ var ( subType: hero.HeroSubTypeList, req: &pb.HeroListReq{}, rsp: &pb.HeroListRsp{}, - // enabled: true, + print: func(rsp proto.Message) { + out := rsp.(*pb.HeroListRsp) + for i, v := range out.List { + fmt.Printf("%d- %v\n", (i + 1), v) + } + }, + // enabled: true, }, { mainType: string(comm.ModuleHero), subType: hero.HeroSubTypeInfo, @@ -26,9 +35,34 @@ var ( }, { mainType: string(comm.ModuleHero), subType: hero.HeroSubTypeChouka, - req: &pb.HeroChoukaReq{}, - rsp: &pb.HeroChoukaResp{}, - enabled: true, + req: &pb.HeroChoukaReq{ + HeroIds: []int32{42911}, + }, + rsp: &pb.HeroChoukaResp{}, + // enabled: true, + }, { + mainType: string(comm.ModuleHero), + subType: hero.StrengthenUpStar, + req: &pb.HeroStrengthenUpStarReq{ + HeroObjID: "62bd0489ff6632434a7d0d1f", + Hero: []*pb.CostCardData{ + { + CostCardObj: "", + }, + }, + }, + rsp: &pb.HeroStrengthenUpStarResp{}, + // enabled: true, + }, { + mainType: string(comm.ModuleHero), + subType: hero.StrengthenUplv, + req: &pb.HeroStrengthenUplvReq{ + HeroObjID: "62bd0489ff6632434a7d0d1f", + ExpCardID: "62bd0b4eca37634b8230d4be", + Amount: 1, + }, + rsp: &pb.HeroStrengthenUplvResp{}, + enabled: true, }, } ) diff --git a/cmd/robot/robot.go b/cmd/robot/robot.go index 8f6ca73ce..2cd33221a 100644 --- a/cmd/robot/robot.go +++ b/cmd/robot/robot.go @@ -75,6 +75,7 @@ type builder struct { enabled bool start time.Time requested bool //请求标识 true已发 + print func(rsp proto.Message) } func (r *Robot) addBuilders(builders []*builder) { @@ -109,7 +110,13 @@ func (r *Robot) handleRsp(msg *pb.UserMessage) { if !comm.ProtoUnmarshal(msg, b.rsp) { return } - printReply(msg, b) + if b.print == nil { + printReply(msg, b) + } else { + fmt.Printf("===== rsp [%s.%s] =====\n", msg.MainType, msg.SubType) + b.print(b.rsp) + fmt.Println("==============================") + } if msg.MainType == "user" && msg.SubType == "login" { r.loginCallback(b.rsp) diff --git a/cmd/robot/user.go b/cmd/robot/user.go index 3ede6b8ab..35a00148e 100644 --- a/cmd/robot/user.go +++ b/cmd/robot/user.go @@ -13,7 +13,7 @@ var user_builders = []*builder{ mainType: string(comm.ModuleUser), subType: user.UserSubTypeCreate, req: &pb.UserCreateReq{ //设置请求参数 - NickName: "乐谷62911", + NickName: "乐谷6301", }, rsp: &pb.UserCreateRsp{}, // enabled: true, From 65560dfa5cfe2ed9fd06b585f7fe890d152dcfcc Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 30 Jun 2022 13:39:28 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_resonance.go | 4 ++-- modules/hero/api_resonanceReset.go | 2 +- modules/hero/api_resonanceSelect.go | 2 +- modules/hero/api_skillUp.go | 4 ++-- modules/hero/api_starUp.go | 6 +++--- modules/hero/api_strengthen.go | 23 ++++++++++++++--------- modules/hero/module.go | 4 ++-- 7 files changed, 25 insertions(+), 20 deletions(-) diff --git a/modules/hero/api_resonance.go b/modules/hero/api_resonance.go index 1ebaf27f6..088cb5534 100644 --- a/modules/hero/api_resonance.go +++ b/modules/hero/api_resonance.go @@ -17,12 +17,12 @@ func (this *apiComp) ResonanceCheck(session comm.IUserSession, req *pb.HeroReson bCheckOk bool ) bCheckOk = false - _hero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在 + _hero, err := this.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在 if err != 0 { code.Code = pb.ErrorCode_HeroNoExist return } - _costHero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), req.CostObjID) // 查询消耗卡是否存在 + _costHero, err := this.moduleHero.GetHero(session.GetUserId(), req.CostObjID) // 查询消耗卡是否存在 if err != 0 { code.Code = pb.ErrorCode_HeroNoExist return diff --git a/modules/hero/api_resonanceReset.go b/modules/hero/api_resonanceReset.go index 6fa264b0f..70616061c 100644 --- a/modules/hero/api_resonanceReset.go +++ b/modules/hero/api_resonanceReset.go @@ -13,7 +13,7 @@ func (this *apiComp) ResonanceResetCheck(session comm.IUserSession, req *pb.Hero code.Code = pb.ErrorCode_ReqParameterError return } - _hero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在 + _hero, err := this.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在 if err != 0 { code.Code = pb.ErrorCode_HeroNoExist return diff --git a/modules/hero/api_resonanceSelect.go b/modules/hero/api_resonanceSelect.go index a2a32db77..1cd398f4e 100644 --- a/modules/hero/api_resonanceSelect.go +++ b/modules/hero/api_resonanceSelect.go @@ -12,7 +12,7 @@ func (this *apiComp) ResonanceUseEnergyCheck(session comm.IUserSession, req *pb. code.Code = pb.ErrorCode_ReqParameterError return } - _hero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在 + _hero, err := this.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在 if err != 0 { code.Code = pb.ErrorCode_HeroNoExist return diff --git a/modules/hero/api_skillUp.go b/modules/hero/api_skillUp.go index 08cccaf07..f3349e347 100644 --- a/modules/hero/api_skillUp.go +++ b/modules/hero/api_skillUp.go @@ -19,12 +19,12 @@ func (this *apiComp) StrengthenUpSkillCheck(session comm.IUserSession, req *pb.H tagColor int32 costColor int32 ) - _hero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在 + _hero, err := this.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在 if err != 0 { code.Code = pb.ErrorCode_HeroNoExist return } - _costHero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), req.CostCardObj) // 查询消耗卡是否存在 + _costHero, err := this.moduleHero.GetHero(session.GetUserId(), req.CostCardObj) // 查询消耗卡是否存在 if err != 0 { code.Code = pb.ErrorCode_HeroNoExist return diff --git a/modules/hero/api_starUp.go b/modules/hero/api_starUp.go index ce513b89b..4a6e65f1b 100644 --- a/modules/hero/api_starUp.go +++ b/modules/hero/api_starUp.go @@ -20,7 +20,7 @@ func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.He costRaceCount int32 curGold int32 ) - tagHero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) + tagHero, err := this.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) if err != 0 { code.Code = pb.ErrorCode_HeroNoExist return @@ -42,7 +42,7 @@ func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.He } // 指定英雄消耗校验 for _, v := range req.Hero { - if tagHero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), v.CostCardObj); err != 0 { + if tagHero, err := this.moduleHero.GetHero(session.GetUserId(), v.CostCardObj); err != 0 { code.Code = pb.ErrorCode_ReqParameterError return } else { @@ -59,7 +59,7 @@ func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.He } // 校验阵容英雄消耗 for _, v := range req.HeroRace { - if raceHero, err = this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), v.CostCardObj); err != 0 { + if raceHero, err = this.moduleHero.GetHero(session.GetUserId(), v.CostCardObj); err != 0 { code.Code = pb.ErrorCode_ReqParameterError return } else { diff --git a/modules/hero/api_strengthen.go b/modules/hero/api_strengthen.go index 8b5e51cfd..1c7e08c3c 100644 --- a/modules/hero/api_strengthen.go +++ b/modules/hero/api_strengthen.go @@ -21,13 +21,13 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero //atn = map[string]interface{}{} ) - _hero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 校验升级的对象是否存在 + _hero, err := this.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 校验升级的对象是否存在 if err != 0 { code.Code = pb.ErrorCode_HeroNoExist return } - _expHero, err := this.moduleHero.modelHero.moduleHero.GetHero(session.GetUserId(), req.ExpCardID) // 校验需要消耗经验卡牌的对象是否存在 + _expHero, err := this.moduleHero.GetHero(session.GetUserId(), req.ExpCardID) // 校验需要消耗经验卡牌的对象是否存在 if err != 0 { code.Code = pb.ErrorCode_HeroNoExist @@ -45,7 +45,7 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero if expConf != nil { addExp = expConf.Heroexp * req.Amount } - if _expHero.SameCount <= req.Amount { // 消耗经验卡片数量不足 + if _expHero.SameCount < req.Amount { // 消耗经验卡片数量不足 code.Code = pb.ErrorCode_HeroNoEnough return } @@ -60,14 +60,14 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero maxLv = _hero.Star * comm.HeroStarLvRatio _data := this.moduleHero.configure.GetHeroLv(curLv) if _data != nil { - if maxLv >= _hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级 + if maxLv <= _hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级 code.Code = pb.ErrorCode_HeroMaxLv return } curExp += addExp // 先把经验加上 for { // 死循环判断一键升级 - if maxLv >= _hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级 + if maxLv <= _hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级 curLv = maxLv curExp = _data.Heroexp[0].N break @@ -88,7 +88,7 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero // 金币消耗判断 curGold = this.user.QueryAttributeValue(session.GetUserId(), "gold") if curGold < costGold { - code.Code = pb.ErrorCode_GoldNoEnough + // code.Code = pb.ErrorCode_GoldNoEnough } } else { code.Code = pb.ErrorCode_HeroNoExist @@ -133,7 +133,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]i }() log.Debugf("升级后当前等级: %d,经验: %d,需要消耗的金币: %d,增加的经验: %d", curLv, curExp, costGold, addExp) // 执行升级逻辑 - code = this.moduleHero.modelHero.moduleHero.AddCardExp(session.GetUserId(), req.HeroObjID, addExp) // 加经验 + code = this.moduleHero.AddCardExp(session.GetUserId(), req.HeroObjID, addExp) // 加经验 if code != pb.ErrorCode_Success { return } @@ -143,11 +143,16 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]i return } // 删除经验卡 - code = this.moduleHero.modelHero.moduleHero.DelCard(req.ExpCardID, req.Amount) + err := this.moduleHero.modelHero.DelListlds(session.GetUserId(), req.ExpCardID) + if err != nil { + log.Errorf("delete err failed err:%T!", err) + return + } + //code = this.moduleHero.modelHero.moduleHero.DelCard(req.ExpCardID, req.Amount) if code != pb.ErrorCode_Success { return } - err := this.moduleHero.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化 + err = this.moduleHero.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化 if err != nil { log.Errorf("PushHeroProperty err!") } diff --git a/modules/hero/module.go b/modules/hero/module.go index f64cb9880..9e033c60b 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -124,14 +124,14 @@ func (this *Hero) AddCardExp(uid string, heroId string, exp int32) (code pb.Erro maxLv = _hero.Star * comm.HeroStarLvRatio _data := this.configure.GetHeroLv(curLv) if _data != nil { - if maxLv >= _hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级 + if maxLv <= _hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级 code = pb.ErrorCode_HeroMaxLv return } curExp += exp // 先把经验加上 for { // 死循环判断一键升级 - if maxLv >= _hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级 + if maxLv <= _hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级 curLv = maxLv curExp = _data.Heroexp[0].N break