From bf8a33eba41629e33504a65e2ac6b5903736d8e7 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Sun, 23 Apr 2023 14:50:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A7=E6=97=B6=E5=85=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 4 +++ modules/oldtimes/api.go | 20 ++++++++++++++ modules/oldtimes/configure.go | 23 ++++++++++++++++ modules/oldtimes/model_oldtimes.go | 21 +++++++++++++++ modules/oldtimes/module.go | 43 ++++++++++++++++++++++++++++++ services/worker/main.go | 2 ++ 6 files changed, 113 insertions(+) create mode 100644 modules/oldtimes/api.go create mode 100644 modules/oldtimes/configure.go create mode 100644 modules/oldtimes/model_oldtimes.go create mode 100644 modules/oldtimes/module.go diff --git a/comm/const.go b/comm/const.go index d0d97b589..f8227c5e5 100644 --- a/comm/const.go +++ b/comm/const.go @@ -85,6 +85,7 @@ const ( ModuleParkour core.M_Modules = "parkour" //跑酷系统 ModuleTools core.M_Modules = "tools" //工具 ModuleReputation core.M_Modules = "reputation" //阵营声望 + ModuleOldtimes core.M_Modules = "oldtimes" //旧时光 ) // 数据表名定义处 @@ -255,6 +256,9 @@ const ( TableParkourMatch = "parkourmatch" ///坐骑表 TableParkourMounts = "parkourmounts" + + //旧时光 + TableOldtimes = "oldtimes" ) // RPC服务接口定义处 diff --git a/modules/oldtimes/api.go b/modules/oldtimes/api.go new file mode 100644 index 000000000..586f72f46 --- /dev/null +++ b/modules/oldtimes/api.go @@ -0,0 +1,20 @@ +package oldtimes + +import ( + "go_dreamfactory/lego/base" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +type apiComp struct { + modules.MCompGate + service base.IRPCXService + module *Oldtimes +} + +func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + _ = this.MCompGate.Init(service, module, comp, options) + this.service = service.(base.IRPCXService) + this.module = module.(*Oldtimes) + return +} diff --git a/modules/oldtimes/configure.go b/modules/oldtimes/configure.go new file mode 100644 index 000000000..ff0cdb822 --- /dev/null +++ b/modules/oldtimes/configure.go @@ -0,0 +1,23 @@ +package oldtimes + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" + cfg "go_dreamfactory/sys/configure/structs" +) + +const ( + gameLinestoryMainTask = "game_linestroymaintask.json" +) + +type configureComp struct { + modules.MCompConfigure +} + +func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompConfigure.Init(service, module, comp, options) + err = this.LoadMultiConfigure(map[string]interface{}{ + gameLinestoryMainTask: cfg.NewGameLinestoryMainTask, + }) + return +} diff --git a/modules/oldtimes/model_oldtimes.go b/modules/oldtimes/model_oldtimes.go new file mode 100644 index 000000000..f87cd20ca --- /dev/null +++ b/modules/oldtimes/model_oldtimes.go @@ -0,0 +1,21 @@ +package oldtimes + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +type ModelOldtimes struct { + modules.MCompModel + moduleOldtimes *Oldtimes + service core.IService +} + +func (this *ModelOldtimes) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompModel.Init(service, module, comp, options) + this.TableName = comm.TableOldtimes + this.moduleOldtimes = module.(*Oldtimes) + this.service = service + return +} diff --git a/modules/oldtimes/module.go b/modules/oldtimes/module.go new file mode 100644 index 000000000..156ebdfa6 --- /dev/null +++ b/modules/oldtimes/module.go @@ -0,0 +1,43 @@ +package oldtimes + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/base" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + + +type Oldtimes struct { + modules.ModuleBase + api *apiComp + service base.IRPCXService + configure *configureComp + modelOldtimes *ModelOldtimes +} + +func NewModule() core.IModule { + return &Oldtimes{} +} + +func (this *Oldtimes) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { + err = this.ModuleBase.Init(service, module, options) + + return +} + +func (this *Oldtimes) OnInstallComp() { + this.ModuleBase.OnInstallComp() + this.api = this.RegisterComp(new(apiComp)).(*apiComp) + this.configure = this.RegisterComp(new(configureComp)).(*configureComp) + this.modelOldtimes = this.RegisterComp(new(ModelOldtimes)).(*ModelOldtimes) +} + +func (this *Oldtimes) GetType() core.M_Modules { + return comm.ModuleOldtimes +} + +func (this *Oldtimes) Start() (err error) { + err = this.ModuleBase.Start() + return +} diff --git a/services/worker/main.go b/services/worker/main.go index acfabc1fe..87f1b570c 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -27,6 +27,7 @@ import ( "go_dreamfactory/modules/mline" "go_dreamfactory/modules/moonfantasy" "go_dreamfactory/modules/notify" + "go_dreamfactory/modules/oldtimes" "go_dreamfactory/modules/pagoda" "go_dreamfactory/modules/parkour" "go_dreamfactory/modules/pay" @@ -121,6 +122,7 @@ func main() { parkour.NewModule(), tools.NewModule(), reputation.NewModule(), + oldtimes.NewModule(), ) }