配置读取修改 数据校验
This commit is contained in:
parent
e1d2237b30
commit
ceef317391
@ -42,39 +42,33 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if curChapter == nil { // 校验是不是新的数据
|
if curChapter == nil { // 校验是不是新的数据
|
||||||
if stageConf.Previoustage == 0 { // 创建一条新的章节数据
|
preStage := this.module.configure.GetPreMainChapter(req.StageId) // 新章节数据校验
|
||||||
chapter := this.module.configure.GetPreMainChapter(req.StageId) // 新章节数据校验
|
preStageConf := this.module.configure.GetMainStageConf(preStage)
|
||||||
bCheck := false
|
if stageConf == nil { // 配置文件校验
|
||||||
if chapter == 0 {
|
code = pb.ErrorCode_MainlineNotFindChapter
|
||||||
bCheck = true
|
return
|
||||||
} else {
|
}
|
||||||
for _, v := range list {
|
|
||||||
if chapter == v.ChapterId { // 有上一章节数据
|
|
||||||
if _, ok := v.Star[stageConf.Previoustage]; ok {
|
|
||||||
bCheck = true
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if bCheck {
|
for _, v := range list {
|
||||||
newData := &pb.DBMline{
|
if preStageConf.CaptainId == v.ChapterId { // 有上一章节数据
|
||||||
Id: primitive.NewObjectID().Hex(),
|
if _, ok := v.Star[v.StageId]; ok {
|
||||||
Uid: session.GetUserId(),
|
newData := &pb.DBMline{
|
||||||
CType: stageConf.Episodetype,
|
Id: primitive.NewObjectID().Hex(),
|
||||||
ChapterId: stageConf.Chapterid,
|
Uid: session.GetUserId(),
|
||||||
StageId: stageConf.Id,
|
CType: stageConf.Episodetype,
|
||||||
Star: map[int32]int32{},
|
ChapterId: stageConf.Chapterid,
|
||||||
Award: map[int32]bool{},
|
StageId: stageConf.Id,
|
||||||
Ps: map[int32]int32{},
|
Star: map[int32]int32{},
|
||||||
|
Award: map[int32]bool{},
|
||||||
|
Ps: map[int32]int32{},
|
||||||
|
}
|
||||||
|
this.module.modelMline.addNewChapter(session.GetUserId(), newData)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
this.module.modelMline.addNewChapter(session.GetUserId(), newData)
|
|
||||||
} else {
|
|
||||||
code = pb.ErrorCode_MainlineNotFindChapter
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
code = pb.ErrorCode_MainlineNotFindChapter
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := curChapter.Ps[req.StageId]; ok && v > 0 {
|
if v, ok := curChapter.Ps[req.StageId]; ok && v > 0 {
|
||||||
@ -109,9 +103,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
|||||||
this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, map[string]interface{}{
|
this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, map[string]interface{}{
|
||||||
"ps": curChapter.Ps,
|
"ps": curChapter.Ps,
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||||
Ptype: pb.PlayType_mainline,
|
Ptype: pb.PlayType_mainline,
|
||||||
Title: "",
|
Title: "",
|
||||||
|
@ -73,20 +73,13 @@ func (this *configureComp) GetMainStageConf(id int32) (data *cfg.GameMainStageDa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取上一章节信息
|
// 获取上一关卡信息
|
||||||
func (this *configureComp) GetPreMainChapter(id int32) (stageID int32) {
|
func (this *configureComp) GetPreMainChapter(stageId int32) (preStageID int32) {
|
||||||
if v, err := this.GetConfigure(game_mainchapter); err == nil {
|
if v, err := this.GetConfigure(game_mainstage); err == nil {
|
||||||
if configure, ok := v.(*cfg.GameMainChapter); ok {
|
if configure, ok := v.(*cfg.GameMainStage); ok {
|
||||||
for index, v1 := range configure.GetDataList() {
|
for _, v1 := range configure.GetDataList() {
|
||||||
if v1.Id == id {
|
if v1.Previoustage == stageId {
|
||||||
if index > 0 {
|
preStageID = v1.Id
|
||||||
data := configure.GetDataList()[index-1]
|
|
||||||
if v1.ChapterType != data.ChapterType { // 章节类型必须一致
|
|
||||||
stageID = data.Id
|
|
||||||
}
|
|
||||||
} else { // 第一章节
|
|
||||||
stageID = 0
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user