This commit is contained in:
meixiongfeng 2023-06-06 11:02:47 +08:00
parent 34698ddc60
commit f246a19a3c
38 changed files with 259 additions and 89 deletions

View File

@ -64,7 +64,11 @@ func (this *Caravan) OnInstallComp() {
func (this *Caravan) ModifyCaravanData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) { func (this *Caravan) ModifyCaravanData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) {
err := this.modelCaravan.modifyCaravanDataByObjId(uid, data) err := this.modelCaravan.modifyCaravanDataByObjId(uid, data)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
} }
return return
} }

View File

@ -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) { 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 { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId()) enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_PagodaNotFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaNotFound, // 道具数量不足
Title: pb.ErrorCode_PagodaNotFound.ToString(),
}
return return
} }
cfgData, err := this.module.configure.GetEnchantBossConfigData(req.BossType) cfgData, err := this.module.configure.GetEnchantBossConfigData(req.BossType)
if err != nil { if err != nil {
code = pb.ErrorCode_ConfigNoFound errdata = &pb.ErrorData{
data = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, // 道具数量不足
Title: pb.GetErrorCodeMsg(code), Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(), Message: err.Error(),
} }
return return
} }
if len(cfgData) <= 0 { if len(cfgData) <= 0 { /// 启动前校验
code = pb.ErrorCode_ConfigNoFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound, // 道具数量不足
Title: pb.ErrorCode_ConfigNoFound.ToString(),
}
return return
} }
if code = this.module.CheckRes(session, cfgData[0].PsConsume); errdata != nil { if errdata = this.module.CheckRes(session, cfgData[0].PsConsume); errdata != nil {
code = pb.ErrorCode_ItemsNoEnough
return return
} }
@ -65,7 +69,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen
battleconf = v battleconf = v
} }
} }
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_enchant, Ptype: pb.PlayType_enchant,
Title: "", Title: "",
Format: req.Battle, Format: req.Battle,

View File

@ -26,41 +26,44 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
) )
mapData = make(map[string]interface{}, 0) mapData = make(map[string]interface{}, 0)
// reward = make([]*cfg.Gameatn, 0) // reward = make([]*cfg.Gameatn, 0)
code = this.ChallengeOverCheck(session, req) errdata = this.ChallengeOverCheck(session, req)
if errdata != nil { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId()) enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_PagodaNotFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaNotFound,
Title: pb.ErrorCode_PagodaNotFound.ToString(),
}
return return
} }
cfgEnchant, err := this.module.configure.GetEnchantBossConfigData(req.BossType) cfgEnchant, err := this.module.configure.GetEnchantBossConfigData(req.BossType)
if err != nil { if err != nil {
code = pb.ErrorCode_ConfigNoFound errdata = &pb.ErrorData{
data = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, // 道具数量不足
Title: pb.GetErrorCodeMsg(code), Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(), Message: err.Error(),
} }
return return
} }
// check // check
code, bWin = this.module.battle.CheckBattleReport(session, req.Report) errdata, bWin = this.module.battle.CheckBattleReport(session, req.Report)
if errdata != nil { if errdata != nil {
return return
} }
if !bWin { // 战斗失败了 直接返回 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 return
} }
session.SendMsg(string(this.module.GetType()), EnchantChallengeOverResp, &pb.EnchantChallengeOverResp{Data: enchant}) session.SendMsg(string(this.module.GetType()), EnchantChallengeOverResp, &pb.EnchantChallengeOverResp{Data: enchant})
return 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 return
} }
key := req.BossType key := req.BossType
@ -77,7 +80,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
if score >= v.ScoreLow && score <= v.ScoreUp { if score >= v.ScoreLow && score <= v.ScoreUp {
for _, v1 := range v.RewardDrop { for _, v1 := range v.RewardDrop {
reward := this.module.configure.GetDropReward(v1) // 获取掉落奖励 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 return
} }
} }
@ -86,7 +89,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
mapData["bossTime"] = enchant.BossTime mapData["bossTime"] = enchant.BossTime
mapData["boss"] = enchant.Boss mapData["boss"] = enchant.Boss
code = this.module.ModifyEnchantData(session.GetUserId(), mapData) errdata = this.module.ModifyEnchantData(session.GetUserId(), mapData)
if session.GetUserId() != "" { // 恢复时间 if session.GetUserId() != "" { // 恢复时间
if userexpand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { if userexpand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil {
enchant.RecoveryTime = userexpand.Recovertimeunifiedticket enchant.RecoveryTime = userexpand.Recovertimeunifiedticket

View File

@ -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) { 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 return
} }

View File

@ -22,7 +22,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.EnchantRankList
szRank []*pb.DBEnchantRank szRank []*pb.DBEnchantRank
rd *redis.StringSliceCmd rd *redis.StringSliceCmd
) )
code = this.RankListCheck(session, req) errdata = this.RankListCheck(session, req)
if errdata != nil { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }

View File

@ -51,7 +51,7 @@ func (this *modelEnchant) getEnchantList(uid string) (result *pb.DBEnchant, err
func (this *modelEnchant) checkReddot33(session comm.IUserSession) bool { func (this *modelEnchant) checkReddot33(session comm.IUserSession) bool {
conf, _ := this.module.configure.GetEnchantBossConfigData(1) conf, _ := this.module.configure.GetEnchantBossConfigData(1)
if len(conf) > 0 { 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 return true
} }
} }

View File

@ -61,7 +61,11 @@ func (this *Enchant) OnInstallComp() {
func (this *Enchant) ModifyEnchantData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) { func (this *Enchant) ModifyEnchantData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) {
err := this.modelEnchant.modifyEnchantDataByObjId(uid, data) err := this.modelEnchant.modifyEnchantDataByObjId(uid, data)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
} }
return return
} }

View File

@ -52,13 +52,13 @@ func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (errd
///解析GM 指令 ///解析GM 指令
func (this *apiComp) Cmd(session comm.IUserSession, req *pb.GMCmdReq) (errdata *pb.ErrorData) { 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 return
} }
var ( var (
isOk bool 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 isOk = true
} }

View File

@ -13,29 +13,32 @@ func (this *apiComp) ActivateAtlasCheck(session comm.IUserSession, req *pb.Gourm
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(), Title: pb.ErrorCode_ReqParameterError.ToString(),
} }
return
} }
return return
} }
func (this *apiComp) ActivateAtlas(session comm.IUserSession, req *pb.GourmetActivateAtlasReq) (errdata *pb.ErrorData) { 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 { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
conf, err := this.configure.GetGrormetCookBookConf(req.Cid) conf, err := this.configure.GetGrormetCookBookConf(req.Cid)
if err != nil { // 配置校验 if err != nil { // 配置校验
code = pb.ErrorCode_ConfigNoFound errdata = &pb.ErrorData{
data = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound,
Title: pb.GetErrorCodeMsg(code), Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(), Message: err.Error(),
} }
return return
} }
_gourmet, err := this.module.modelAtlas.getGourmetAtlasList(session.GetUserId()) _gourmet, err := this.module.modelAtlas.getGourmetAtlasList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
if v, ok := _gourmet.Atlas[req.Cid]; !ok || v != -1 { if v, ok := _gourmet.Atlas[req.Cid]; !ok || v != -1 {

View File

@ -1,6 +1,7 @@
package gourmet package gourmet
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -24,15 +25,15 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate
curFood string // 做出来的食物ID curFood string // 做出来的食物ID
bFirst bool // 是否首次获得 bFirst bool // 是否首次获得
) )
code = this.CreateFoodCheck(session, req) errdata = this.CreateFoodCheck(session, req)
if errdata != nil { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
conf, err := this.configure.GetGrormetCookBookConf(req.Cid) conf, err := this.configure.GetGrormetCookBookConf(req.Cid)
if err != nil { // 配置校验 if err != nil { // 配置校验
code = pb.ErrorCode_ConfigNoFound errdata = &pb.ErrorData{
data = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound,
Title: pb.GetErrorCodeMsg(code), Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(), Message: err.Error(),
} }
return return
@ -56,16 +57,20 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate
return return
} }
// 构建消耗 // 构建消耗
if code = this.module.CheckRes(session, res); errdata != nil { if errdata = this.module.CheckRes(session, res); errdata != nil {
return return
} }
curFood = this.module.GetSuccessRate(req.Material, conf) curFood = this.module.GetSuccessRate(req.Material, conf)
if curFood == "" { 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 return
} }
if code = this.module.ConsumeRes(session, res, true); errdata != nil { if errdata = this.module.ConsumeRes(session, res, true); errdata != nil {
return return
} }
atn := &cfg.Gameatn{ atn := &cfg.Gameatn{

View File

@ -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) { 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 { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
_gourmet, err := this.module.modelAtlas.getGourmetAtlasList(session.GetUserId()) _gourmet, err := this.module.modelAtlas.getGourmetAtlasList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }

View File

@ -32,15 +32,18 @@ func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.GourmetGetRa
mapUser map[string]struct{} mapUser map[string]struct{}
) )
mapUser = make(map[string]struct{}, 0) mapUser = make(map[string]struct{}, 0)
code = this.GetRandUserCheck(session, req) if errdata = this.GetRandUserCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
// 获取在线玩家信息 // 获取在线玩家信息
onlineList, err := this.module.ModuleUser.UserOnlineList() onlineList, err := this.module.ModuleUser.UserOnlineList()
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }

View File

@ -22,7 +22,11 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.GrowtaskListReq) (e
gt, err := this.module.modelGrowtask.getUserGrowtask(uid) gt, err := this.module.modelGrowtask.getUserGrowtask(uid)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
if gt.Uid == "" { if gt.Uid == "" {

View File

@ -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) err = this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap)
if err != nil { 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) this.module.Errorf("update hero skill failed:%v", err)
return return
} }

View File

@ -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) err := this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap)
if err != nil { 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) log.Errorf("update hero skill failed:%v", err)
return return
} }

View File

@ -39,7 +39,11 @@ func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpec
// 保存数据 // 保存数据
err1 := this.module.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap) err1 := this.module.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap)
if err1 != nil { 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) log.Errorf("GetSpecified failed:%v", err)
return return
} }

View File

@ -100,17 +100,21 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
_hero.NormalSkill[szIndex[upSkillPos]].SkillLv += 1 _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 return
} }
_heroMap := map[string]interface{}{ _heroMap := map[string]interface{}{
"normalSkill": _hero.NormalSkill, "normalSkill": _hero.NormalSkill,
} }
err1 := this.module.modelHero.ChangeList(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 err = this.module.modelHero.ChangeList(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
if err1 != nil { if err != nil {
this.module.Errorf("update hero skill failed:%v", err1) this.module.Errorf("update hero skill failed:%v", err)
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero}) session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero})

View File

@ -84,7 +84,11 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
// 保存数据 // 保存数据
err = this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap) err = this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap)
if err != nil { 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) this.module.Errorf("update hero star failed:%v", err)
} }

View File

@ -18,7 +18,11 @@ func (this *apiComp) TalentList(session comm.IUserSession, req *pb.HeroTalentLis
rsp := &pb.HeroTalentListResp{} rsp := &pb.HeroTalentListResp{}
if rsp.Telnet, err = this.module.modelTalent.GetHerotalent(session.GetUserId()); err != nil { if rsp.Telnet, err = this.module.modelTalent.GetHerotalent(session.GetUserId()); err != nil {
fmt.Printf("GetHerotalenterr: %v\n", err) 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) session.SendMsg(string(this.module.GetType()), HeroTalentListResp, rsp)
return return

View File

@ -576,12 +576,20 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
if model != nil { if model != nil {
if err := model.ChangeList(session.GetUserId(), hero.Id, update); err != nil { if err := model.ChangeList(session.GetUserId(), hero.Id, update); err != nil {
this.module.Errorf("add hero exp failed ChangeList %v", err) 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 { } else {
if err := this.ChangeList(session.GetUserId(), hero.Id, update); err != nil { if err := this.ChangeList(session.GetUserId(), hero.Id, update); err != nil {
this.module.Errorf("add hero exp failed ChangeList %v", err) 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(),
}
} }
} }

View File

@ -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) { func (this *Hero) DelCard(udi string, hero *pb.DBHero, amount int32) (errdata *pb.ErrorData) {
err := this.modelHero.consumeHeroCard(udi, hero, amount) err := this.modelHero.consumeHeroCard(udi, hero, amount)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
return return
@ -394,14 +398,22 @@ func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongf
if model != nil { if model != nil {
if err := model.ChangeList(session.GetUserId(), heroObjID, _heroMap); err != nil { if err := model.ChangeList(session.GetUserId(), heroObjID, _heroMap); err != nil {
this.Errorf("err:%v", err) 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 return
} }
} }
} else { } else {
if err := this.modelHero.ChangeList(session.GetUserId(), heroObjID, _heroMap); err != nil { // 修改英雄信息 if err := this.modelHero.ChangeList(session.GetUserId(), heroObjID, _heroMap); err != nil { // 修改英雄信息
this.Errorf("err:%v", err) 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 return
} }
} }
@ -897,14 +909,22 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string
if model != nil { if model != nil {
if err := model.ChangeList(session.GetUserId(), v.Id, _heroMap); err != nil { if err := model.ChangeList(session.GetUserId(), v.Id, _heroMap); err != nil {
this.Errorf("err:%v", err) 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 return
} }
} }
} else { } else {
if err := this.modelHero.ChangeList(session.GetUserId(), v.Id, _heroMap); err != nil { // 修改英雄信息 if err := this.modelHero.ChangeList(session.GetUserId(), v.Id, _heroMap); err != nil { // 修改英雄信息
this.Errorf("err:%v", err) 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 return
} }
} }

View File

@ -63,7 +63,11 @@ func (this *Hunting) OnInstallComp() {
func (this *Hunting) ModifyHuntingData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) { func (this *Hunting) ModifyHuntingData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) {
err := this.modelHunting.modifyHuntingDataByObjId(uid, data) err := this.modelHunting.modifyHuntingDataByObjId(uid, data)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
} }
return 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) { func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (errdata *pb.ErrorData) {
list, err := this.modelHunting.getHuntingList(session.GetUserId()) list, err := this.modelHunting.getHuntingList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
mapData := make(map[string]interface{}, 0) mapData := make(map[string]interface{}, 0)

View File

@ -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) { func (this *Library) ModifyLibraryData(uid string, obj string, data map[string]interface{}) (errdata *pb.ErrorData) {
err := this.modelLibrary.modifyLibraryDataByObjId(uid, obj, data) err := this.modelLibrary.modifyLibraryDataByObjId(uid, obj, data)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
} }
return 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) { func (this *Library) ModifyHeroFetterData(uid string, obj string, data map[string]interface{}) (errdata *pb.ErrorData) {
err := this.modelFetter.modifyHeroFetterDataByObjId(uid, obj, data) err := this.modelFetter.modifyHeroFetterDataByObjId(uid, obj, data)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
} }
return return
} }

View File

@ -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) { func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq) (errdata *pb.ErrorData) {
rsp := &pb.MlineGetListResp{} rsp := &pb.MlineGetListResp{}
code = this.GetListCheck(session, req) errdata = this.GetListCheck(session, req)
if errdata != nil { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
list, err := this.module.modelMline.getMainlineList(session.GetUserId()) list, err := this.module.modelMline.getMainlineList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
for _, v := range list { for _, v := range list {

View File

@ -96,7 +96,11 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32)
} }
list, err := this.modelMline.getMainlineList(session.GetUserId()) list, err := this.modelMline.getMainlineList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
for _, v := range list { for _, v := range list {

View File

@ -18,7 +18,11 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.PagodaActivateR
) )
list, err := this.module.modelPagoda.getPagodaList(session.GetUserId()) list, err := this.module.modelPagoda.getPagodaList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
Nomalcfg := this.module.configure.GetPagodaConfigData(list.PagodaId + 1) Nomalcfg := this.module.configure.GetPagodaConfigData(list.PagodaId + 1)

View File

@ -16,7 +16,11 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq
list, err := this.module.modelPagoda.getPagodaList(session.GetUserId()) list, err := this.module.modelPagoda.getPagodaList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
// if list.Complete { // 这个版本不给赛季塔信息 // if list.Complete { // 这个版本不给赛季塔信息

View File

@ -54,7 +54,11 @@ func (this *Pagoda) OnInstallComp() {
func (this *Pagoda) ModifyPagodaData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) { func (this *Pagoda) ModifyPagodaData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) {
err := this.modelPagoda.modifyPagodaDataByObjId(uid, data) err := this.modelPagoda.modifyPagodaDataByObjId(uid, data)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
} }
return return
} }

View File

@ -28,7 +28,11 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
} }
atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId()) atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
conf, err := this.module.configure.GetSmithyAtlasConf(req.Id) conf, err := this.module.configure.GetSmithyAtlasConf(req.Id)

View File

@ -24,7 +24,11 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw
} }
atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId()) atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
for { for {

View File

@ -40,13 +40,17 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
} }
rsp = &pb.SmithyForgeEquipResp{} rsp = &pb.SmithyForgeEquipResp{}
update = make(map[string]interface{}) update = make(map[string]interface{})
code = this.ForgeEquipCheck(session, req) errdata = this.ForgeEquipCheck(session, req)
if errdata != nil { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
stove, err = this.module.modelStove.getSmithyStoveList(session.GetUserId()) stove, err = this.module.modelStove.getSmithyStoveList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
reelcfg, err := this.module.configure.GetSmithyReelConfigData(req.ReelId) reelcfg, err := this.module.configure.GetSmithyReelConfigData(req.ReelId)

View File

@ -23,12 +23,20 @@ func (this *apiComp) Customer(session comm.IUserSession, req *pb.SmithyCustomerR
if err == mongo.ErrNoDocuments { if err == mongo.ErrNoDocuments {
c, err := this.module.modelTrade.addCustomer(session.GetUserId(), customerCount) //3个顾客 c, err := this.module.modelTrade.addCustomer(session.GetUserId(), customerCount) //3个顾客
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
cus = c cus = c
} else { } else {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
} }
@ -37,7 +45,11 @@ func (this *apiComp) Customer(session comm.IUserSession, req *pb.SmithyCustomerR
this.module.modelTrade.DelByUId(session.GetUserId()) this.module.modelTrade.DelByUId(session.GetUserId())
c, err := this.module.modelTrade.addCustomer(session.GetUserId(), customerCount) c, err := this.module.modelTrade.addCustomer(session.GetUserId(), customerCount)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
cus = c cus = c

View File

@ -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) { 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 { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId()) atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
session.SendMsg(string(this.module.GetType()), "atlaslist", &pb.SmithyAtlasListResp{Data: atlas}) session.SendMsg(string(this.module.GetType()), "atlaslist", &pb.SmithyAtlasListResp{Data: atlas})

View File

@ -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) { 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 { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
_smithy, err := this.module.modelStove.getSmithyStoveList(session.GetUserId()) _smithy, err := this.module.modelStove.getSmithyStoveList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
this.module.modelStove.calculationRecoveryT(session.GetUserId(), _smithy) this.module.modelStove.calculationRecoveryT(session.GetUserId(), _smithy)

View File

@ -24,7 +24,11 @@ func (this *apiComp) TaskAward(session comm.IUserSession, req *pb.SmithyTaskAwar
if errors.As(err, &errCustom) { if errors.As(err, &errCustom) {
code = errCustom.Code code = errCustom.Code
} else { } else {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
} }
return return
} }

View File

@ -20,7 +20,11 @@ func (this *apiComp) StoveUp(session comm.IUserSession, req *pb.SmithyStoveUpReq
} }
stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId()) stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
conf, err := this.module.configure.GetSmithyStoveConf(stove.Lv) conf, err := this.module.configure.GetSmithyStoveConf(stove.Lv)

View File

@ -22,7 +22,11 @@ func (a *apiComp) Tasklist(session comm.IUserSession, req *pb.SmithyTasklistReq)
if err == mongo.ErrNoDocuments { if err == mongo.ErrNoDocuments {
resp.Tasks = []*pb.TujianTask{} resp.Tasks = []*pb.TujianTask{}
} else { } else {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
} else { } else {

View File

@ -25,7 +25,11 @@ func (this *apiComp) ToolsUp(session comm.IUserSession, req *pb.SmithyToolsUpReq
} }
stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId()) stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
conf, err := this.module.configure.GetSmithyToolsData(req.Id) conf, err := this.module.configure.GetSmithyToolsData(req.Id)