From 4f88ee637a8d22db962f4eac4acb0aa32b2a7eff Mon Sep 17 00:00:00 2001 From: erio Date: Thu, 9 Apr 2026 01:13:16 +0800 Subject: [PATCH] fix(payment): inject paymentMode into provider config for correct redirect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The EasyPay provider reads paymentMode from e.config["paymentMode"] to decide between redirect (submit.php) and API (mapi.php) paths. However, paymentMode is stored as a separate DB column, not inside the encrypted config JSON. SelectInstance() returned it in the InstanceSelection struct but never injected it into the Config map, so the provider always fell through to the API/QR path. Also includes: - Subscription success flow: show "订阅成功" and refresh on return - Active subscription card: platform colors, rate/quota display - Subscription plan card: compact layout to save height - Provider list: drag-and-drop reorder via sort_order --- backend/internal/payment/load_balancer.go | 5 + .../payment/PaymentProviderList.vue | 61 +++++++++--- .../components/payment/PaymentStatusPanel.vue | 3 +- .../payment/SubscriptionPlanCard.vue | 94 +++++++------------ frontend/src/i18n/locales/en.ts | 1 + frontend/src/i18n/locales/zh.ts | 1 + frontend/src/types/payment.ts | 1 + frontend/src/views/admin/SettingsView.vue | 17 ++++ frontend/src/views/user/PaymentView.vue | 64 ++++++++++--- 9 files changed, 159 insertions(+), 88 deletions(-) diff --git a/backend/internal/payment/load_balancer.go b/backend/internal/payment/load_balancer.go index ab55b78816..d57e494cca 100644 --- a/backend/internal/payment/load_balancer.go +++ b/backend/internal/payment/load_balancer.go @@ -86,6 +86,11 @@ func (lb *DefaultLoadBalancer) SelectInstance(ctx context.Context, providerKey s return nil, fmt.Errorf("decrypt instance %d config: %w", selected.ID, err) } + // Inject payment_mode into config so providers can read it uniformly + if selected.PaymentMode != "" { + config["paymentMode"] = selected.PaymentMode + } + return &InstanceSelection{ InstanceID: fmt.Sprintf("%d", selected.ID), Config: config, diff --git a/frontend/src/components/payment/PaymentProviderList.vue b/frontend/src/components/payment/PaymentProviderList.vue index e795e99043..f901e6feb3 100644 --- a/frontend/src/components/payment/PaymentProviderList.vue +++ b/frontend/src/components/payment/PaymentProviderList.vue @@ -40,23 +40,37 @@
- -
- -
+ + +
+
+ + + +
+
+ +
+
+
-
+

{{ canCreate ? t('admin.settings.payment.noProviders') @@ -75,7 +89,9 @@