57 lines
1.3 KiB
Go
57 lines
1.3 KiB
Go
package pagoda
|
|
|
|
import (
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
const ( //Redis
|
|
TablePagoda core.SqlTable = "pagoda"
|
|
)
|
|
|
|
type ModelPagoda struct {
|
|
modules.MCompModel
|
|
module *Pagoda
|
|
}
|
|
|
|
func (this *ModelPagoda) 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.(*Pagoda)
|
|
this.TableName = string(TablePagoda)
|
|
return
|
|
}
|
|
|
|
// 获取爬塔信息
|
|
func (this *ModelPagoda) getPagodaList(uid string) (storys []*pb.DBMainline, err error) {
|
|
storys = make([]*pb.DBMainline, 0)
|
|
err = this.GetList(uid, &storys)
|
|
return
|
|
}
|
|
|
|
// 修改爬塔数据信息
|
|
func (this *ModelPagoda) modifyPagodaDataByObjId(uid string, objid string, data map[string]interface{}) error {
|
|
return this.ChangeList(uid, objid, data)
|
|
}
|
|
|
|
// 创建一个新的塔数据
|
|
func (this *ModelPagoda) addNewPagoda(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
|
|
}
|
|
|
|
// 获取指定塔数据
|
|
func (this *ModelPagoda) getPagodaByObjId(uid, obj string) *pb.DBMainline {
|
|
data := &pb.DBMainline{}
|
|
err := this.GetListObj(uid, obj, data)
|
|
if err != nil {
|
|
this.module.Errorf("%v", err)
|
|
return nil
|
|
}
|
|
return data
|
|
}
|