From 3f26ffa8cbc083b7560097c1abddaa72c1f5ba1a Mon Sep 17 00:00:00 2001 From: wolter Date: Tue, 18 Feb 2025 10:47:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B6=E9=93=B6=E5=8F=B0=E5=8F=AA?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E4=B8=AA=E6=94=AF=E4=BB=98=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=94=A4=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/third/paymentService/payment_service.go | 2 +- front/templates/payPage.html | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/third/paymentService/payment_service.go b/app/third/paymentService/payment_service.go index 82fafb0..1921f64 100644 --- a/app/third/paymentService/payment_service.go +++ b/app/third/paymentService/payment_service.go @@ -30,7 +30,7 @@ type WxPay struct { SerialNo string `json:"serial_no"` // 商户证书的证书序列号 ApiV3Key string `json:"api_v_3_key"` // apiV3Key,商户平台获取 PrivateKey string `json:"private_key"` // 私钥 apiclient_key.pem 读取后的内容 - Secret string `json:"secret"` // 商户私钥,读取后的内容 + Secret string `json:"secret"` // 和appid配对使用 } type AliPay struct { diff --git a/front/templates/payPage.html b/front/templates/payPage.html index 69f6a55..2b2c7c9 100644 --- a/front/templates/payPage.html +++ b/front/templates/payPage.html @@ -1,6 +1,7 @@ {{define "payPage.html"}} + @@ -38,8 +39,6 @@ button:hover { background-color: #0056b3; } - - @@ -100,6 +99,8 @@ if (data === null || data.data.length === 0) { const pay = document.getElementById('pay'); pay.innerHTML = '

支付环境异常,请检查

'; + } else if (data.data.length === 1) { + window.location.href = `/pay/front/api/v1/payPage/submit?pay_channel_id=${data.data[0].pay_channel_id}&no=${id}`; } else { renderPaymentMethods(data.data); } @@ -136,6 +137,7 @@ const submitButton = document.createElement('button'); submitButton.type = 'button'; submitButton.textContent = '提交'; + submitButton.onclick = function () { const no = getQueryParam('no'); const selectedMethod = document.querySelector('input[name="paymentMethod"]:checked'); @@ -154,6 +156,7 @@ {{ else}} +

{{.message}}