go_dreamfactory/services/servicebase.go
2022-06-21 15:41:55 +08:00

27 lines
610 B
Go

package services
import (
"fmt"
"go_dreamfactory/sys/configure"
"go_dreamfactory/lego/base/rpcx"
"go_dreamfactory/lego/sys/log"
)
//梦工厂基础服务对象
type ServiceBase struct {
rpcx.RPCXService
}
//初始化相关系统
func (this *ServiceBase) InitSys() {
this.RPCXService.InitSys()
//初始化配置中心系统 每个服务都会用到的就在这个初始化就好
if err := configure.OnInit(this.GetSettings().Sys["configure"]); err != nil {
panic(fmt.Sprintf("init sys.configure err: %s", err.Error()))
} else {
configure.Start()
log.Infof("init sys.configure success!")
}
}