39 lines
929 B
Go
39 lines
929 B
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
|
|
moduleStory *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.moduleStory = module.(*Story)
|
|
this.TableName = string(TableStory)
|
|
return
|
|
}
|
|
|
|
// 获取章节信息
|
|
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) modifyStoryData(uid string, objid string, data map[string]interface{}) error {
|
|
return this.moduleStory.modelStory.ChangeList(uid, objid, data)
|
|
}
|