diff --git a/modules/arena/api_plot.go b/modules/arena/api_plot.go index a0ed443a0..830c465b5 100644 --- a/modules/arena/api_plot.go +++ b/modules/arena/api_plot.go @@ -50,10 +50,18 @@ func (this *apiComp) Plot(session comm.IUserSession, req *pb.ArenaPlotReq) (code } if npc, err = this.module.configure.getChallengenpc(req.Pid); err != nil { cd = pb.ErrorCode_ConfigNoFound + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { cd = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } this.module.modelArena.recoverTicket(session, info) @@ -70,6 +78,9 @@ func (this *apiComp) Plot(session comm.IUserSession, req *pb.ArenaPlotReq) (code ndata := info.Npc[req.Pid] if !configure.Now().After(time.Unix(ndata.Cd, 0)) { //已经过了cd时间 code = pb.ErrorCode_ArenaTicketNpcInCd + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + } return } index = ndata.Index @@ -81,6 +92,9 @@ func (this *apiComp) Plot(session comm.IUserSession, req *pb.ArenaPlotReq) (code }); cd == pb.ErrorCode_Success { if err = this.module.modelArena.updateArenaUserInfo(info); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + } return } } diff --git a/modules/arena/api_plotreward.go b/modules/arena/api_plotreward.go index c80f7b87f..473f3a024 100644 --- a/modules/arena/api_plotreward.go +++ b/modules/arena/api_plotreward.go @@ -30,6 +30,10 @@ func (this *apiComp) PlotReward(session comm.IUserSession, req *pb.ArenaPlotRewa } if npc, err = this.module.configure.getChallengenpc(req.Pid); err != nil { code = pb.ErrorCode_ConfigNoFound + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success { @@ -37,10 +41,18 @@ func (this *apiComp) PlotReward(session comm.IUserSession, req *pb.ArenaPlotRewa } if !iswin { code = pb.ErrorCode_MoonfantasyBattleNoWin + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: "战斗校验失败", + } return } if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } if info.Npc[req.Pid] == nil { @@ -58,6 +70,10 @@ func (this *apiComp) PlotReward(session comm.IUserSession, req *pb.ArenaPlotRewa }); err != nil { this.module.Errorln(err) code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } diff --git a/modules/arena/api_rank.go b/modules/arena/api_rank.go index ed21fadc4..290527ee2 100644 --- a/modules/arena/api_rank.go +++ b/modules/arena/api_rank.go @@ -26,14 +26,26 @@ func (this *apiComp) Rank(session comm.IUserSession, req *pb.ArenaRankReq) (code } if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } if uids, err = this.module.modelRank.queryRankUser(); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } if ranks, err = this.module.modelArena.queryPlayers(uids); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } players = make([]*pb.ArenaPlayer, len(ranks)) diff --git a/modules/arena/api_setdattformt.go b/modules/arena/api_setdattformt.go index 1bb2ef8c6..4149b3669 100644 --- a/modules/arena/api_setdattformt.go +++ b/modules/arena/api_setdattformt.go @@ -23,10 +23,18 @@ func (this *apiComp) SetAttFormt(session comm.IUserSession, req *pb.ArenaSetAttF } if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } if heros, err = this.module.modelArena.queryUserHeros(session.GetUserId(), req.Formt); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } info.Attack = &pb.DBPlayerBattleFormt{ @@ -36,6 +44,10 @@ func (this *apiComp) SetAttFormt(session comm.IUserSession, req *pb.ArenaSetAttF if err = this.module.modelArena.updateArenaUserInfo(info); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } session.SendMsg(string(this.module.GetType()), "setattformt", &pb.ArenaSetAttFormtResp{Issucc: true}) diff --git a/modules/arena/api_setdefformt.go b/modules/arena/api_setdefformt.go index c369519c0..b5339f383 100644 --- a/modules/arena/api_setdefformt.go +++ b/modules/arena/api_setdefformt.go @@ -23,11 +23,19 @@ func (this *apiComp) SetDefFormt(session comm.IUserSession, req *pb.ArenaSetDefF } if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } if heros, err = this.module.modelArena.queryUserHeros(session.GetUserId(), req.Formt); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } info.Defend = &pb.DBPlayerBattleFormt{ @@ -37,6 +45,10 @@ func (this *apiComp) SetDefFormt(session comm.IUserSession, req *pb.ArenaSetDefF info.Isdef = true if err = this.module.modelArena.updateArenaUserInfo(info); err != nil { code = pb.ErrorCode_DBError + data = &pb.ErrorData{ + Title: pb.GetErrorCodeMsg(code), + Message: err.Error(), + } return } session.SendMsg(string(this.module.GetType()), "setdefformt", &pb.ArenaSetDefFormtResp{Issucc: true}) diff --git a/modules/arena/configure.go b/modules/arena/configure.go index 8d7539145..8e8f79905 100644 --- a/modules/arena/configure.go +++ b/modules/arena/configure.go @@ -91,7 +91,7 @@ func (this *configureComp) getActiveRewardById(lv int32) (result *cfg.GameArenaA this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameArenaActiveReward).GetDataMap()[lv]; !ok { - err = comm.NewNotFoundConfErr("", game_arenaactivereward, lv) + err = comm.NewNotFoundConfErr(moduleName, game_arenaactivereward, lv) this.module.Errorln(err) } } @@ -139,7 +139,7 @@ func (this *configureComp) getMonsterFormat(id int32) (result []*cfg.GameMonster if result, ok = this.mformat[id]; ok { return } - err = fmt.Errorf("GetMonsterFormat no found :%d", id) + err = comm.NewNotFoundConfErr(moduleName, game_monsterformat, id) this.module.Errorln(err) return } @@ -154,7 +154,7 @@ func (this *configureComp) getMonster(id int32) (result *cfg.GameMonsterData, er this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameMonster).GetDataMap()[id]; !ok { - err = fmt.Errorf("on found GameMonster:%d", id) + err = comm.NewNotFoundConfErr(moduleName, game_monster, id) this.module.Errorln(err) } } @@ -184,7 +184,8 @@ func (this *configureComp) getChallengenpc(id int32) (result *cfg.GameArenaChall this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameArenaChallengeNpc).GetDataMap()[id]; !ok { - err = fmt.Errorf("on found getChallengenpc:%d", id) + // err = fmt.Errorf("on found getChallengenpc:%d", id) + err = comm.NewNotFoundConfErr(moduleName, game_arenachallengenpc, id) this.module.Errorln(err) } } diff --git a/modules/arena/module.go b/modules/arena/module.go index 45c9d0f45..f1978b010 100644 --- a/modules/arena/module.go +++ b/modules/arena/module.go @@ -13,6 +13,8 @@ import ( cfg "go_dreamfactory/sys/configure/structs" ) +const moduleName = "竞技场" + /* 模块名:竞技场 描述:pvp相关业务