go_dreamfactory/modules/story/module.go

44 lines
1015 B
Go

package story
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
type Story struct {
modules.ModuleBase
modelStory *ModelStory
api *apiComp
}
func NewModule() core.IModule {
return &Story{}
}
func (this *Story) GetType() core.M_Modules {
return comm.ModuleStory
}
func (this *Story) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
func (this *Story) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelStory = this.RegisterComp(new(ModelStory)).(*ModelStory)
}
// 接口信息 给其他模块调用 用来修改主线关卡信息
func (this *Story) ModifyStoryData(uid string, objid string, data map[string]interface{}) (code pb.ErrorCode) {
err := this.modelStory.modifyStoryData(uid, objid, data)
if err != nil {
code = pb.ErrorCode_DBError
}
return
}