修改gm模块为web模块
This commit is contained in:
parent
4573ab8a64
commit
4e1db72bce
@ -29,7 +29,7 @@ const (
|
|||||||
//模块名定义处
|
//模块名定义处
|
||||||
const (
|
const (
|
||||||
ModuleGate core.M_Modules = "gateway" //gate模块 网关服务模块
|
ModuleGate core.M_Modules = "gateway" //gate模块 网关服务模块
|
||||||
ModuleGM core.M_Modules = "gm" //gm模块
|
ModuleWeb core.M_Modules = "web" //gm模块
|
||||||
ModuleUser core.M_Modules = "user" //用户模块
|
ModuleUser core.M_Modules = "user" //用户模块
|
||||||
ModulePack core.M_Modules = "pack" //背包模块
|
ModulePack core.M_Modules = "pack" //背包模块
|
||||||
ModuleMail core.M_Modules = "mail" //邮件模块
|
ModuleMail core.M_Modules = "mail" //邮件模块
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package gm
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
@ -15,7 +15,7 @@ import (
|
|||||||
type Api_Comp struct {
|
type Api_Comp struct {
|
||||||
cbase.ModuleCompBase
|
cbase.ModuleCompBase
|
||||||
options *Options //模块参数
|
options *Options //模块参数
|
||||||
module *GM //当前模块对象
|
module *Web //当前模块对象
|
||||||
gin gin.ISys //gin 框架 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) {
|
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)
|
err = this.ModuleCompBase.Init(service, module, comp, options)
|
||||||
this.options = options.(*Options)
|
this.options = options.(*Options)
|
||||||
this.module = module.(*GM)
|
this.module = module.(*Web)
|
||||||
this.gin, err = gin.NewSys(gin.SetListenPort(this.options.Port))
|
this.gin, err = gin.NewSys(gin.SetListenPort(this.options.Port))
|
||||||
this.suitableMethods() //发射注册api
|
this.suitableMethods() //发射注册api
|
||||||
return
|
return
|
@ -1,4 +1,4 @@
|
|||||||
package gm
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/sys/gin"
|
"go_dreamfactory/lego/sys/gin"
|
@ -1,4 +1,4 @@
|
|||||||
package gm
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/sys/gin/engine"
|
"go_dreamfactory/lego/sys/gin/engine"
|
@ -1,4 +1,4 @@
|
|||||||
package gm
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -1,4 +1,4 @@
|
|||||||
package gm
|
package web
|
||||||
|
|
||||||
import "go_dreamfactory/pb"
|
import "go_dreamfactory/pb"
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package gm
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
@ -12,12 +12,12 @@ import (
|
|||||||
//公告数据模块
|
//公告数据模块
|
||||||
type modelNotifyComp struct {
|
type modelNotifyComp struct {
|
||||||
modules.MCompModel
|
modules.MCompModel
|
||||||
module *GM
|
module *Web
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *modelNotifyComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
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.MCompModel.Init(service, module, comp, opt)
|
||||||
this.module = module.(*GM)
|
this.module = module.(*Web)
|
||||||
this.TableName = "notify"
|
this.TableName = "notify"
|
||||||
return
|
return
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package gm
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -14,12 +14,12 @@ import (
|
|||||||
//用户数据模块
|
//用户数据模块
|
||||||
type modelUserComp struct {
|
type modelUserComp struct {
|
||||||
modules.MCompModel
|
modules.MCompModel
|
||||||
module *GM
|
module *Web
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *modelUserComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
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.MCompModel.Init(service, module, comp, opt)
|
||||||
this.module = module.(*GM)
|
this.module = module.(*Web)
|
||||||
this.TableName = "user"
|
this.TableName = "user"
|
||||||
return
|
return
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package gm
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -9,16 +9,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
模块名:gm
|
模块名:web
|
||||||
描述:提供管理员相关的http接口
|
描述:提供管理员相关的http接口
|
||||||
开发:李伟
|
开发:李伟
|
||||||
*/
|
*/
|
||||||
func NewModule() core.IModule {
|
func NewModule() core.IModule {
|
||||||
m := new(GM)
|
m := new(Web)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
type GM struct {
|
type Web struct {
|
||||||
cbase.ModuleBase
|
cbase.ModuleBase
|
||||||
options *Options
|
options *Options
|
||||||
api_comp *Api_Comp //提供weba pi服务的组件
|
api_comp *Api_Comp //提供weba pi服务的组件
|
||||||
@ -28,22 +28,22 @@ type GM struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//模块名
|
//模块名
|
||||||
func (this *GM) GetType() core.M_Modules {
|
func (this *Web) GetType() core.M_Modules {
|
||||||
return comm.ModuleGM
|
return comm.ModuleWeb
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块自定义参数
|
//模块自定义参数
|
||||||
func (this *GM) NewOptions() (options core.IModuleOptions) {
|
func (this *Web) NewOptions() (options core.IModuleOptions) {
|
||||||
return new(Options)
|
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)
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
this.options = options.(*Options)
|
this.options = options.(*Options)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GM) OnInstallComp() {
|
func (this *Web) OnInstallComp() {
|
||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp)
|
this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp)
|
||||||
this.modelUser = this.RegisterComp(new(modelUserComp)).(*modelUserComp)
|
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() {
|
if this.options.GetDebug() {
|
||||||
this.options.GetLog().Debugf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
|
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() {
|
if this.options.GetDebug() {
|
||||||
this.options.GetLog().Infof(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
|
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 {
|
if this.options.Debug {
|
||||||
this.options.GetLog().Warnf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
|
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 {
|
if this.options.GetLog() != nil {
|
||||||
this.options.GetLog().Errorf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
|
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 {
|
if this.options.GetLog() != nil {
|
||||||
this.options.GetLog().Panicf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
|
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 {
|
if this.options.GetLog() != nil {
|
||||||
this.options.GetLog().Fatalf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
|
this.options.GetLog().Fatalf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package gm
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/utils/mapstructure"
|
"go_dreamfactory/lego/utils/mapstructure"
|
@ -3,8 +3,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go_dreamfactory/modules/gm"
|
|
||||||
"go_dreamfactory/modules/mgolog"
|
"go_dreamfactory/modules/mgolog"
|
||||||
|
"go_dreamfactory/modules/web"
|
||||||
"go_dreamfactory/services"
|
"go_dreamfactory/services"
|
||||||
"go_dreamfactory/sys/cache"
|
"go_dreamfactory/sys/cache"
|
||||||
"go_dreamfactory/sys/db"
|
"go_dreamfactory/sys/db"
|
||||||
@ -35,7 +35,7 @@ func main() {
|
|||||||
)
|
)
|
||||||
lego.Run(s, //运行模块
|
lego.Run(s, //运行模块
|
||||||
mgolog.NewModule(),
|
mgolog.NewModule(),
|
||||||
gm.NewModule(),
|
web.NewModule(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user