feat 废弃jwt
This commit is contained in:
32
module/base.go
Normal file
32
module/base.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package module
|
||||
|
||||
import (
|
||||
"git.hlsq.asia/mmorpg/service-common/config"
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
// Base 基础模块
|
||||
type Base struct {
|
||||
DefaultModule
|
||||
log *config.LogConfig
|
||||
}
|
||||
|
||||
func (m *Base) Init() error {
|
||||
// 日志
|
||||
log.Init(m.log)
|
||||
// 雪花
|
||||
utils.InitSnowflake(int64(rand.Intn(1000)))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Base) Bind(data ...any) Module {
|
||||
if data == nil || len(data) == 0 {
|
||||
return m
|
||||
}
|
||||
if l, ok := data[0].(*config.LogConfig); ok {
|
||||
m.log = l
|
||||
}
|
||||
return m
|
||||
}
|
||||
Reference in New Issue
Block a user