39 lines
775 B
Go
39 lines
775 B
Go
package app
|
|
|
|
import (
|
|
"git.hlsq.asia/mmorpg/service-common/log"
|
|
"git.hlsq.asia/mmorpg/service-common/module"
|
|
"git.hlsq.asia/mmorpg/service-common/utils"
|
|
"git.hlsq.asia/mmorpg/service-gateway/config"
|
|
"math/rand"
|
|
)
|
|
|
|
// ModuleBase 基础模块,或者一些零散的模块
|
|
type ModuleBase struct {
|
|
}
|
|
|
|
func (m *ModuleBase) Init() error {
|
|
// 配置
|
|
if err := config.LoadConfig(); err != nil {
|
|
return err
|
|
}
|
|
cfg := config.Get()
|
|
// 日志
|
|
log.Init(cfg.Log.Debug, cfg.Log.MaxSize, cfg.Log.MaxBackups, cfg.Log.MaxAge, cfg.Log.Level)
|
|
// 雪花
|
|
utils.InitSnowflake(int64(rand.Intn(1000)))
|
|
return nil
|
|
}
|
|
|
|
func (m *ModuleBase) Start() error {
|
|
return nil
|
|
}
|
|
|
|
func (m *ModuleBase) Stop() error {
|
|
return nil
|
|
}
|
|
|
|
func (m *ModuleBase) Bind(_ ...any) module.Module {
|
|
return m
|
|
}
|