diff --git a/controller/subscription_payment_epay.go b/controller/subscription_payment_epay.go index c0a5162a5..528ab5d2d 100644 --- a/controller/subscription_payment_epay.go +++ b/controller/subscription_payment_epay.go @@ -108,7 +108,7 @@ func SubscriptionRequestEpay(c *gin.Context) { common.ApiErrorMsg(c, "拉起支付失败") return } - common.ApiSuccess(c, gin.H{"data": params, "url": uri}) + c.JSON(http.StatusOK, gin.H{"message": "success", "data": params, "url": uri}) } func SubscriptionEpayNotify(c *gin.Context) { diff --git a/web/src/components/topup/SubscriptionPlansCard.jsx b/web/src/components/topup/SubscriptionPlansCard.jsx index a3a223ba4..e9d25e543 100644 --- a/web/src/components/topup/SubscriptionPlansCard.jsx +++ b/web/src/components/topup/SubscriptionPlansCard.jsx @@ -128,7 +128,11 @@ const SubscriptionPlansCard = ({ showSuccess(t('已打开支付页面')); closeBuy(); } else { - showError(res.data?.data || res.data?.message || t('支付失败')); + const errorMsg = + typeof res.data?.data === 'string' + ? res.data.data + : res.data?.message || t('支付失败'); + showError(errorMsg); } } catch (e) { showError(t('支付请求失败')); @@ -152,7 +156,11 @@ const SubscriptionPlansCard = ({ showSuccess(t('已打开支付页面')); closeBuy(); } else { - showError(res.data?.data || res.data?.message || t('支付失败')); + const errorMsg = + typeof res.data?.data === 'string' + ? res.data.data + : res.data?.message || t('支付失败'); + showError(errorMsg); } } catch (e) { showError(t('支付请求失败')); @@ -177,7 +185,11 @@ const SubscriptionPlansCard = ({ showSuccess(t('已发起支付')); closeBuy(); } else { - showError(res.data?.data || res.data?.message || t('支付失败')); + const errorMsg = + typeof res.data?.data === 'string' + ? res.data.data + : res.data?.message || t('支付失败'); + showError(errorMsg); } } catch (e) { showError(t('支付请求失败')); @@ -269,9 +281,13 @@ const SubscriptionPlansCard = ({ {/* 套餐列表骨架屏 */} -