go_dreamfactory/modules/shopcenter/module.go
2023-08-02 15:03:27 +08:00

65 lines
1.4 KiB
Go

package shopcenter
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
type ShopCenter struct {
modules.ModuleBase
service core.IService
api *apiComp
configure *configureComp
modelshop *ModelShop
mainline comm.IMainline
open bool
}
func NewModule() core.IModule {
return &ShopCenter{}
}
func (this *ShopCenter) GetType() core.M_Modules {
return comm.ModuleHeroTask
}
func (this *ShopCenter) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service
return
}
func (this *ShopCenter) Start() (err error) {
err = this.ModuleBase.Start()
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleMainline); err != nil {
return
}
this.mainline = module.(comm.IMainline)
return
}
func (this *ShopCenter) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelshop = this.RegisterComp(new(ModelShop)).(*ModelShop)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
// 活动开启
func (this *ShopCenter) ActivityNotice(hdlist *pb.DBHuodong) {
switch hdlist.Itype {
case comm.XSFundPhysical:
this.open = true
break
case comm.XSFundRecruit:
this.open = true
break
case comm.XSFundExp:
this.open = true
break
}
}