go_dreamfactory/modules/story/model_story.go

46 lines
1.1 KiB
Go

package story
import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
const ( //Redis
TableStory core.SqlTable = "story"
)
type ModelStory struct {
modules.MCompModel
module *Story
}
func (this *ModelStory) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Story)
this.TableName = string(TableStory)
return
}
// 获取章节信息
func (this *ModelStory) getStoryList(uid string) (storys []*pb.DBStory, err error) {
storys = make([]*pb.DBStory, 0)
err = this.GetList(uid, &storys)
return
}
// 修改章节信息
func (this *ModelStory) modifyStoryData(uid string, objid string, data map[string]interface{}) error {
return this.module.modelStory.ChangeList(uid, objid, data)
}
// 增加新的章节数据
func (this *ModelStory) 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
}