feat 初次提交

This commit is contained in:
2026-01-03 14:26:12 +08:00
parent 233fc9933f
commit 9c93ecf6e4
18 changed files with 1329 additions and 0 deletions

33
app/base.go Normal file
View File

@@ -0,0 +1,33 @@
package app
import (
"common/log"
"common/utils"
"math/rand"
"user/config"
)
// ModuleBase 基础模块,或者一些零散的模块
type ModuleBase struct {
}
func (p *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 (p *ModuleBase) start() error {
return nil
}
func (p *ModuleBase) stop() error {
return nil
}