From a01c567e48888526d54647815340967d0cd1b513 Mon Sep 17 00:00:00 2001 From: yin5th <541304803@qq.com> Date: Wed, 30 Aug 2023 14:38:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E9=9D=9E=E5=85=AC?= =?UTF-8?q?=E4=BC=97=E5=8F=B7=E5=92=8C=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=9A=84?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81openid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/api/controller/Pay.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/app/api/controller/Pay.php b/server/app/api/controller/Pay.php index bcac28c8..a056a2bc 100644 --- a/server/app/api/controller/Pay.php +++ b/server/app/api/controller/Pay.php @@ -74,11 +74,12 @@ class Pay extends Api $result = PayLogic::balancePay($post['order_id'], $post['from']); break; case OrderEnum::PAY_WAY_WECHAT://微信支付 - if (empty($post['openid'])) { + // openid为空 且在小程序或公众号中支付时 必填openid + if (empty($post['openid']) && in_array($this->client, [Client_::mnp, Client_::oa])) { //微信支付时必须传openid过来 return JsonServer::error('缺少openid'); } - $result = PayLogic::wechatPay($post['order_id'], $post['from'], $this->client, $post['openid']); + $result = PayLogic::wechatPay($post['order_id'], $post['from'], $this->client, $post['openid'] ?? ''); break; case OrderEnum::PAY_WAY_ALIPAY://支付宝支付 $result = PayLogic::aliPay($post['order_id'], $post['from'],$this->client);