优化
This commit is contained in:
parent
d1fb30e587
commit
a05f57c626
@ -18,43 +18,36 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.PagodaCha
|
|||||||
|
|
||||||
///挑战主线关卡
|
///挑战主线关卡
|
||||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChallengeReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChallengeReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
|
var (
|
||||||
|
pagoda *pb.DBPagoda
|
||||||
|
err error
|
||||||
|
)
|
||||||
code = this.ChallengeCheck(session, req)
|
code = this.ChallengeCheck(session, req)
|
||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
// 校验是不是通关了普通塔
|
|
||||||
expand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
|
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
conf := this.module.configure.GetPagodaConfigData(req.PagodaType, req.LevelID)
|
conf := this.module.configure.GetPagodaConfigData(req.PagodaType, req.LevelID)
|
||||||
if conf == nil {
|
if conf == nil {
|
||||||
code = pb.ErrorCode_PagodaNotFound
|
code = pb.ErrorCode_PagodaNotFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !expand.CompletePagoda {
|
|
||||||
pagoda, err := this.module.modelPagoda.getPagodaList(session.GetUserId())
|
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_PagodaNotFound
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if pagoda.Type != conf.PagodaType || conf.LayerNum-1 != pagoda.PagodaId {
|
|
||||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
pagoda, err = this.module.modelPagoda.getPagodaList(session.GetUserId())
|
||||||
// 塔数据校验
|
if err != nil {
|
||||||
seasonPagoda, err := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
code = pb.ErrorCode_PagodaNotFound
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if pagoda.Complete {
|
||||||
|
pagoda, err = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_PagodaNotFound
|
code = pb.ErrorCode_PagodaNotFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if seasonPagoda.Type != req.PagodaType || conf.LayerNum-1 != seasonPagoda.PagodaId {
|
}
|
||||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
if pagoda.Type != conf.PagodaType || conf.LayerNum-1 != pagoda.PagodaId {
|
||||||
return
|
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
||||||
}
|
return
|
||||||
}
|
}
|
||||||
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||||
Ptype: pb.PlayType_pagoda,
|
Ptype: pb.PlayType_pagoda,
|
||||||
|
Loading…
Reference in New Issue
Block a user