使用boot统一注册执行代码

This commit is contained in:
ayflying
2025-04-02 15:49:42 +08:00
parent 743d232c38
commit 75624ff0b7
6 changed files with 49 additions and 43 deletions

View File

@@ -2,11 +2,8 @@ package boot
import (
v1 "github.com/ayflying/utility_go/api/system/v1"
"github.com/ayflying/utility_go/drivers/db/elasticsearch"
"github.com/ayflying/utility_go/pkg/aycache"
"github.com/ayflying/utility_go/service"
"github.com/gogf/gf/v2/os/gctx"
"math"
)
var (
@@ -22,16 +19,6 @@ func Boot() (err error) {
return service.GameAct().Saves()
})
//初始化ES
elasticsearch.Init()
//初始化指标
service.SystemCron().AddCron(v1.CronType_MINUTE, func() error {
aycache.QPS.Set(math.Round(float64(aycache.QPSCount) / 60))
aycache.QPSCount = 0
return nil
})
//初始化自启动方法
for _, v := range _func {
v()