From 1a560f9ab7b0e19cd1c8971df80b568f2fd202af Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 30 May 2023 17:47:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?map=20=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_awaken.go | 1 + modules/hunting/model_hunting.go | 1 + modules/viking/model_viking.go | 1 + 3 files changed, 3 insertions(+) diff --git a/modules/hero/api_awaken.go b/modules/hero/api_awaken.go index dc97a32bd..2e54eaf39 100644 --- a/modules/hero/api_awaken.go +++ b/modules/hero/api_awaken.go @@ -41,6 +41,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c awakenData, err = this.module.configure.GetHeroAwakenConfig(_hero.HeroID, _hero.JuexingLv+1) if err != nil { + data = &pb.ErrorData{} code = pb.ErrorCode_ConfigNoFound data.Message = err.Error() return diff --git a/modules/hunting/model_hunting.go b/modules/hunting/model_hunting.go index 04672c07f..699f76c9a 100644 --- a/modules/hunting/model_hunting.go +++ b/modules/hunting/model_hunting.go @@ -42,6 +42,7 @@ func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err Uid: uid, Boss: make(map[int32]int32), BossTime: make(map[string]int32), + Ps: map[int32]int32{}, } this.Add(uid, result) diff --git a/modules/viking/model_viking.go b/modules/viking/model_viking.go index 792e46520..140dda568 100644 --- a/modules/viking/model_viking.go +++ b/modules/viking/model_viking.go @@ -37,6 +37,7 @@ func (this *modelViking) getVikingList(uid string) (result *pb.DBViking, err err Uid: uid, Boss: make(map[int32]int32), BossTime: make(map[string]int32), + Ps: make(map[int32]int32), } err = nil this.module.modelViking.Add(uid, result) From bd4d8504b968460890012e3aeb291c6279931831 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 30 May 2023 17:59:45 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/atlas/api_atlasactivate.go | 2 +- modules/caravan/api_buyorsell.go | 2 ++ modules/caravan/api_getlist.go | 1 + modules/caravan/api_getstory.go | 1 + modules/caravan/api_gotocity.go | 1 + modules/enchant/api_challenge.go | 2 +- modules/enchant/api_challengeover.go | 1 + modules/gourmet/api_activateatlas.go | 2 +- modules/gourmet/api_createfood.go | 1 + modules/hero/api_awaken.go | 1 + modules/hero/api_buy.go | 1 + modules/hero/api_drawCard.go | 1 + modules/hero/api_fusion.go | 1 + modules/hero/api_strengthenUpSkill.go | 2 +- modules/hero/api_strengthenUpStar.go | 2 +- modules/hero/api_strengthenUplv.go | 1 + modules/hero/api_talentlearn.go | 1 + modules/hero/api_talentreset.go | 1 + modules/library/api_getstoryreward.go | 1 + modules/library/api_lvreward.go | 2 +- modules/library/api_usegift.go | 1 + modules/mline/api_getlist.go | 2 +- 22 files changed, 23 insertions(+), 7 deletions(-) diff --git a/modules/atlas/api_atlasactivate.go b/modules/atlas/api_atlasactivate.go index faf8a5bba..ce5755448 100644 --- a/modules/atlas/api_atlasactivate.go +++ b/modules/atlas/api_atlasactivate.go @@ -18,7 +18,7 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateRe if code = this.ActivateCheck(session, req); code != pb.ErrorCode_Success { return } - + data = &pb.ErrorData{} atlasConf, err := this.module.configure.GetPandoAtlasConf(req.Id) if err != nil { code = pb.ErrorCode_ConfigNoFound // 返回错误码 diff --git a/modules/caravan/api_buyorsell.go b/modules/caravan/api_buyorsell.go index 4c1f582a6..2cb3b1508 100644 --- a/modules/caravan/api_buyorsell.go +++ b/modules/caravan/api_buyorsell.go @@ -21,7 +21,9 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe cityInfo *pb.CityInfo ok bool upperLimit int32 // 单个物品堆叠上限 + ) + data = &pb.ErrorData{} update = make(map[string]interface{}) if code = this.BuyOrSellCheck(session, req); code != pb.ErrorCode_Success { return // 参数校验失败直接返回 diff --git a/modules/caravan/api_getlist.go b/modules/caravan/api_getlist.go index ebcd1b235..97bb83d21 100644 --- a/modules/caravan/api_getlist.go +++ b/modules/caravan/api_getlist.go @@ -17,6 +17,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListRe var ( resp *pb.CaravanGetListResp ) + data = &pb.ErrorData{} resp = &pb.CaravanGetListResp{} if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success { return // 参数校验失败直接返回 diff --git a/modules/caravan/api_getstory.go b/modules/caravan/api_getstory.go index 8e6fdd100..b0041e431 100644 --- a/modules/caravan/api_getstory.go +++ b/modules/caravan/api_getstory.go @@ -20,6 +20,7 @@ func (this *apiComp) GetStory(session comm.IUserSession, req *pb.CaravanGetStory update map[string]interface{} bAccept bool ) + data = &pb.ErrorData{} resp = &pb.CaravanGetStoryResp{} update = make(map[string]interface{}) if code = this.GetStoryCheck(session, req); code != pb.ErrorCode_Success { diff --git a/modules/caravan/api_gotocity.go b/modules/caravan/api_gotocity.go index bc88ab269..15f650857 100644 --- a/modules/caravan/api_gotocity.go +++ b/modules/caravan/api_gotocity.go @@ -21,6 +21,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity res *cfg.Gameatn bNewTask bool ) + data = &pb.ErrorData{} resp = &pb.CaravanGotoCityResp{} bNewTask = false if code = this.GotoCityCheck(session, req); code != pb.ErrorCode_Success { diff --git a/modules/enchant/api_challenge.go b/modules/enchant/api_challenge.go index 313007850..35b76dcb1 100644 --- a/modules/enchant/api_challenge.go +++ b/modules/enchant/api_challenge.go @@ -22,7 +22,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } - + data = &pb.ErrorData{} enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId()) if err != nil { code = pb.ErrorCode_PagodaNotFound diff --git a/modules/enchant/api_challengeover.go b/modules/enchant/api_challengeover.go index 3083dacd9..712c3dc92 100644 --- a/modules/enchant/api_challengeover.go +++ b/modules/enchant/api_challengeover.go @@ -21,6 +21,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha bWin bool // 战斗是否胜利 score int32 // 通关获得分数 ) + data = &pb.ErrorData{} mapData = make(map[string]interface{}, 0) // reward = make([]*cfg.Gameatn, 0) code = this.ChallengeOverCheck(session, req) diff --git a/modules/gourmet/api_activateatlas.go b/modules/gourmet/api_activateatlas.go index 24f1657dc..bc7a78f7d 100644 --- a/modules/gourmet/api_activateatlas.go +++ b/modules/gourmet/api_activateatlas.go @@ -16,7 +16,7 @@ func (this *apiComp) ActivateAtlasCheck(session comm.IUserSession, req *pb.Gourm } func (this *apiComp) ActivateAtlas(session comm.IUserSession, req *pb.GourmetActivateAtlasReq) (code pb.ErrorCode, data *pb.ErrorData) { - + data = &pb.ErrorData{} code = this.ActivateAtlasCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 diff --git a/modules/gourmet/api_createfood.go b/modules/gourmet/api_createfood.go index cb5fa4920..16fd32867 100644 --- a/modules/gourmet/api_createfood.go +++ b/modules/gourmet/api_createfood.go @@ -21,6 +21,7 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate curFood string // 做出来的食物ID bFirst bool // 是否首次获得 ) + data = &pb.ErrorData{} code = this.CreateFoodCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 diff --git a/modules/hero/api_awaken.go b/modules/hero/api_awaken.go index 2e54eaf39..6dada3496 100644 --- a/modules/hero/api_awaken.go +++ b/modules/hero/api_awaken.go @@ -28,6 +28,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c err error bManAwaken bool // 是否达到满级共鸣 ) + data = &pb.ErrorData{} _heroMap = make(map[string]interface{}, 0) chanegCard = make([]*pb.DBHero, 0) code = this.AwakenCheck(session, req) // check diff --git a/modules/hero/api_buy.go b/modules/hero/api_buy.go index d6683b2d6..b32410615 100644 --- a/modules/hero/api_buy.go +++ b/modules/hero/api_buy.go @@ -31,6 +31,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb udata *pb.DBUser tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) + data = &pb.ErrorData{} update = make(map[string]interface{}) if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success { return diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index d40e9c611..cfbea41ed 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -33,6 +33,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq update map[string]interface{} normalDraw bool // 是否是普通抽 ) + data = &pb.ErrorData{} update = make(map[string]interface{}) cfgDraw = this.module.ModuleTools.GetGlobalConf() // 读取抽卡配置文件 if cfgDraw == nil { diff --git a/modules/hero/api_fusion.go b/modules/hero/api_fusion.go index ce63d6807..e2211ab49 100644 --- a/modules/hero/api_fusion.go +++ b/modules/hero/api_fusion.go @@ -22,6 +22,7 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c _costMaphero map[string]*pb.DBHero ChangeList []*pb.DBHero // 变化的英雄数据 ) + data = &pb.ErrorData{} ChangeList = make([]*pb.DBHero, 0) _costMaphero = make(map[string]*pb.DBHero, 0) mapHero = make(map[string]int32) diff --git a/modules/hero/api_strengthenUpSkill.go b/modules/hero/api_strengthenUpSkill.go index 488ad1085..0860423d9 100644 --- a/modules/hero/api_strengthenUpSkill.go +++ b/modules/hero/api_strengthenUpSkill.go @@ -25,7 +25,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt cost []*cfg.Gameatn // 技能升级消耗 lvUpCount int32 // 技能升级的次数 ) - + data = &pb.ErrorData{} code = this.StrengthenUpSkillCheck(session, req) // check if code != pb.ErrorCode_Success { return diff --git a/modules/hero/api_strengthenUpStar.go b/modules/hero/api_strengthenUpStar.go index f1d05126f..6631b2907 100644 --- a/modules/hero/api_strengthenUpStar.go +++ b/modules/hero/api_strengthenUpStar.go @@ -23,7 +23,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr _hero *pb.DBHero // 目标英雄 err error ) - + data = &pb.ErrorData{} code = this.StrengthenUpStarCheck(session, req) // check if code != pb.ErrorCode_Success { return diff --git a/modules/hero/api_strengthenUplv.go b/modules/hero/api_strengthenUplv.go index 58ce429dc..29415ff38 100644 --- a/modules/hero/api_strengthenUplv.go +++ b/modules/hero/api_strengthenUplv.go @@ -25,6 +25,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren _hero *pb.DBHero // 目标英雄 cost []*cfg.Gameatn // 消耗的道具 ) + data = &pb.ErrorData{} code = this.StrengthenUplvCheck(session, req) // check if code != pb.ErrorCode_Success { return diff --git a/modules/hero/api_talentlearn.go b/modules/hero/api_talentlearn.go index a720d4d6e..f927969a7 100644 --- a/modules/hero/api_talentlearn.go +++ b/modules/hero/api_talentlearn.go @@ -23,6 +23,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe chanegCard []*pb.DBHero // 推送属性变化 res []*cfg.Gameatn // 学习天赋需要消耗的道具 ) + data = &pb.ErrorData{} chanegCard = make([]*pb.DBHero, 0) if code = this.TalentLearnCheck(session, req); code != pb.ErrorCode_Success { return diff --git a/modules/hero/api_talentreset.go b/modules/hero/api_talentreset.go index dcba69038..07168b24f 100644 --- a/modules/hero/api_talentreset.go +++ b/modules/hero/api_talentreset.go @@ -20,6 +20,7 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe chanegCard []*pb.DBHero // 推送属性变化 talentPoint int32 // 已经消耗的天赋点数 ) + data = &pb.ErrorData{} if code = this.TalentResetCheck(session, req); code != pb.ErrorCode_Success { return } diff --git a/modules/library/api_getstoryreward.go b/modules/library/api_getstoryreward.go index 1d4359fbc..2c6a7344d 100644 --- a/modules/library/api_getstoryreward.go +++ b/modules/library/api_getstoryreward.go @@ -22,6 +22,7 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe var ( update map[string]interface{} ) + data = &pb.ErrorData{} update = make(map[string]interface{}, 0) resp := &pb.LibraryGetStoryRewardResp{} code = this.GetStoryRewardCheck(session, req) diff --git a/modules/library/api_lvreward.go b/modules/library/api_lvreward.go index 50732dbc3..371cf6946 100644 --- a/modules/library/api_lvreward.go +++ b/modules/library/api_lvreward.go @@ -19,7 +19,7 @@ func (this *apiComp) LvRewardCheck(session comm.IUserSession, req *pb.LibraryLvR // 英雄回礼 func (this *apiComp) LvReward(session comm.IUserSession, req *pb.LibraryLvRewardReq) (code pb.ErrorCode, data *pb.ErrorData) { - + data = &pb.ErrorData{} resp := &pb.LibraryLvRewardResp{} code = this.LvRewardCheck(session, req) if code != pb.ErrorCode_Success { diff --git a/modules/library/api_usegift.go b/modules/library/api_usegift.go index a00237f8e..0c02bdcf1 100644 --- a/modules/library/api_usegift.go +++ b/modules/library/api_usegift.go @@ -27,6 +27,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe addExp int32 // 获得的经验 sCount int32 // 赠送开始次数 ) + data = &pb.ErrorData{} attenuation = make(map[int32]int32, 0) code = this.UseGiftCheck(session, req) if code != pb.ErrorCode_Success { diff --git a/modules/mline/api_getlist.go b/modules/mline/api_getlist.go index 9b78c10d5..a81bf2155 100644 --- a/modules/mline/api_getlist.go +++ b/modules/mline/api_getlist.go @@ -18,7 +18,7 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.MlineGetLis ///获取主线关卡信息 func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq) (code pb.ErrorCode, data *pb.ErrorData) { rsp := &pb.MlineGetListResp{} - + data = &pb.ErrorData{} code = this.GetListCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 From a99388c5f8a8c8fe47f772a21eecb36b8f1b7e4d Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 30 May 2023 18:32:34 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/atlas/api_atlasactivate.go | 7 +++++-- modules/caravan/api_buyorsell.go | 21 ++++++++++++++++----- modules/caravan/api_getlist.go | 6 ++++-- modules/caravan/api_getstory.go | 6 ++++-- modules/caravan/api_gotocity.go | 11 ++++++++--- modules/enchant/api_challenge.go | 6 ++++-- modules/enchant/api_challengeover.go | 6 ++++-- modules/gourmet/api_activateatlas.go | 7 +++++-- modules/gourmet/api_createfood.go | 6 ++++-- modules/hero/api_awaken.go | 12 ++++++++---- modules/hero/api_buy.go | 6 ++++-- modules/hero/api_drawCard.go | 6 ++++-- modules/hero/api_fusion.go | 6 ++++-- modules/hero/api_strengthenUpSkill.go | 11 ++++++++--- modules/hero/api_strengthenUpStar.go | 11 ++++++++--- modules/hero/api_strengthenUplv.go | 6 ++++-- modules/hero/api_talentlearn.go | 7 +++++-- modules/hero/api_talentreset.go | 6 ++++-- modules/library/api_getstoryreward.go | 6 ++++-- modules/library/api_lvreward.go | 7 +++++-- modules/library/api_usegift.go | 16 ++++++++++++---- modules/mline/api_getlist.go | 7 +++++-- modules/practice/api_upgrade.go | 16 ++++------------ modules/viking/api_challengeover.go | 2 +- 24 files changed, 134 insertions(+), 67 deletions(-) diff --git a/modules/atlas/api_atlasactivate.go b/modules/atlas/api_atlasactivate.go index ce5755448..e654b289e 100644 --- a/modules/atlas/api_atlasactivate.go +++ b/modules/atlas/api_atlasactivate.go @@ -18,11 +18,14 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateRe if code = this.ActivateCheck(session, req); code != pb.ErrorCode_Success { return } - data = &pb.ErrorData{} + atlasConf, err := this.module.configure.GetPandoAtlasConf(req.Id) if err != nil { code = pb.ErrorCode_ConfigNoFound // 返回错误码 - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } list, _ := this.module.modelPandaAtlas.getPandaAtlasList(session.GetUserId()) diff --git a/modules/caravan/api_buyorsell.go b/modules/caravan/api_buyorsell.go index 2cb3b1508..e893aca73 100644 --- a/modules/caravan/api_buyorsell.go +++ b/modules/caravan/api_buyorsell.go @@ -23,7 +23,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe upperLimit int32 // 单个物品堆叠上限 ) - data = &pb.ErrorData{} update = make(map[string]interface{}) if code = this.BuyOrSellCheck(session, req); code != pb.ErrorCode_Success { return // 参数校验失败直接返回 @@ -39,7 +38,10 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe if err == nil { upperLimit = c.Bagtagnum // 获取单个格子堆叠数 } else { - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } code = pb.ErrorCode_ConfigNoFound return } @@ -64,7 +66,10 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe price = cityConf.Specialnum * price / 1000 bFound = true } else { - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } code = pb.ErrorCode_ConfigNoFound return } @@ -101,7 +106,10 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe update["lv"] = curLv update["baglimit"] = c.Bagtop } else { - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } code = pb.ErrorCode_ConfigNoFound return } @@ -151,7 +159,10 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe update["city"] = caravan.City addScore -= price * v } else { - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } code = pb.ErrorCode_ConfigNoFound return } diff --git a/modules/caravan/api_getlist.go b/modules/caravan/api_getlist.go index 97bb83d21..680328b61 100644 --- a/modules/caravan/api_getlist.go +++ b/modules/caravan/api_getlist.go @@ -17,7 +17,6 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListRe var ( resp *pb.CaravanGetListResp ) - data = &pb.ErrorData{} resp = &pb.CaravanGetListResp{} if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success { return // 参数校验失败直接返回 @@ -28,7 +27,10 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListRe if conf, err := this.module.configure.GetCaravanLv(list.Lv); err == nil { this.module.ModuleItems.CleanItemById(session, conf.Tickettop.T) // 清理之前的门票数据 } else { - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } code = pb.ErrorCode_ConfigNoFound return } diff --git a/modules/caravan/api_getstory.go b/modules/caravan/api_getstory.go index b0041e431..2ddd68a89 100644 --- a/modules/caravan/api_getstory.go +++ b/modules/caravan/api_getstory.go @@ -20,7 +20,6 @@ func (this *apiComp) GetStory(session comm.IUserSession, req *pb.CaravanGetStory update map[string]interface{} bAccept bool ) - data = &pb.ErrorData{} resp = &pb.CaravanGetStoryResp{} update = make(map[string]interface{}) if code = this.GetStoryCheck(session, req); code != pb.ErrorCode_Success { @@ -30,7 +29,10 @@ func (this *apiComp) GetStory(session comm.IUserSession, req *pb.CaravanGetStory conf, err := this.module.configure.GetCaravanEventById(req.Cid) if err != nil { - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } code = pb.ErrorCode_ConfigNoFound return } diff --git a/modules/caravan/api_gotocity.go b/modules/caravan/api_gotocity.go index 15f650857..a7f8f4165 100644 --- a/modules/caravan/api_gotocity.go +++ b/modules/caravan/api_gotocity.go @@ -21,7 +21,6 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity res *cfg.Gameatn bNewTask bool ) - data = &pb.ErrorData{} resp = &pb.CaravanGotoCityResp{} bNewTask = false if code = this.GotoCityCheck(session, req); code != pb.ErrorCode_Success { @@ -43,7 +42,10 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity bNewTask = false } } else { - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } code = pb.ErrorCode_ConfigNoFound return } @@ -74,7 +76,10 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity N: req.Ticket, } } else { - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } code = pb.ErrorCode_ConfigNoFound return } diff --git a/modules/enchant/api_challenge.go b/modules/enchant/api_challenge.go index 35b76dcb1..d7a9d362d 100644 --- a/modules/enchant/api_challenge.go +++ b/modules/enchant/api_challenge.go @@ -22,7 +22,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } - data = &pb.ErrorData{} enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId()) if err != nil { code = pb.ErrorCode_PagodaNotFound @@ -32,7 +31,10 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen cfgData, err := this.module.configure.GetEnchantBossConfigData(req.BossType) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } if len(cfgData) <= 0 { diff --git a/modules/enchant/api_challengeover.go b/modules/enchant/api_challengeover.go index 712c3dc92..769c47ea4 100644 --- a/modules/enchant/api_challengeover.go +++ b/modules/enchant/api_challengeover.go @@ -21,7 +21,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha bWin bool // 战斗是否胜利 score int32 // 通关获得分数 ) - data = &pb.ErrorData{} mapData = make(map[string]interface{}, 0) // reward = make([]*cfg.Gameatn, 0) code = this.ChallengeOverCheck(session, req) @@ -38,7 +37,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha cfgEnchant, err := this.module.configure.GetEnchantBossConfigData(req.BossType) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } diff --git a/modules/gourmet/api_activateatlas.go b/modules/gourmet/api_activateatlas.go index bc7a78f7d..35f8d19ad 100644 --- a/modules/gourmet/api_activateatlas.go +++ b/modules/gourmet/api_activateatlas.go @@ -16,7 +16,7 @@ func (this *apiComp) ActivateAtlasCheck(session comm.IUserSession, req *pb.Gourm } func (this *apiComp) ActivateAtlas(session comm.IUserSession, req *pb.GourmetActivateAtlasReq) (code pb.ErrorCode, data *pb.ErrorData) { - data = &pb.ErrorData{} + code = this.ActivateAtlasCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 @@ -24,7 +24,10 @@ func (this *apiComp) ActivateAtlas(session comm.IUserSession, req *pb.GourmetAct conf, err := this.configure.GetGrormetCookBookConf(req.Cid) if err != nil { // 配置校验 code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } _gourmet, err := this.module.modelAtlas.getGourmetAtlasList(session.GetUserId()) diff --git a/modules/gourmet/api_createfood.go b/modules/gourmet/api_createfood.go index 16fd32867..55984ee4d 100644 --- a/modules/gourmet/api_createfood.go +++ b/modules/gourmet/api_createfood.go @@ -21,7 +21,6 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate curFood string // 做出来的食物ID bFirst bool // 是否首次获得 ) - data = &pb.ErrorData{} code = this.CreateFoodCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 @@ -29,7 +28,10 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate conf, err := this.configure.GetGrormetCookBookConf(req.Cid) if err != nil { // 配置校验 code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } diff --git a/modules/hero/api_awaken.go b/modules/hero/api_awaken.go index 6dada3496..52d92669a 100644 --- a/modules/hero/api_awaken.go +++ b/modules/hero/api_awaken.go @@ -28,7 +28,6 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c err error bManAwaken bool // 是否达到满级共鸣 ) - data = &pb.ErrorData{} _heroMap = make(map[string]interface{}, 0) chanegCard = make([]*pb.DBHero, 0) code = this.AwakenCheck(session, req) // check @@ -42,9 +41,11 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c awakenData, err = this.module.configure.GetHeroAwakenConfig(_hero.HeroID, _hero.JuexingLv+1) if err != nil { - data = &pb.ErrorData{} code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } if len(awakenData.Phasebonus) < 2 { // 配置校验 @@ -142,7 +143,10 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c } else { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...) diff --git a/modules/hero/api_buy.go b/modules/hero/api_buy.go index b32410615..149c1ab25 100644 --- a/modules/hero/api_buy.go +++ b/modules/hero/api_buy.go @@ -31,7 +31,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb udata *pb.DBUser tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) ) - data = &pb.ErrorData{} update = make(map[string]interface{}) if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success { return @@ -43,7 +42,10 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb if conf, err = this.module.configure.GetShopItemsConfigureByGroups(req.BuyType, udata); err != nil { // 找配置 code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index cfbea41ed..59c461bba 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -33,7 +33,6 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq update map[string]interface{} normalDraw bool // 是否是普通抽 ) - data = &pb.ErrorData{} update = make(map[string]interface{}) cfgDraw = this.module.ModuleTools.GetGlobalConf() // 读取抽卡配置文件 if cfgDraw == nil { @@ -270,7 +269,10 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq _data, err := this.module.configure.GetPollByType(strPool[index]) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } sz := make([]int32, 0) diff --git a/modules/hero/api_fusion.go b/modules/hero/api_fusion.go index e2211ab49..a26febedc 100644 --- a/modules/hero/api_fusion.go +++ b/modules/hero/api_fusion.go @@ -22,7 +22,6 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c _costMaphero map[string]*pb.DBHero ChangeList []*pb.DBHero // 变化的英雄数据 ) - data = &pb.ErrorData{} ChangeList = make([]*pb.DBHero, 0) _costMaphero = make(map[string]*pb.DBHero, 0) mapHero = make(map[string]int32) @@ -32,7 +31,10 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c conf, err := this.module.configure.GetHeroFucionConfig(req.HeroId) if err != nil { code = pb.ErrorCode_ConfigNoFound // 配置没找到 - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } for _, v := range req.Heros { diff --git a/modules/hero/api_strengthenUpSkill.go b/modules/hero/api_strengthenUpSkill.go index 0860423d9..539eb863a 100644 --- a/modules/hero/api_strengthenUpSkill.go +++ b/modules/hero/api_strengthenUpSkill.go @@ -25,7 +25,6 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt cost []*cfg.Gameatn // 技能升级消耗 lvUpCount int32 // 技能升级的次数 ) - data = &pb.ErrorData{} code = this.StrengthenUpSkillCheck(session, req) // check if code != pb.ErrorCode_Success { return @@ -38,7 +37,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt heroCfg, err := this.module.configure.GetHeroConfig(_hero.HeroID) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } for _, v1 := range req.Item { @@ -80,7 +82,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt skillData, err := this.module.configure.GetHeroSkillUpConfig(skill.SkillID) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } sz = append(sz, skillData.Probability[skill.SkillLv]) diff --git a/modules/hero/api_strengthenUpStar.go b/modules/hero/api_strengthenUpStar.go index 6631b2907..1299bcfef 100644 --- a/modules/hero/api_strengthenUpStar.go +++ b/modules/hero/api_strengthenUpStar.go @@ -23,7 +23,6 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr _hero *pb.DBHero // 目标英雄 err error ) - data = &pb.ErrorData{} code = this.StrengthenUpStarCheck(session, req) // check if code != pb.ErrorCode_Success { return @@ -37,13 +36,19 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr starConf, err = this.module.configure.GetHeroStarupConfig(_hero.HeroID, _hero.Star) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } heroConf, err := this.module.configure.GetHeroConfig(_hero.HeroID) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } nextHeroConfig, _ := this.module.configure.GetHeroStarupConfig(_hero.HeroID, _hero.Star+1) diff --git a/modules/hero/api_strengthenUplv.go b/modules/hero/api_strengthenUplv.go index 29415ff38..04f024657 100644 --- a/modules/hero/api_strengthenUplv.go +++ b/modules/hero/api_strengthenUplv.go @@ -25,7 +25,6 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren _hero *pb.DBHero // 目标英雄 cost []*cfg.Gameatn // 消耗的道具 ) - data = &pb.ErrorData{} code = this.StrengthenUplvCheck(session, req) // check if code != pb.ErrorCode_Success { return @@ -50,7 +49,10 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren costGold += expConf.Needgold * v } else { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } } diff --git a/modules/hero/api_talentlearn.go b/modules/hero/api_talentlearn.go index f927969a7..3e4c416a7 100644 --- a/modules/hero/api_talentlearn.go +++ b/modules/hero/api_talentlearn.go @@ -23,7 +23,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe chanegCard []*pb.DBHero // 推送属性变化 res []*cfg.Gameatn // 学习天赋需要消耗的道具 ) - data = &pb.ErrorData{} + chanegCard = make([]*pb.DBHero, 0) if code = this.TalentLearnCheck(session, req); code != pb.ErrorCode_Success { return @@ -62,7 +62,10 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe talentConf, err := this.module.configure.GetHeroTalent(req.TalentID) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } // 校验 diff --git a/modules/hero/api_talentreset.go b/modules/hero/api_talentreset.go index 07168b24f..6a8a47032 100644 --- a/modules/hero/api_talentreset.go +++ b/modules/hero/api_talentreset.go @@ -20,7 +20,6 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe chanegCard []*pb.DBHero // 推送属性变化 talentPoint int32 // 已经消耗的天赋点数 ) - data = &pb.ErrorData{} if code = this.TalentResetCheck(session, req); code != pb.ErrorCode_Success { return } @@ -47,7 +46,10 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe talentPoint += conf.Point // 获取当前英雄的天赋点数 } else { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } } diff --git a/modules/library/api_getstoryreward.go b/modules/library/api_getstoryreward.go index 2c6a7344d..c7f289d40 100644 --- a/modules/library/api_getstoryreward.go +++ b/modules/library/api_getstoryreward.go @@ -22,7 +22,6 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe var ( update map[string]interface{} ) - data = &pb.ErrorData{} update = make(map[string]interface{}, 0) resp := &pb.LibraryGetStoryRewardResp{} code = this.GetStoryRewardCheck(session, req) @@ -37,7 +36,10 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe favorConf, err := this.module.configure.GetFavorability(_heroFetter.Heroid, 1) // 取1级的就可以 if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } // 领取传记往事id diff --git a/modules/library/api_lvreward.go b/modules/library/api_lvreward.go index 371cf6946..3026d56c1 100644 --- a/modules/library/api_lvreward.go +++ b/modules/library/api_lvreward.go @@ -19,7 +19,7 @@ func (this *apiComp) LvRewardCheck(session comm.IUserSession, req *pb.LibraryLvR // 英雄回礼 func (this *apiComp) LvReward(session comm.IUserSession, req *pb.LibraryLvRewardReq) (code pb.ErrorCode, data *pb.ErrorData) { - data = &pb.ErrorData{} + resp := &pb.LibraryLvRewardResp{} code = this.LvRewardCheck(session, req) if code != pb.ErrorCode_Success { @@ -41,7 +41,10 @@ func (this *apiComp) LvReward(session comm.IUserSession, req *pb.LibraryLvReward confData, err := this.module.configure.GetFavorability(_heroFetter.Heroid, req.Lv) if err != nil { code = pb.ErrorCode_ReqParameterError - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } diff --git a/modules/library/api_usegift.go b/modules/library/api_usegift.go index 0c02bdcf1..0c23d5d93 100644 --- a/modules/library/api_usegift.go +++ b/modules/library/api_usegift.go @@ -27,7 +27,6 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe addExp int32 // 获得的经验 sCount int32 // 赠送开始次数 ) - data = &pb.ErrorData{} attenuation = make(map[int32]int32, 0) code = this.UseGiftCheck(session, req) if code != pb.ErrorCode_Success { @@ -43,7 +42,10 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe _exp, err := this.module.configure.GetFavorabilityExp(_heroObj.Heroid) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } maxLv = int32(len(_exp)) // 获取当前星级羁绊最大等级 @@ -75,7 +77,10 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe _c, err := this.module.configure.GetFavorability(_heroObj.Heroid, _heroObj.Favorlv) if err != nil { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } for _, v := range _c.LikesFood { // 喜欢的食物 @@ -158,7 +163,10 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe }) } else { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } } diff --git a/modules/mline/api_getlist.go b/modules/mline/api_getlist.go index a81bf2155..04d43886c 100644 --- a/modules/mline/api_getlist.go +++ b/modules/mline/api_getlist.go @@ -18,7 +18,7 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.MlineGetLis ///获取主线关卡信息 func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq) (code pb.ErrorCode, data *pb.ErrorData) { rsp := &pb.MlineGetListResp{} - data = &pb.ErrorData{} + code = this.GetListCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 @@ -52,7 +52,10 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq) } } else { code = pb.ErrorCode_ConfigNoFound - data.Message = err.Error() + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } } diff --git a/modules/practice/api_upgrade.go b/modules/practice/api_upgrade.go index d26a27c08..dbb58e636 100644 --- a/modules/practice/api_upgrade.go +++ b/modules/practice/api_upgrade.go @@ -61,24 +61,16 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.PracticeUpgradeR } switch pillar.Lv { case 2: - if err := this.module.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "100002"); err != nil { - data.Message = err.Error() - } + this.module.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "100002") break case 3: - if this.module.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "100003"); err != nil { - data.Message = err.Error() - } + this.module.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "100003") break case 4: - if this.module.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "100004"); err != nil { - data.Message = err.Error() - } + this.module.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "100004") break case 5: - if this.module.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "100005"); err != nil { - data.Message = err.Error() - } + this.module.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "100005") break } this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{ diff --git a/modules/viking/api_challengeover.go b/modules/viking/api_challengeover.go index db6b14ba2..dd22763fd 100644 --- a/modules/viking/api_challengeover.go +++ b/modules/viking/api_challengeover.go @@ -172,7 +172,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal var szTask []*pb.BuriedParam szTask = append(szTask, 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.Difficulty, req.Report.Costtime)) + szTask = append(szTask, 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 {