package mainline import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" ) type ModelMainline struct { modules.MCompModel module *Mainline } func (this *ModelMainline) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.TableName = comm.TableMainline err = this.MCompModel.Init(service, module, comp, options) this.module = module.(*Mainline) return } // 获取章节信息 func (this *ModelMainline) getMainlineList(uid string) (storys []*pb.DBMainline, err error) { storys = make([]*pb.DBMainline, 0) err = this.GetList(uid, &storys) return } // 修改章节信息 func (this *ModelMainline) modifyMainlineData(uid string, objid string, data map[string]interface{}) error { return this.module.modelMainline.ChangeList(uid, objid, data) } // 增加新的章节数据 func (this *ModelMainline) addNewChapter(uId string, data map[string]interface{}) (err error) { if err = this.AddLists(uId, data); err != nil { this.module.Errorf("err:%v", err) return } return nil } // check NewCapter func (this *ModelMainline) checkNewCapter(chapter, intensity, id int32) *cfg.GameMainlineData { conf := this.module.configure.GetMainlineChapter(chapter) if conf != nil { nextChaptConfig := this.module.configure.GetMainlineChapterConfigData(intensity, chapter) // 查下一章节 if nextChaptConfig.Previoustage == id { return nextChaptConfig } } return nil } // 获取指定章节数据 func (this *ModelMainline) getOneChapterInfo(uid, obj string) *pb.DBMainline { data := &pb.DBMainline{} err := this.module.modelMainline.GetListObj(uid, obj, data) if err != nil { this.module.Errorf("%v", err) return nil } return data }