diff --git a/modules/mline/comp_configure.go b/modules/mline/comp_configure.go index 86d91cd04..2faa4de69 100644 --- a/modules/mline/comp_configure.go +++ b/modules/mline/comp_configure.go @@ -170,12 +170,12 @@ func (this *configureComp) GMGetPreStage(chapterID int32) (chapter []int32) { if v, err := this.GetConfigure(game_mainchapter); err == nil { if configure, ok := v.(*cfg.GameMainChapter); ok { for _, conf := range configure.GetDataList() { - if conf.ChapterType == curChapter.ChapterType { - if chapterID == conf.Id { - break - } - chapter = append(chapter, conf.Id) + //if conf.ChapterType == curChapter.ChapterType { + if chapterID == conf.Id { + break } + chapter = append(chapter, conf.Id) + //} } } } diff --git a/modules/mline/module.go b/modules/mline/module.go index 119ad8548..a8e79467d 100644 --- a/modules/mline/module.go +++ b/modules/mline/module.go @@ -95,6 +95,9 @@ func (this *Mline) CheckPoint(uid string) bool { // 参数 难度 + 章节id func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) (errdata *pb.ErrorData) { var del []string + var newChapter []int32 + var _mp map[int32]int32 + _mp = make(map[int32]int32) connf, err := this.configure.GetMainStageConf(id) if err != nil { errdata = &pb.ErrorData{ @@ -120,7 +123,6 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) this.modelMline.cleanChapterDataById(session.GetUserId(), del...) _data := this.configure.GetAllStageByChapterID(connf.Chapterid) - newData := &pb.DBMline{ Id: primitive.NewObjectID().Hex(), Uid: session.GetUserId(), @@ -136,6 +138,16 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) newData.Star[v] = 7 } } + itype := this.configure.GetMainChapterConf(connf.Chapterid).ChapterType + if _, ok := _mp[itype]; !ok { + _mp[itype] = newData.StageId + } + for k, v := range _mp { + if k == itype && v <= newData.StageId { + _mp[itype] = newData.StageId + } + } + newChapter = append(newChapter, connf.Chapterid) // 更新 this.modelMline.addNewChapter(session.GetUserId(), newData) // 获取之前的章节数据 for _, v := range this.configure.GMGetPreStage(connf.Chapterid) { @@ -156,30 +168,21 @@ func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) newData.StageId = v } } + itype := this.configure.GetMainChapterConf(v).ChapterType + if _, ok := _mp[itype]; !ok { + _mp[itype] = newData.StageId + } + for k, v := range _mp { + if k == itype && v <= newData.StageId { + _mp[itype] = newData.StageId + } + } + newChapter = append(newChapter, v) // 更新 this.modelMline.addNewChapter(session.GetUserId(), newData) } // 修改扩展数据 - if rst, err := this.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度 - _mp := rst.Mline - var cType int32 - conf := this.configure.GetMainChapterConf(connf.Chapterid) - if conf != nil { - cType = conf.ChapterType - } - if _mp == nil { - _mp = make(map[int32]int32, 1) - _mp[cType] = id - } else { - if v, ok := _mp[cType]; ok { - if v <= id { - _mp[cType] = id - } - } else { - _mp[cType] = id - } - } - + if _, err := this.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度 this.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{ "mline": _mp, })