优化
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) {
|
||||
var (
|
||||
pagoda *pb.DBPagoda
|
||||
err error
|
||||
)
|
||||
code = this.ChallengeCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
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)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
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 {
|
||||
// 塔数据校验
|
||||
seasonPagoda, err := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||
pagoda, err = this.module.modelPagoda.getPagodaList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
return
|
||||
}
|
||||
if pagoda.Complete {
|
||||
pagoda, err = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
return
|
||||
}
|
||||
if seasonPagoda.Type != req.PagodaType || conf.LayerNum-1 != seasonPagoda.PagodaId {
|
||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
||||
return
|
||||
}
|
||||
}
|
||||
if pagoda.Type != conf.PagodaType || conf.LayerNum-1 != pagoda.PagodaId {
|
||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
||||
return
|
||||
}
|
||||
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Ptype: pb.PlayType_pagoda,
|
||||
|
Loading…
Reference in New Issue
Block a user