go_dreamfactory/modules/privilege/model_privilege.go
2022-11-04 15:22:13 +08:00

29 lines
720 B
Go

package privilege
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
///论坛 数据组件
type modelShopComp struct {
modules.MCompModel
module *Privilege
}
//组件初始化接口
func (this *modelShopComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
this.MCompModel.Init(service, module, comp, opt)
this.module = module.(*Privilege)
this.TableName = comm.TableShop
//创建uid索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}