diff --git a/modules/pagoda/api.go b/modules/pagoda/api.go index f176e0cbf..0ccb8dc79 100644 --- a/modules/pagoda/api.go +++ b/modules/pagoda/api.go @@ -16,7 +16,7 @@ const ( PagodaActivateResp = "activate" PagodaWarOrderResp = "warorder" PagodaChallengeRaceResp = "challengerace" - PagodaChallengeRaceOverResp = "challengeoverrace" + PagodaChallengeRaceOverResp = "challengeraceover" PagodaGetRaceResp = "getrace" ) diff --git a/modules/pagoda/api_racechallenge.go b/modules/pagoda/api_racechallenge.go index 3dfb50aa7..1dc18fbbf 100644 --- a/modules/pagoda/api_racechallenge.go +++ b/modules/pagoda/api_racechallenge.go @@ -7,7 +7,7 @@ import ( ) //参数校验 -func (this *apiComp) CallengeRaceCheck(session comm.IUserSession, req *pb.PagodaChallengeRaceReq) (errdata *pb.ErrorData) { +func (this *apiComp) ChallengeRaceCheck(session comm.IUserSession, req *pb.PagodaChallengeRaceReq) (errdata *pb.ErrorData) { if req.Cid <= 0 { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ReqParameterError, @@ -19,13 +19,13 @@ func (this *apiComp) CallengeRaceCheck(session comm.IUserSession, req *pb.Pagoda } ///阵营塔开始挑战 -func (this *apiComp) CallengeRace(session comm.IUserSession, req *pb.PagodaChallengeRaceReq) (errdata *pb.ErrorData) { +func (this *apiComp) ChallengeRace(session comm.IUserSession, req *pb.PagodaChallengeRaceReq) (errdata *pb.ErrorData) { var ( - pagoda *pb.DBPagodaRace - err error - timeCheckOk bool + pagoda *pb.DBPagodaRace + err error + //timeCheckOk bool ) - if errdata = this.CallengeRaceCheck(session, req); errdata != nil { + if errdata = this.ChallengeRaceCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } @@ -40,23 +40,23 @@ func (this *apiComp) CallengeRace(session comm.IUserSession, req *pb.PagodaChall } // 判断开启时间 - curWeekDay := int32(configure.Now().Weekday()) - if curWeekDay == 0 { - curWeekDay = 7 - } - for _, v := range conf.Openingtime { - if v == curWeekDay { - timeCheckOk = true - break - } - } - if !timeCheckOk { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_PagodaTimeError, - Title: pb.ErrorCode_PagodaTimeError.ToString(), - } - return - } + // curWeekDay := int32(configure.Now().Weekday()) + // if curWeekDay == 0 { + // curWeekDay = 7 + // } + // for _, v := range conf.Openingtime { + // if v == curWeekDay { + // timeCheckOk = true + // break + // } + // } + // if !timeCheckOk { + // errdata = &pb.ErrorData{ + // Code: pb.ErrorCode_PagodaTimeError, + // Title: pb.ErrorCode_PagodaTimeError.ToString(), + // } + // return + // } pagoda, err = this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId()) if err != nil { errdata = &pb.ErrorData{ diff --git a/modules/pagoda/api_racechallengeover.go b/modules/pagoda/api_racechallengeover.go index 4d5d05a00..2512aef62 100644 --- a/modules/pagoda/api_racechallengeover.go +++ b/modules/pagoda/api_racechallengeover.go @@ -21,12 +21,12 @@ func (this *apiComp) ChallengeRaceOverCheck(session comm.IUserSession, req *pb.P ///挑战主线关卡 func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.PagodaChallengeRaceOverReq) (errdata *pb.ErrorData) { var ( - mapData map[string]interface{} - race *pb.DBPagodaRace - isWin bool - err error - atno []*pb.UserAtno // 通关奖励 - timeCheckOk bool // 开启条件校验 + mapData map[string]interface{} + race *pb.DBPagodaRace + isWin bool + err error + atno []*pb.UserAtno // 通关奖励 + //timeCheckOk bool // 开启条件校验 ) mapData = make(map[string]interface{}, 0) if errdata = this.ChallengeRaceOverCheck(session, req); errdata != nil { @@ -44,23 +44,23 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda } // 判断开启时间 - curWeekDay := int32(configure.Now().Weekday()) - if curWeekDay == 0 { - curWeekDay = 7 - } - for _, v := range conf.Openingtime { - if v == curWeekDay { - timeCheckOk = true - break - } - } - if !timeCheckOk { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_PagodaTimeError, - Title: pb.ErrorCode_PagodaTimeError.ToString(), - } - return - } + // curWeekDay := int32(configure.Now().Weekday()) + // if curWeekDay == 0 { + // curWeekDay = 7 + // } + // for _, v := range conf.Openingtime { + // if v == curWeekDay { + // timeCheckOk = true + // break + // } + // } + // if !timeCheckOk { + // errdata = &pb.ErrorData{ + // Code: pb.ErrorCode_PagodaTimeError, + // Title: pb.ErrorCode_PagodaTimeError.ToString(), + // } + // return + // } race, err = this.module.modelRacePagoda.getPagodaRaceList(session.GetUserId()) if err != nil { @@ -127,16 +127,23 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda } race.Race[conf.Restriction].Curfloor += 1 + race.Race[conf.Restriction].Defeat += 1 race.Race[conf.Restriction].Task = conf.Fightevents mapData["race"] = race.Race - errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData) + if err = this.module.modelRacePagoda.ModifyPagodaRaceDataByObjId(session.GetUserId(), mapData); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + } // 通关奖励 if errdata, atno = this.module.DispenseAtno(session, conf.Reward, true); errdata != nil { return } session.SendMsg(string(this.module.GetType()), PagodaChallengeRaceOverResp, &pb.PagodaChallengeRaceOverResp{ - Race: race.Race[0], + Race: race.Race[conf.Restriction], Reward: atno, }) diff --git a/modules/pagoda/model_race.go b/modules/pagoda/model_race.go index bf28fbfc1..6c82b3327 100644 --- a/modules/pagoda/model_race.go +++ b/modules/pagoda/model_race.go @@ -46,7 +46,7 @@ func (this *ModelRace) getPagodaRaceList(uid string) (result *pb.DBPagodaRace, e } // 修改爬塔数据信息 -func (this *ModelRace) modifyPagodaRaceDataByObjId(uid string, data map[string]interface{}) error { +func (this *ModelRace) ModifyPagodaRaceDataByObjId(uid string, data map[string]interface{}) error { return this.Change(uid, data) }