feat app 模块化启动

This commit is contained in:
2025-12-13 18:22:35 +08:00
parent 71d4e593c7
commit bc656247c9
41 changed files with 730 additions and 253 deletions

View File

@@ -7,7 +7,11 @@ import (
"scene/config"
)
func (p *Program) initBase() error {
// ModuleBase 基础模块,或者一些零散的模块
type ModuleBase struct {
}
func (p *ModuleBase) Init() error {
// 配置
if err := config.LoadConfig(); err != nil {
return err
@@ -17,6 +21,13 @@ func (p *Program) initBase() error {
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 (p *ModuleBase) Start() error {
return nil
}
func (p *ModuleBase) Stop() error {
return nil
}