Files
order/main.go

39 lines
1.0 KiB
Go
Raw Normal View History

2025-12-09 14:24:40 +08:00
package main
import (
2025-12-10 09:02:41 +08:00
"context"
2025-12-12 18:16:28 +08:00
"order/controller"
2025-12-15 09:02:30 +08:00
"order/service"
2025-12-12 18:16:28 +08:00
2025-12-09 14:24:40 +08:00
"gitee.com/red-future---jilin-g/common/http"
"gitee.com/red-future---jilin-g/common/jaeger"
_ "gitee.com/red-future---jilin-g/common/mongo"
_ "gitee.com/red-future---jilin-g/common/ragflow" // RAGFlow 客户端自动初始化
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
2025-12-15 09:02:30 +08:00
"github.com/gogf/gf/v2/frame/g"
2025-12-09 14:24:40 +08:00
)
func main() {
defer jaeger.ShutDown(context.Background())
2025-12-10 09:02:41 +08:00
http.RouteRegister([]interface{}{
2025-12-10 13:51:09 +08:00
controller.Order,
2025-12-12 16:20:47 +08:00
controller.OrderStatistics,
2025-12-12 18:16:28 +08:00
controller.PaymentConfig,
2025-12-10 09:02:41 +08:00
})
2025-12-15 09:02:30 +08:00
// 启动定时任务
ctx := context.Background()
// 启动订单超时处理定时任务
if err := service.StartOrderTimeoutScheduler(ctx); err != nil {
g.Log().Errorf(ctx, "启动订单超时处理定时任务失败: %v", err)
}
2025-12-12 18:16:28 +08:00
// 启动订单统计定时任务调度器
2025-12-15 09:02:30 +08:00
if err := service.StartOrderStatisticsScheduler(ctx); err != nil {
g.Log().Errorf(ctx, "启动订单统计定时任务失败: %v", err)
}
2025-12-10 13:51:09 +08:00
select {}
2025-12-09 14:24:40 +08:00
}