模块化定时任务,方便在插件中注册任务;增加日志分组

This commit is contained in:
孟帅
2023-06-05 20:14:57 +08:00
parent 62ecbb7f26
commit 48f8c20d9c
79 changed files with 820 additions and 783 deletions

View File

@@ -18,7 +18,6 @@ import (
"github.com/gogf/gf/v2/text/gstr"
"hotgo/internal/consts"
"hotgo/internal/library/cache"
"hotgo/internal/library/hggen"
"hotgo/internal/library/queue"
"hotgo/internal/model/entity"
"hotgo/internal/service"
@@ -47,22 +46,12 @@ func Init(ctx context.Context) {
// 设置缓存适配器
cache.SetAdapter(ctx)
// 启动服务监控
service.AdminMonitor().StartMonitor(ctx)
// 加载ip访问黑名单
service.SysBlacklist().Load(ctx)
// 初始化功能库配置
service.SysConfig().InitConfig(ctx)
// 注册支付成功回调方法
payNotifyCall()
// 初始化生成代码配置
hggen.InIt(ctx)
}
// LoggingServeLogHandler 服务日志处理
// 需要将异常日志保存到服务日志时可以通过SetHandlers设置此方法
func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) {
in.Next(ctx)
@@ -120,6 +109,6 @@ func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) {
})
if err != nil {
g.Log("serveLog").Errorf(ctx, "LoggingServeLogHandler err:%+v", err)
g.Dump("LoggingServeLogHandler err:%+v", err)
}
}

View File

@@ -1,13 +0,0 @@
package global
import (
"hotgo/internal/consts"
"hotgo/internal/library/payment"
"hotgo/internal/service"
)
// 注册支付成功回调方法
func payNotifyCall() {
payment.RegisterNotifyCall(consts.OrderGroupAdminOrder, service.AdminOrder().PayNotify) // 后台充值订单
// ...
}