From f246a19a3c4a0c5b0a661972249c078b20b389d2 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 6 Jun 2023 11:02:47 +0800 Subject: [PATCH] update --- modules/caravan/module.go | 6 +++++- modules/enchant/api_challenge.go | 26 +++++++++++++---------- modules/enchant/api_challengeover.go | 23 +++++++++++--------- modules/enchant/api_getlist.go | 2 +- modules/enchant/api_ranklist.go | 2 +- modules/enchant/model_enchant.go | 2 +- modules/enchant/module.go | 6 +++++- modules/gm/api_cmd.go | 4 ++-- modules/gourmet/api_activateatlas.go | 15 ++++++++------ modules/gourmet/api_createfood.go | 19 ++++++++++------- modules/gourmet/api_getatlas.go | 8 +++++-- modules/gourmet/api_getranduser.go | 9 +++++--- modules/growtask/api_tasklist.go | 6 +++++- modules/hero/api_awaken.go | 6 +++++- modules/hero/api_lock.go | 6 +++++- modules/hero/api_specified.go | 6 +++++- modules/hero/api_strengthenUpSkill.go | 14 ++++++++----- modules/hero/api_strengthenUpStar.go | 6 +++++- modules/hero/api_talentlist.go | 6 +++++- modules/hero/model_hero.go | 12 +++++++++-- modules/hero/module.go | 30 ++++++++++++++++++++++----- modules/hunting/module.go | 12 +++++++++-- modules/library/module.go | 12 +++++++++-- modules/mline/api_getlist.go | 8 +++++-- modules/mline/module.go | 6 +++++- modules/pagoda/api_activate.go | 6 +++++- modules/pagoda/api_getlist.go | 6 +++++- modules/pagoda/module.go | 6 +++++- modules/smithy/api_atlasactivate.go | 6 +++++- modules/smithy/api_atlasaward.go | 6 +++++- modules/smithy/api_forgeequip.go | 8 +++++-- modules/smithy/api_getCustomer.go | 18 +++++++++++++--- modules/smithy/api_getatlas.go | 8 +++++-- modules/smithy/api_getstoveinfo.go | 8 +++++-- modules/smithy/api_receive.go | 6 +++++- modules/smithy/api_stoveup.go | 6 +++++- modules/smithy/api_tasklist.go | 6 +++++- modules/smithy/api_toolsup.go | 6 +++++- 38 files changed, 259 insertions(+), 89 deletions(-) diff --git a/modules/caravan/module.go b/modules/caravan/module.go index cc8b3c9c9..7c5b31b06 100644 --- a/modules/caravan/module.go +++ b/modules/caravan/module.go @@ -64,7 +64,11 @@ func (this *Caravan) OnInstallComp() { func (this *Caravan) ModifyCaravanData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) { err := this.modelCaravan.modifyCaravanDataByObjId(uid, data) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } return } diff --git a/modules/enchant/api_challenge.go b/modules/enchant/api_challenge.go index 14e5fa8a5..0b8994287 100644 --- a/modules/enchant/api_challenge.go +++ b/modules/enchant/api_challenge.go @@ -21,32 +21,36 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.EnchantCh ///挑战主线关卡 func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallengeReq) (errdata *pb.ErrorData) { - code = this.ChallengeCheck(session, req) + errdata = this.ChallengeCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_PagodaNotFound + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_PagodaNotFound, // 道具数量不足 + Title: pb.ErrorCode_PagodaNotFound.ToString(), + } return } cfgData, err := this.module.configure.GetEnchantBossConfigData(req.BossType) if err != nil { - code = pb.ErrorCode_ConfigNoFound - data = &pb.ErrorData{ - Title: pb.GetErrorCodeMsg(code), + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, // 道具数量不足 + Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: err.Error(), } return } - if len(cfgData) <= 0 { - code = pb.ErrorCode_ConfigNoFound + if len(cfgData) <= 0 { /// 启动前校验 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, // 道具数量不足 + Title: pb.ErrorCode_ConfigNoFound.ToString(), + } return } - if code = this.module.CheckRes(session, cfgData[0].PsConsume); errdata != nil { - - code = pb.ErrorCode_ItemsNoEnough + if errdata = this.module.CheckRes(session, cfgData[0].PsConsume); errdata != nil { return } @@ -65,7 +69,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen battleconf = v } } - code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ + errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ Ptype: pb.PlayType_enchant, Title: "", Format: req.Battle, diff --git a/modules/enchant/api_challengeover.go b/modules/enchant/api_challengeover.go index 0ed721d1e..e3d9a4c81 100644 --- a/modules/enchant/api_challengeover.go +++ b/modules/enchant/api_challengeover.go @@ -26,41 +26,44 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha ) mapData = make(map[string]interface{}, 0) // reward = make([]*cfg.Gameatn, 0) - code = this.ChallengeOverCheck(session, req) + errdata = this.ChallengeOverCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_PagodaNotFound + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_PagodaNotFound, + Title: pb.ErrorCode_PagodaNotFound.ToString(), + } return } cfgEnchant, err := this.module.configure.GetEnchantBossConfigData(req.BossType) if err != nil { - code = pb.ErrorCode_ConfigNoFound - data = &pb.ErrorData{ - Title: pb.GetErrorCodeMsg(code), + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, // 道具数量不足 + Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: err.Error(), } return } // check - code, bWin = this.module.battle.CheckBattleReport(session, req.Report) + errdata, bWin = this.module.battle.CheckBattleReport(session, req.Report) if errdata != nil { return } if !bWin { // 战斗失败了 直接返回 - if code = this.module.ConsumeRes(session, cfgEnchant[0].PsMg, true); errdata != nil { + if errdata = this.module.ConsumeRes(session, cfgEnchant[0].PsMg, true); errdata != nil { return } session.SendMsg(string(this.module.GetType()), EnchantChallengeOverResp, &pb.EnchantChallengeOverResp{Data: enchant}) return } - if code = this.module.ConsumeRes(session, cfgEnchant[0].PsConsume, true); errdata != nil { + if errdata = this.module.ConsumeRes(session, cfgEnchant[0].PsConsume, true); errdata != nil { return } key := req.BossType @@ -77,7 +80,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha if score >= v.ScoreLow && score <= v.ScoreUp { for _, v1 := range v.RewardDrop { reward := this.module.configure.GetDropReward(v1) // 获取掉落奖励 - if code = this.module.DispenseRes(session, reward, true); errdata != nil { + if errdata = this.module.DispenseRes(session, reward, true); errdata != nil { return } } @@ -86,7 +89,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha mapData["bossTime"] = enchant.BossTime mapData["boss"] = enchant.Boss - code = this.module.ModifyEnchantData(session.GetUserId(), mapData) + errdata = this.module.ModifyEnchantData(session.GetUserId(), mapData) if session.GetUserId() != "" { // 恢复时间 if userexpand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { enchant.RecoveryTime = userexpand.Recovertimeunifiedticket diff --git a/modules/enchant/api_getlist.go b/modules/enchant/api_getlist.go index f7269f94d..893642c33 100644 --- a/modules/enchant/api_getlist.go +++ b/modules/enchant/api_getlist.go @@ -17,7 +17,7 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.EnchantGetL func (this *apiComp) GetList(session comm.IUserSession, req *pb.EnchantGetListReq) (errdata *pb.ErrorData) { // 刷新挑战卷 - if code = this.module.ModuleItems.RecoverTicket(session); errdata != nil { + if errdata = this.module.ModuleItems.RecoverTicket(session); errdata != nil { return } diff --git a/modules/enchant/api_ranklist.go b/modules/enchant/api_ranklist.go index 0811b831c..276c8c776 100644 --- a/modules/enchant/api_ranklist.go +++ b/modules/enchant/api_ranklist.go @@ -22,7 +22,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.EnchantRankList szRank []*pb.DBEnchantRank rd *redis.StringSliceCmd ) - code = this.RankListCheck(session, req) + errdata = this.RankListCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } diff --git a/modules/enchant/model_enchant.go b/modules/enchant/model_enchant.go index 46b24cf2c..9f2587119 100644 --- a/modules/enchant/model_enchant.go +++ b/modules/enchant/model_enchant.go @@ -51,7 +51,7 @@ func (this *modelEnchant) getEnchantList(uid string) (result *pb.DBEnchant, err func (this *modelEnchant) checkReddot33(session comm.IUserSession) bool { conf, _ := this.module.configure.GetEnchantBossConfigData(1) if len(conf) > 0 { - if code := this.module.CheckRes(session, conf[0].PsConsume); code == pb.ErrorCode_Success { + if code := this.module.CheckRes(session, conf[0].PsConsume); code == nil { return true } } diff --git a/modules/enchant/module.go b/modules/enchant/module.go index 306f81ea8..107938368 100644 --- a/modules/enchant/module.go +++ b/modules/enchant/module.go @@ -61,7 +61,11 @@ func (this *Enchant) OnInstallComp() { func (this *Enchant) ModifyEnchantData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) { err := this.modelEnchant.modifyEnchantDataByObjId(uid, data) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } return } diff --git a/modules/gm/api_cmd.go b/modules/gm/api_cmd.go index c3b7853cb..bff398d25 100644 --- a/modules/gm/api_cmd.go +++ b/modules/gm/api_cmd.go @@ -52,13 +52,13 @@ func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (errd ///解析GM 指令 func (this *apiComp) Cmd(session comm.IUserSession, req *pb.GMCmdReq) (errdata *pb.ErrorData) { - if code = this.CmdCheck(session, req); errdata != nil { + if errdata = this.CmdCheck(session, req); errdata != nil { return } var ( isOk bool ) - if code = this.module.CreateCmd(session, req.Cmod); code == pb.ErrorCode_Success { + if errdata = this.module.CreateCmd(session, req.Cmod); errdata == nil { isOk = true } diff --git a/modules/gourmet/api_activateatlas.go b/modules/gourmet/api_activateatlas.go index fdc4cd59e..0c2c8af46 100644 --- a/modules/gourmet/api_activateatlas.go +++ b/modules/gourmet/api_activateatlas.go @@ -13,29 +13,32 @@ func (this *apiComp) ActivateAtlasCheck(session comm.IUserSession, req *pb.Gourm Code: pb.ErrorCode_ReqParameterError, Title: pb.ErrorCode_ReqParameterError.ToString(), } - return } return } func (this *apiComp) ActivateAtlas(session comm.IUserSession, req *pb.GourmetActivateAtlasReq) (errdata *pb.ErrorData) { - code = this.ActivateAtlasCheck(session, req) + errdata = this.ActivateAtlasCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } conf, err := this.configure.GetGrormetCookBookConf(req.Cid) if err != nil { // 配置校验 - code = pb.ErrorCode_ConfigNoFound - data = &pb.ErrorData{ - Title: pb.GetErrorCodeMsg(code), + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: err.Error(), } return } _gourmet, err := this.module.modelAtlas.getGourmetAtlasList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } if v, ok := _gourmet.Atlas[req.Cid]; !ok || v != -1 { diff --git a/modules/gourmet/api_createfood.go b/modules/gourmet/api_createfood.go index 9f7b6e40e..3b046c71c 100644 --- a/modules/gourmet/api_createfood.go +++ b/modules/gourmet/api_createfood.go @@ -1,6 +1,7 @@ package gourmet import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -24,15 +25,15 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate curFood string // 做出来的食物ID bFirst bool // 是否首次获得 ) - code = this.CreateFoodCheck(session, req) + errdata = this.CreateFoodCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } conf, err := this.configure.GetGrormetCookBookConf(req.Cid) if err != nil { // 配置校验 - code = pb.ErrorCode_ConfigNoFound - data = &pb.ErrorData{ - Title: pb.GetErrorCodeMsg(code), + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: err.Error(), } return @@ -56,16 +57,20 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate return } // 构建消耗 - if code = this.module.CheckRes(session, res); errdata != nil { + if errdata = this.module.CheckRes(session, res); errdata != nil { return } curFood = this.module.GetSuccessRate(req.Material, conf) if curFood == "" { - code = pb.ErrorCode_ConfigNoFound + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + Message: fmt.Sprintf("curfood:%d", curFood), + } return } - if code = this.module.ConsumeRes(session, res, true); errdata != nil { + if errdata = this.module.ConsumeRes(session, res, true); errdata != nil { return } atn := &cfg.Gameatn{ diff --git a/modules/gourmet/api_getatlas.go b/modules/gourmet/api_getatlas.go index bd41bd5ab..182225c4f 100644 --- a/modules/gourmet/api_getatlas.go +++ b/modules/gourmet/api_getatlas.go @@ -14,13 +14,17 @@ func (this *apiComp) AtlasCheck(session comm.IUserSession, req *pb.GourmetAtlasR ///获取美食城基本信息 func (this *apiComp) Atlas(session comm.IUserSession, req *pb.GourmetAtlasReq) (errdata *pb.ErrorData) { - code = this.AtlasCheck(session, req) + errdata = this.AtlasCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } _gourmet, err := this.module.modelAtlas.getGourmetAtlasList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } diff --git a/modules/gourmet/api_getranduser.go b/modules/gourmet/api_getranduser.go index 20598e303..3001a36ae 100644 --- a/modules/gourmet/api_getranduser.go +++ b/modules/gourmet/api_getranduser.go @@ -32,15 +32,18 @@ func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.GourmetGetRa mapUser map[string]struct{} ) mapUser = make(map[string]struct{}, 0) - code = this.GetRandUserCheck(session, req) - if errdata != nil { + if errdata = this.GetRandUserCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } // 获取在线玩家信息 onlineList, err := this.module.ModuleUser.UserOnlineList() if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } diff --git a/modules/growtask/api_tasklist.go b/modules/growtask/api_tasklist.go index 287ae2d00..7015bd5c7 100644 --- a/modules/growtask/api_tasklist.go +++ b/modules/growtask/api_tasklist.go @@ -22,7 +22,11 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.GrowtaskListReq) (e gt, err := this.module.modelGrowtask.getUserGrowtask(uid) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } if gt.Uid == "" { diff --git a/modules/hero/api_awaken.go b/modules/hero/api_awaken.go index 09b9055c3..e78c68b6d 100644 --- a/modules/hero/api_awaken.go +++ b/modules/hero/api_awaken.go @@ -93,7 +93,11 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e // 保存数据 err = this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } this.module.Errorf("update hero skill failed:%v", err) return } diff --git a/modules/hero/api_lock.go b/modules/hero/api_lock.go index 1da791655..6c8189cf1 100644 --- a/modules/hero/api_lock.go +++ b/modules/hero/api_lock.go @@ -39,7 +39,11 @@ func (this *apiComp) Lock(session comm.IUserSession, req *pb.HeroLockReq) (errda // 保存数据 err := this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } log.Errorf("update hero skill failed:%v", err) return } diff --git a/modules/hero/api_specified.go b/modules/hero/api_specified.go index aa87a83ec..e83a14b83 100644 --- a/modules/hero/api_specified.go +++ b/modules/hero/api_specified.go @@ -39,7 +39,11 @@ func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpec // 保存数据 err1 := this.module.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap) if err1 != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } log.Errorf("GetSpecified failed:%v", err) return } diff --git a/modules/hero/api_strengthenUpSkill.go b/modules/hero/api_strengthenUpSkill.go index 8060b87d3..2a1ec810c 100644 --- a/modules/hero/api_strengthenUpSkill.go +++ b/modules/hero/api_strengthenUpSkill.go @@ -100,17 +100,21 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt _hero.NormalSkill[szIndex[upSkillPos]].SkillLv += 1 } - if code = this.module.ConsumeRes(session, cost, true); errdata != nil { + if errdata = this.module.ConsumeRes(session, cost, true); errdata != nil { return } _heroMap := map[string]interface{}{ "normalSkill": _hero.NormalSkill, } - err1 := this.module.modelHero.ChangeList(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 - if err1 != nil { - this.module.Errorf("update hero skill failed:%v", err1) - code = pb.ErrorCode_DBError + err = this.module.modelHero.ChangeList(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 + if err != nil { + this.module.Errorf("update hero skill failed:%v", err) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero}) diff --git a/modules/hero/api_strengthenUpStar.go b/modules/hero/api_strengthenUpStar.go index a03c814a9..cfd4926b1 100644 --- a/modules/hero/api_strengthenUpStar.go +++ b/modules/hero/api_strengthenUpStar.go @@ -84,7 +84,11 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr // 保存数据 err = this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } this.module.Errorf("update hero star failed:%v", err) } diff --git a/modules/hero/api_talentlist.go b/modules/hero/api_talentlist.go index b900ad933..2ab153d3c 100644 --- a/modules/hero/api_talentlist.go +++ b/modules/hero/api_talentlist.go @@ -18,7 +18,11 @@ func (this *apiComp) TalentList(session comm.IUserSession, req *pb.HeroTalentLis rsp := &pb.HeroTalentListResp{} if rsp.Telnet, err = this.module.modelTalent.GetHerotalent(session.GetUserId()); err != nil { fmt.Printf("GetHerotalenterr: %v\n", err) - //code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } session.SendMsg(string(this.module.GetType()), HeroTalentListResp, rsp) return diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index a8eeb80f0..424510c66 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -576,12 +576,20 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex if model != nil { if err := model.ChangeList(session.GetUserId(), hero.Id, update); err != nil { this.module.Errorf("add hero exp failed ChangeList %v", err) - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } } else { if err := this.ChangeList(session.GetUserId(), hero.Id, update); err != nil { this.module.Errorf("add hero exp failed ChangeList %v", err) - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } } diff --git a/modules/hero/module.go b/modules/hero/module.go index 0dc4f4072..433372361 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -196,7 +196,11 @@ func (this *Hero) QueryHeroByConfId(uId string, heroCfgId string) (hero *pb.DBHe func (this *Hero) DelCard(udi string, hero *pb.DBHero, amount int32) (errdata *pb.ErrorData) { err := this.modelHero.consumeHeroCard(udi, hero, amount) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } return @@ -394,14 +398,22 @@ func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongf if model != nil { if err := model.ChangeList(session.GetUserId(), heroObjID, _heroMap); err != nil { this.Errorf("err:%v", err) - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } } } else { if err := this.modelHero.ChangeList(session.GetUserId(), heroObjID, _heroMap); err != nil { // 修改英雄信息 this.Errorf("err:%v", err) - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } } @@ -897,14 +909,22 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string if model != nil { if err := model.ChangeList(session.GetUserId(), v.Id, _heroMap); err != nil { this.Errorf("err:%v", err) - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } } } else { if err := this.modelHero.ChangeList(session.GetUserId(), v.Id, _heroMap); err != nil { // 修改英雄信息 this.Errorf("err:%v", err) - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } } diff --git a/modules/hunting/module.go b/modules/hunting/module.go index cf4fc2366..279d261f7 100644 --- a/modules/hunting/module.go +++ b/modules/hunting/module.go @@ -63,7 +63,11 @@ func (this *Hunting) OnInstallComp() { func (this *Hunting) ModifyHuntingData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) { err := this.modelHunting.modifyHuntingDataByObjId(uid, data) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } return } @@ -180,7 +184,11 @@ func (this *Hunting) Reddot(session comm.IUserSession, rid ...comm.ReddotType) ( func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (errdata *pb.ErrorData) { list, err := this.modelHunting.getHuntingList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } mapData := make(map[string]interface{}, 0) diff --git a/modules/library/module.go b/modules/library/module.go index 2672d36af..7b40b5984 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -58,7 +58,11 @@ func (this *Library) Start() (err error) { func (this *Library) ModifyLibraryData(uid string, obj string, data map[string]interface{}) (errdata *pb.ErrorData) { err := this.modelLibrary.modifyLibraryDataByObjId(uid, obj, data) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } return } @@ -135,7 +139,11 @@ func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibr func (this *Library) ModifyHeroFetterData(uid string, obj string, data map[string]interface{}) (errdata *pb.ErrorData) { err := this.modelFetter.modifyHeroFetterDataByObjId(uid, obj, data) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } return } diff --git a/modules/mline/api_getlist.go b/modules/mline/api_getlist.go index 6feb939af..38d56ce6b 100644 --- a/modules/mline/api_getlist.go +++ b/modules/mline/api_getlist.go @@ -22,14 +22,18 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.MlineGetLis func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq) (errdata *pb.ErrorData) { rsp := &pb.MlineGetListResp{} - code = this.GetListCheck(session, req) + errdata = this.GetListCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } list, err := this.module.modelMline.getMainlineList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } for _, v := range list { diff --git a/modules/mline/module.go b/modules/mline/module.go index d63050fea..3c87cb3be 100644 --- a/modules/mline/module.go +++ b/modules/mline/module.go @@ -96,7 +96,11 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) } list, err := this.modelMline.getMainlineList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } for _, v := range list { diff --git a/modules/pagoda/api_activate.go b/modules/pagoda/api_activate.go index c480755d6..919c40952 100644 --- a/modules/pagoda/api_activate.go +++ b/modules/pagoda/api_activate.go @@ -18,7 +18,11 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.PagodaActivateR ) list, err := this.module.modelPagoda.getPagodaList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } Nomalcfg := this.module.configure.GetPagodaConfigData(list.PagodaId + 1) diff --git a/modules/pagoda/api_getlist.go b/modules/pagoda/api_getlist.go index f489794e5..11e725172 100644 --- a/modules/pagoda/api_getlist.go +++ b/modules/pagoda/api_getlist.go @@ -16,7 +16,11 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq list, err := this.module.modelPagoda.getPagodaList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } // if list.Complete { // 这个版本不给赛季塔信息 diff --git a/modules/pagoda/module.go b/modules/pagoda/module.go index 249d9c847..63baf5f6c 100644 --- a/modules/pagoda/module.go +++ b/modules/pagoda/module.go @@ -54,7 +54,11 @@ func (this *Pagoda) OnInstallComp() { func (this *Pagoda) ModifyPagodaData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) { err := this.modelPagoda.modifyPagodaDataByObjId(uid, data) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } return } diff --git a/modules/smithy/api_atlasactivate.go b/modules/smithy/api_atlasactivate.go index 7a1b82856..3eafde8f5 100644 --- a/modules/smithy/api_atlasactivate.go +++ b/modules/smithy/api_atlasactivate.go @@ -28,7 +28,11 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla } atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } conf, err := this.module.configure.GetSmithyAtlasConf(req.Id) diff --git a/modules/smithy/api_atlasaward.go b/modules/smithy/api_atlasaward.go index b7b0846d4..8a5c9a3a7 100644 --- a/modules/smithy/api_atlasaward.go +++ b/modules/smithy/api_atlasaward.go @@ -24,7 +24,11 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw } atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } for { diff --git a/modules/smithy/api_forgeequip.go b/modules/smithy/api_forgeequip.go index ff4a1e478..cd3aa832c 100644 --- a/modules/smithy/api_forgeequip.go +++ b/modules/smithy/api_forgeequip.go @@ -40,13 +40,17 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq } rsp = &pb.SmithyForgeEquipResp{} update = make(map[string]interface{}) - code = this.ForgeEquipCheck(session, req) + errdata = this.ForgeEquipCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } stove, err = this.module.modelStove.getSmithyStoveList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } reelcfg, err := this.module.configure.GetSmithyReelConfigData(req.ReelId) diff --git a/modules/smithy/api_getCustomer.go b/modules/smithy/api_getCustomer.go index c05108537..354ca4020 100644 --- a/modules/smithy/api_getCustomer.go +++ b/modules/smithy/api_getCustomer.go @@ -23,12 +23,20 @@ func (this *apiComp) Customer(session comm.IUserSession, req *pb.SmithyCustomerR if err == mongo.ErrNoDocuments { c, err := this.module.modelTrade.addCustomer(session.GetUserId(), customerCount) //3个顾客 if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } cus = c } else { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } } @@ -37,7 +45,11 @@ func (this *apiComp) Customer(session comm.IUserSession, req *pb.SmithyCustomerR this.module.modelTrade.DelByUId(session.GetUserId()) c, err := this.module.modelTrade.addCustomer(session.GetUserId(), customerCount) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } cus = c diff --git a/modules/smithy/api_getatlas.go b/modules/smithy/api_getatlas.go index 8a2159690..26ceaf5b3 100644 --- a/modules/smithy/api_getatlas.go +++ b/modules/smithy/api_getatlas.go @@ -14,13 +14,17 @@ func (this *apiComp) AtlasListCheck(session comm.IUserSession, req *pb.SmithyAtl // 获取铁匠铺图鉴信息 func (this *apiComp) AtlasList(session comm.IUserSession, req *pb.SmithyAtlasListReq) (errdata *pb.ErrorData) { - code = this.AtlasListCheck(session, req) + errdata = this.AtlasListCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } session.SendMsg(string(this.module.GetType()), "atlaslist", &pb.SmithyAtlasListResp{Data: atlas}) diff --git a/modules/smithy/api_getstoveinfo.go b/modules/smithy/api_getstoveinfo.go index a15d5da1e..e7afbc5e2 100644 --- a/modules/smithy/api_getstoveinfo.go +++ b/modules/smithy/api_getstoveinfo.go @@ -14,13 +14,17 @@ func (this *apiComp) GetStoveInfoCheck(session comm.IUserSession, req *pb.Smithy // 获取铁匠铺信息 func (this *apiComp) GetStoveInfo(session comm.IUserSession, req *pb.SmithyGetStoveInfoReq) (errdata *pb.ErrorData) { - code = this.GetStoveInfoCheck(session, req) + errdata = this.GetStoveInfoCheck(session, req) if errdata != nil { return // 参数校验失败直接返回 } _smithy, err := this.module.modelStove.getSmithyStoveList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } this.module.modelStove.calculationRecoveryT(session.GetUserId(), _smithy) diff --git a/modules/smithy/api_receive.go b/modules/smithy/api_receive.go index e66490d86..44517edb3 100644 --- a/modules/smithy/api_receive.go +++ b/modules/smithy/api_receive.go @@ -24,7 +24,11 @@ func (this *apiComp) TaskAward(session comm.IUserSession, req *pb.SmithyTaskAwar if errors.As(err, &errCustom) { code = errCustom.Code } else { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } } return } diff --git a/modules/smithy/api_stoveup.go b/modules/smithy/api_stoveup.go index 22150373c..fe456d369 100644 --- a/modules/smithy/api_stoveup.go +++ b/modules/smithy/api_stoveup.go @@ -20,7 +20,11 @@ func (this *apiComp) StoveUp(session comm.IUserSession, req *pb.SmithyStoveUpReq } stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } conf, err := this.module.configure.GetSmithyStoveConf(stove.Lv) diff --git a/modules/smithy/api_tasklist.go b/modules/smithy/api_tasklist.go index 80184e80e..d2676d4a0 100644 --- a/modules/smithy/api_tasklist.go +++ b/modules/smithy/api_tasklist.go @@ -22,7 +22,11 @@ func (a *apiComp) Tasklist(session comm.IUserSession, req *pb.SmithyTasklistReq) if err == mongo.ErrNoDocuments { resp.Tasks = []*pb.TujianTask{} } else { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } } else { diff --git a/modules/smithy/api_toolsup.go b/modules/smithy/api_toolsup.go index fe3dc63d3..24bc0002b 100644 --- a/modules/smithy/api_toolsup.go +++ b/modules/smithy/api_toolsup.go @@ -25,7 +25,11 @@ func (this *apiComp) ToolsUp(session comm.IUserSession, req *pb.SmithyToolsUpReq } stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId()) if err != nil { - code = pb.ErrorCode_DBError + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } return } conf, err := this.module.configure.GetSmithyToolsData(req.Id)