go_dreamfactory/modules/shop/module.go
2022-08-09 18:39:21 +08:00

53 lines
1.4 KiB
Go

package shop
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/sys/db"
)
/*
模块名:商店
描述:商城相关业务
开发:李伟
*/
func NewModule() core.IModule {
m := new(Shop)
return m
}
type Shop struct {
modules.ModuleBase
api_comp *apiComp
configure *configureComp
modelShop *modelShopComp
modelShopItems *modelShopItemsComp
}
//模块名
func (this *Shop) GetType() core.M_Modules {
return comm.ModuleShop
}
//模块初始化接口 注册用户创建角色事件
func (this *Shop) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
//装备组件
func (this *Shop) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelShop = this.RegisterComp(new(modelShopComp)).(*modelShopComp)
this.modelShopItems = this.RegisterComp(new(modelShopItemsComp)).(*modelShopItemsComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
//Event------------------------------------------------------------------------------------------------------------
func (this *Shop) EventUserOffline(session comm.IUserSession) {
this.modelShop.Del(session.GetUserId(), db.SetDBMgoLog(false))
this.modelShopItems.BatchDelLists(session.GetUserId())
}