功能:接入乐玩开放平台双渠道路由,并修复渠道锁定与 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
+17 -2
View File
@@ -30,10 +30,13 @@ type Handlers struct {
OpenAPIKey string
OpenAPISecret string
OpenSignSkew int64
OpenAPIDebug bool
UploadDir string
OpenAPIDebug bool
UploadDir string
// CORSAllowedOrigins 跨域来源白名单;为空时使用本地开发默认来源。
CORSAllowedOrigins []string
LewanWebhook *handler.LewanWebhookHandler
PlatformLewan *handler.PlatformLewanHandler
}
// defaultCORSOrigins 未配置 CORS_ALLOWED_ORIGINS 时的本地开发默认来源。
@@ -98,6 +101,11 @@ func Setup(h *Handlers) *gin.Engine {
{
api.POST("/auth/login", h.Auth.Login)
// 乐玩开放平台 Webhook 回调
if h.LewanWebhook != nil {
api.POST("/upstream/lewan/webhook", h.LewanWebhook.Handle)
}
// 用户侧公开发货页接口:商户把发货链接给用户,用户只填写游戏 UID。
delivery := api.Group("/delivery/v1")
{
@@ -215,6 +223,13 @@ func Setup(h *Handlers) *gin.Engine {
admin.POST("/platform/merchants/:id/wallet/adjust", h.Merchant.AdminAdjustWallet)
admin.GET("/platform/recharge/applications", h.Recharge.AdminListApplications)
admin.POST("/platform/recharge/applications/:id/review", h.Recharge.AdminReviewApplication)
// 乐玩平台商品拉取、同步与履约路由配置
if h.PlatformLewan != nil {
admin.GET("/platform/lewan/products", h.PlatformLewan.ListLewanProducts)
admin.POST("/platform/lewan/sync-catalog", h.PlatformLewan.SyncLewanProduct)
admin.PUT("/platform/products/:id/routing", h.PlatformLewan.UpdateProductRouting)
}
}
auth.POST("/upload", h.Recharge.Upload)