上传竞技场异常问题
This commit is contained in:
parent
1456fa9f8d
commit
e4e08a2201
@ -36,6 +36,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
|
|||||||
heros []*pb.DBHero
|
heros []*pb.DBHero
|
||||||
record *pb.DBBattleRecord
|
record *pb.DBBattleRecord
|
||||||
change bool
|
change bool
|
||||||
|
ok bool
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if errdata = this.ChallengeCheck(session, req); errdata != nil {
|
if errdata = this.ChallengeCheck(session, req); errdata != nil {
|
||||||
@ -72,6 +73,22 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ok = false
|
||||||
|
for _, v := range heros {
|
||||||
|
if v.Id != "" {
|
||||||
|
ok = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: "no found any hero",
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if red.Defend == nil {
|
if red.Defend == nil {
|
||||||
red.Defend = &pb.DBPlayerBattleFormt{
|
red.Defend = &pb.DBPlayerBattleFormt{
|
||||||
Leadpos: req.Battle.Leadpos,
|
Leadpos: req.Battle.Leadpos,
|
||||||
|
@ -222,14 +222,6 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err = this.module.modelArena.updateArenaUserInfo(rival); err != nil {
|
|
||||||
errdata = &pb.ErrorData{
|
|
||||||
Code: pb.ErrorCode_DBError,
|
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.module.modelRank.updateArenaRank(red)
|
this.module.modelRank.updateArenaRank(red)
|
||||||
info.Integral = red.Integral
|
info.Integral = red.Integral
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
package arena
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go_dreamfactory/comm"
|
|
||||||
"go_dreamfactory/pb"
|
|
||||||
)
|
|
||||||
|
|
||||||
//参数校验
|
|
||||||
func (this *apiComp) SetAttFormtCheck(session comm.IUserSession, req *pb.ArenaSetAttFormtReq) (errdata *pb.ErrorData) {
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
///设置防守阵型
|
|
||||||
func (this *apiComp) SetAttFormt(session comm.IUserSession, req *pb.ArenaSetAttFormtReq) (errdata *pb.ErrorData) {
|
|
||||||
var (
|
|
||||||
info *pb.DBArenaUser
|
|
||||||
heros []*pb.DBHero
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
if errdata = this.SetAttFormtCheck(session, req); errdata != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil {
|
|
||||||
errdata = &pb.ErrorData{
|
|
||||||
Code: pb.ErrorCode_DBError,
|
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if heros, err = this.module.modelArena.queryUserHeros(session.GetUserId(), req.Formt); err != nil {
|
|
||||||
errdata = &pb.ErrorData{
|
|
||||||
Code: pb.ErrorCode_DBError,
|
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
info.Attack = &pb.DBPlayerBattleFormt{
|
|
||||||
Leadpos: req.Leadpos,
|
|
||||||
Formt: heros,
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = this.module.modelArena.updateArenaUserInfo(info); err != nil {
|
|
||||||
errdata = &pb.ErrorData{
|
|
||||||
Code: pb.ErrorCode_DBError,
|
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
session.SendMsg(string(this.module.GetType()), "setattformt", &pb.ArenaSetAttFormtResp{Issucc: true})
|
|
||||||
return
|
|
||||||
}
|
|
@ -32,6 +32,7 @@ func (this *apiComp) SetDefFormt(session comm.IUserSession, req *pb.ArenaSetDefF
|
|||||||
var (
|
var (
|
||||||
info *pb.DBArenaUser
|
info *pb.DBArenaUser
|
||||||
heros []*pb.DBHero
|
heros []*pb.DBHero
|
||||||
|
ok bool
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if errdata = this.SetDefFormtCheck(session, req); errdata != nil {
|
if errdata = this.SetDefFormtCheck(session, req); errdata != nil {
|
||||||
@ -56,6 +57,21 @@ func (this *apiComp) SetDefFormt(session comm.IUserSession, req *pb.ArenaSetDefF
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ok = false
|
||||||
|
for _, v := range heros {
|
||||||
|
if v.Id != "" {
|
||||||
|
ok = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: "no found any hero",
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
info.Defend = &pb.DBPlayerBattleFormt{
|
info.Defend = &pb.DBPlayerBattleFormt{
|
||||||
Leadpos: req.Leadpos,
|
Leadpos: req.Leadpos,
|
||||||
Formt: heros,
|
Formt: heros,
|
||||||
|
Loading…
Reference in New Issue
Block a user