From 4e1db72bce7281efebfa049198a629ba6a13b288 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 25 Jul 2022 16:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9gm=E6=A8=A1=E5=9D=97=E4=B8=BA?= =?UTF-8?q?web=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 2 +- modules/{gm => web}/api.go | 6 ++--- modules/{gm => web}/api_createnotify.go | 2 +- modules/{gm => web}/api_register.go | 2 +- modules/{gm => web}/config.go | 2 +- modules/{gm => web}/core.go | 2 +- modules/{gm => web}/modelNotify.go | 6 ++--- modules/{gm => web}/modelUser.go | 6 ++--- modules/{gm => web}/module.go | 30 ++++++++++++------------- modules/{gm => web}/options.go | 2 +- services/mainte/main.go | 4 ++-- 11 files changed, 32 insertions(+), 32 deletions(-) rename modules/{gm => web}/api.go (94%) rename modules/{gm => web}/api_createnotify.go (99%) rename modules/{gm => web}/api_register.go (98%) rename modules/{gm => web}/config.go (98%) rename modules/{gm => web}/core.go (93%) rename modules/{gm => web}/modelNotify.go (94%) rename modules/{gm => web}/modelUser.go (93%) rename modules/{gm => web}/module.go (70%) rename modules/{gm => web}/options.go (97%) diff --git a/comm/const.go b/comm/const.go index 9c3871b12..f1240d41a 100644 --- a/comm/const.go +++ b/comm/const.go @@ -29,7 +29,7 @@ const ( //模块名定义处 const ( ModuleGate core.M_Modules = "gateway" //gate模块 网关服务模块 - ModuleGM core.M_Modules = "gm" //gm模块 + ModuleWeb core.M_Modules = "web" //gm模块 ModuleUser core.M_Modules = "user" //用户模块 ModulePack core.M_Modules = "pack" //背包模块 ModuleMail core.M_Modules = "mail" //邮件模块 diff --git a/modules/gm/api.go b/modules/web/api.go similarity index 94% rename from modules/gm/api.go rename to modules/web/api.go index 2ec464dd4..e3ba489f9 100644 --- a/modules/gm/api.go +++ b/modules/web/api.go @@ -1,4 +1,4 @@ -package gm +package web import ( "go_dreamfactory/lego/core" @@ -15,7 +15,7 @@ import ( type Api_Comp struct { cbase.ModuleCompBase options *Options //模块参数 - module *GM //当前模块对象 + module *Web //当前模块对象 gin gin.ISys //gin 框架 web的热门框架 } @@ -23,7 +23,7 @@ type Api_Comp struct { func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.ModuleCompBase.Init(service, module, comp, options) this.options = options.(*Options) - this.module = module.(*GM) + this.module = module.(*Web) this.gin, err = gin.NewSys(gin.SetListenPort(this.options.Port)) this.suitableMethods() //发射注册api return diff --git a/modules/gm/api_createnotify.go b/modules/web/api_createnotify.go similarity index 99% rename from modules/gm/api_createnotify.go rename to modules/web/api_createnotify.go index c4045b4e6..5bbc6a497 100644 --- a/modules/gm/api_createnotify.go +++ b/modules/web/api_createnotify.go @@ -1,4 +1,4 @@ -package gm +package web import ( "go_dreamfactory/lego/sys/gin" diff --git a/modules/gm/api_register.go b/modules/web/api_register.go similarity index 98% rename from modules/gm/api_register.go rename to modules/web/api_register.go index 85641b0fa..25a97ff6e 100644 --- a/modules/gm/api_register.go +++ b/modules/web/api_register.go @@ -1,4 +1,4 @@ -package gm +package web import ( "go_dreamfactory/lego/sys/gin/engine" diff --git a/modules/gm/config.go b/modules/web/config.go similarity index 98% rename from modules/gm/config.go rename to modules/web/config.go index a3dff571f..b714579a9 100644 --- a/modules/gm/config.go +++ b/modules/web/config.go @@ -1,4 +1,4 @@ -package gm +package web import ( "fmt" diff --git a/modules/gm/core.go b/modules/web/core.go similarity index 93% rename from modules/gm/core.go rename to modules/web/core.go index 27fdba7a7..f4eb91b6b 100644 --- a/modules/gm/core.go +++ b/modules/web/core.go @@ -1,4 +1,4 @@ -package gm +package web import "go_dreamfactory/pb" diff --git a/modules/gm/modelNotify.go b/modules/web/modelNotify.go similarity index 94% rename from modules/gm/modelNotify.go rename to modules/web/modelNotify.go index 448fe119e..f9fd5b6d3 100644 --- a/modules/gm/modelNotify.go +++ b/modules/web/modelNotify.go @@ -1,4 +1,4 @@ -package gm +package web import ( "go_dreamfactory/lego/core" @@ -12,12 +12,12 @@ import ( //公告数据模块 type modelNotifyComp struct { modules.MCompModel - module *GM + module *Web } func (this *modelNotifyComp) 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.(*GM) + this.module = module.(*Web) this.TableName = "notify" return } diff --git a/modules/gm/modelUser.go b/modules/web/modelUser.go similarity index 93% rename from modules/gm/modelUser.go rename to modules/web/modelUser.go index cb39401af..8e7fe4f56 100644 --- a/modules/gm/modelUser.go +++ b/modules/web/modelUser.go @@ -1,4 +1,4 @@ -package gm +package web import ( "fmt" @@ -14,12 +14,12 @@ import ( //用户数据模块 type modelUserComp struct { modules.MCompModel - module *GM + module *Web } func (this *modelUserComp) 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.(*GM) + this.module = module.(*Web) this.TableName = "user" return } diff --git a/modules/gm/module.go b/modules/web/module.go similarity index 70% rename from modules/gm/module.go rename to modules/web/module.go index 85c1329c9..3a8715420 100644 --- a/modules/gm/module.go +++ b/modules/web/module.go @@ -1,4 +1,4 @@ -package gm +package web import ( "fmt" @@ -9,16 +9,16 @@ import ( ) /* -模块名:gm +模块名:web 描述:提供管理员相关的http接口 开发:李伟 */ func NewModule() core.IModule { - m := new(GM) + m := new(Web) return m } -type GM struct { +type Web struct { cbase.ModuleBase options *Options api_comp *Api_Comp //提供weba pi服务的组件 @@ -28,22 +28,22 @@ type GM struct { } //模块名 -func (this *GM) GetType() core.M_Modules { - return comm.ModuleGM +func (this *Web) GetType() core.M_Modules { + return comm.ModuleWeb } //模块自定义参数 -func (this *GM) NewOptions() (options core.IModuleOptions) { +func (this *Web) NewOptions() (options core.IModuleOptions) { return new(Options) } -func (this *GM) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { +func (this *Web) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) this.options = options.(*Options) return } -func (this *GM) OnInstallComp() { +func (this *Web) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp) this.modelUser = this.RegisterComp(new(modelUserComp)).(*modelUserComp) @@ -52,32 +52,32 @@ func (this *GM) OnInstallComp() { } //日志 -func (this *GM) Debugf(format string, a ...interface{}) { +func (this *Web) Debugf(format string, a ...interface{}) { if this.options.GetDebug() { this.options.GetLog().Debugf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) } } -func (this *GM) Infof(format string, a ...interface{}) { +func (this *Web) Infof(format string, a ...interface{}) { if this.options.GetDebug() { this.options.GetLog().Infof(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) } } -func (this *GM) Warnf(format string, a ...interface{}) { +func (this *Web) Warnf(format string, a ...interface{}) { if this.options.Debug { this.options.GetLog().Warnf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) } } -func (this *GM) Errorf(format string, a ...interface{}) { +func (this *Web) Errorf(format string, a ...interface{}) { if this.options.GetLog() != nil { this.options.GetLog().Errorf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) } } -func (this *GM) Panicf(format string, a ...interface{}) { +func (this *Web) Panicf(format string, a ...interface{}) { if this.options.GetLog() != nil { this.options.GetLog().Panicf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) } } -func (this *GM) Fatalf(format string, a ...interface{}) { +func (this *Web) Fatalf(format string, a ...interface{}) { if this.options.GetLog() != nil { this.options.GetLog().Fatalf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) } diff --git a/modules/gm/options.go b/modules/web/options.go similarity index 97% rename from modules/gm/options.go rename to modules/web/options.go index 014d10431..37c740d7a 100644 --- a/modules/gm/options.go +++ b/modules/web/options.go @@ -1,4 +1,4 @@ -package gm +package web import ( "go_dreamfactory/lego/utils/mapstructure" diff --git a/services/mainte/main.go b/services/mainte/main.go index 9a1d6db47..a8e20035c 100644 --- a/services/mainte/main.go +++ b/services/mainte/main.go @@ -3,8 +3,8 @@ package main import ( "flag" "fmt" - "go_dreamfactory/modules/gm" "go_dreamfactory/modules/mgolog" + "go_dreamfactory/modules/web" "go_dreamfactory/services" "go_dreamfactory/sys/cache" "go_dreamfactory/sys/db" @@ -35,7 +35,7 @@ func main() { ) lego.Run(s, //运行模块 mgolog.NewModule(), - gm.NewModule(), + web.NewModule(), ) }