功能:接入乐玩开放平台双渠道路由,并修复渠道锁定与 Webhook 可靠性

在保持 DLC 默认零破坏的前提下,支持 priority/仅乐玩/仅 DLC 履约策略与后台 GUI 配置;同步补齐 Prepare 渠道落库、乐玩订单取消、Webhook 验签与失败重试。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yml2213
2026-09-11 15:48:03 +08:00
co-authored by Cursor
parent a314f3f51b
commit f7f48d0feb
22 changed files with 6489 additions and 189 deletions
+15
View File
@@ -10,6 +10,7 @@ import (
"affiliate_dash/internal/handler"
"affiliate_dash/internal/pkg/applog"
"affiliate_dash/internal/pkg/jwt"
"affiliate_dash/internal/pkg/lewan"
"affiliate_dash/internal/pkg/openlog"
"affiliate_dash/internal/pkg/timeutil"
"affiliate_dash/internal/router"
@@ -84,6 +85,18 @@ func main() {
cfg.DeliveryLinkTTLMinutes,
)
// 乐玩开放平台客户端与履约提供商注册
lewanClient := lewan.NewClient(lewan.Config{
BaseURL: cfg.LewanBaseURL,
AccessKey: cfg.LewanAccessKey,
SecretKey: cfg.LewanSecretKey,
ApplicationID: cfg.LewanApplicationID,
WebhookSecret: cfg.LewanWebhookSecret,
}, nil)
lewanProvider := service.NewLewanProvider(lewanClient)
deliverySvc.RegisterProvider(lewanProvider)
fulfillmentSvc.SetUpstreamCancel(deliverySvc.CancelUpstream)
openlog.Init(cfg.OpenAPIDebug)
h := &router.Handlers{
@@ -105,6 +118,8 @@ func main() {
OpenAPIDebug: cfg.OpenAPIDebug,
UploadDir: cfg.UploadDir,
CORSAllowedOrigins: cfg.CORSAllowedOrigins,
LewanWebhook: handler.NewLewanWebhookHandler(fulfillmentSvc, db, cfg.LewanWebhookSecret, cfg.LewanApplicationID),
PlatformLewan: handler.NewPlatformLewanHandler(merchantSvc, lewanClient),
}
go callbackSvc.Run(context.Background())