feat: 完善非公众号和小程序的不需要openid

master
yin5th 2023-08-30 14:38:10 +08:00
parent cabb0be172
commit a01c567e48
1 changed files with 3 additions and 2 deletions

View File

@ -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);