126 lines
3.5 KiB
Go
126 lines
3.5 KiB
Go
package web
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
|
|
"go_dreamfactory/lego/base"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/lego/core/cbase"
|
|
"go_dreamfactory/lego/sys/log"
|
|
)
|
|
|
|
/*
|
|
模块名:web
|
|
描述:提供管理员相关的http接口
|
|
开发:李伟
|
|
*/
|
|
func NewModule() core.IModule {
|
|
m := new(Web)
|
|
return m
|
|
}
|
|
|
|
type Web struct {
|
|
cbase.ModuleBase
|
|
options *Options
|
|
service base.IRPCXService
|
|
api_comp *Api_Comp //提供weba pi服务的组件
|
|
modelUser *modelUserComp
|
|
modelNotify *modelNotifyComp
|
|
modelMail *modelMailComp
|
|
configure *configureComp
|
|
}
|
|
|
|
//模块名
|
|
func (this *Web) GetType() core.M_Modules {
|
|
return comm.ModuleWeb
|
|
}
|
|
|
|
//模块自定义参数
|
|
func (this *Web) NewOptions() (options core.IModuleOptions) {
|
|
return new(Options)
|
|
}
|
|
|
|
func (this *Web) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
err = this.ModuleBase.Init(service, module, options)
|
|
this.service = service.(base.IRPCXService)
|
|
this.options = options.(*Options)
|
|
return
|
|
}
|
|
|
|
func (this *Web) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp)
|
|
this.modelUser = this.RegisterComp(new(modelUserComp)).(*modelUserComp)
|
|
this.modelNotify = this.RegisterComp(new(modelNotifyComp)).(*modelNotifyComp)
|
|
this.modelMail = this.RegisterComp(new(modelMailComp)).(*modelMailComp)
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
}
|
|
|
|
//日志
|
|
//日志接口
|
|
func (this *Web) Debug(msg string, args ...log.Field) {
|
|
this.options.GetLog().Debug(msg, args...)
|
|
}
|
|
func (this *Web) Info(msg string, args ...log.Field) {
|
|
this.options.GetLog().Info(msg, args...)
|
|
}
|
|
func (this *Web) Print(msg string, args ...log.Field) {
|
|
this.options.GetLog().Print(msg, args...)
|
|
}
|
|
func (this *Web) Warn(msg string, args ...log.Field) {
|
|
this.options.GetLog().Warn(msg, args...)
|
|
}
|
|
func (this *Web) Error(msg string, args ...log.Field) {
|
|
this.options.GetLog().Error(msg, args...)
|
|
}
|
|
func (this *Web) Panic(msg string, args ...log.Field) {
|
|
this.options.GetLog().Panic(msg, args...)
|
|
}
|
|
func (this *Web) Fatal(msg string, args ...log.Field) {
|
|
this.options.GetLog().Fatal(msg, args...)
|
|
}
|
|
|
|
func (this *Web) Debugf(format string, args ...interface{}) {
|
|
this.options.GetLog().Debugf(format, args...)
|
|
}
|
|
func (this *Web) Infof(format string, args ...interface{}) {
|
|
this.options.GetLog().Infof(format, args...)
|
|
}
|
|
func (this *Web) Printf(format string, args ...interface{}) {
|
|
this.options.GetLog().Printf(format, args...)
|
|
}
|
|
func (this *Web) Warnf(format string, args ...interface{}) {
|
|
this.options.GetLog().Warnf(format, args...)
|
|
}
|
|
func (this *Web) Errorf(format string, args ...interface{}) {
|
|
this.options.GetLog().Errorf(format, args...)
|
|
}
|
|
func (this *Web) Fatalf(format string, args ...interface{}) {
|
|
this.options.GetLog().Fatalf(format, args...)
|
|
}
|
|
func (this *Web) Panicf(format string, args ...interface{}) {
|
|
this.options.GetLog().Panicf(format, args...)
|
|
}
|
|
|
|
func (this *Web) Debugln(args ...interface{}) {
|
|
this.options.GetLog().Debugln(args...)
|
|
}
|
|
func (this *Web) Infoln(args ...interface{}) {
|
|
this.options.GetLog().Infoln(args...)
|
|
}
|
|
func (this *Web) Println(args ...interface{}) {
|
|
this.options.GetLog().Println(args...)
|
|
}
|
|
func (this *Web) Warnln(args ...interface{}) {
|
|
this.options.GetLog().Warnln(args...)
|
|
}
|
|
func (this *Web) Errorln(args ...interface{}) {
|
|
this.options.GetLog().Errorln(args...)
|
|
}
|
|
func (this *Web) Fatalln(args ...interface{}) {
|
|
this.options.GetLog().Fatalln(args...)
|
|
}
|
|
func (this *Web) Panicln(args ...interface{}) {
|
|
this.options.GetLog().Panicln(args...)
|
|
}
|