This commit is contained in:
2025-06-29 10:39:00 +08:00
parent 605197345b
commit b45eb83fe4
15 changed files with 597 additions and 3 deletions

22
Server/scene/app/base.go Normal file
View File

@@ -0,0 +1,22 @@
package app
import (
"common/log"
"common/utils"
"math/rand"
"scene/config"
)
func (p *Program) initBase() (*config.Config, error) {
// 配置
cfg, err := config.LoadConfig("./config")
if err != nil {
return nil, err
}
// 日志
log.Init(cfg.Log.Debug, cfg.Log.MaxSize, cfg.Log.MaxBackups, cfg.Log.MaxAge, cfg.Log.Level)
// 雪花
utils.InitSnowflake(int64(rand.Intn(1000)))
return cfg, nil
}