主线校验

This commit is contained in:
meixiongfeng 2022-07-06 19:50:05 +08:00
parent 9178a5b900
commit d10027f37c
3 changed files with 21 additions and 9 deletions

View File

@ -23,13 +23,10 @@ func (this *ModelStory) Init(service core.IService, module core.IModule, comp co
}
// 获取章节信息
func (this *ModelStory) getStoryList(uid string) ([]*pb.DBStory, error) {
storys := make([]*pb.DBStory, 0)
err := this.GetList(uid, &storys)
if err != nil {
return nil, err
}
return storys, nil
func (this *ModelStory) getStoryList(uid string) (storys []*pb.DBStory, err error) {
storys = make([]*pb.DBStory, 0)
err = this.GetList(uid, &storys)
return
}
// 修改章节信息

View File

@ -74,6 +74,10 @@ func (this *Story) CheckChallengeChapter(stroyId int32, uid string, zhangjieID i
code = pb.ErrorCode_ConfigNoFound
return
}
// 如果这一关是路线二的话
if configData.Area == 2 && curChapter.ChapterId > stroyId { // 当前的关卡ID 大于路线2的ID 即可
return
}
// 判断下一关是不是当前传入的值
if configData.Nextid != stroyId {
code = pb.ErrorCode_StoryIDFailed
@ -82,8 +86,19 @@ func (this *Story) CheckChallengeChapter(stroyId int32, uid string, zhangjieID i
}
break
case 2:
configData := this.configure.GetStoryHardChapter(curChapter.StoryId)
if configData != nil { // 校验章节
if configData.Zhangshu != zhangjieID {
code = pb.ErrorCode_ConfigNoFound
return
}
// 判断下一关是不是当前传入的值
if configData.Nextid != stroyId {
code = pb.ErrorCode_StoryIDFailed
return
}
}
break
}
return
}