update
This commit is contained in:
parent
34698ddc60
commit
f246a19a3c
@ -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
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 // 参数校验失败直接返回
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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{
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 == "" {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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})
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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 { // 这个版本不给赛季塔信息
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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})
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user