调整支付 openid 接口通道

This commit is contained in:
Anyon 2020-12-12 19:37:35 +08:00
parent 388187cbe3
commit 51308e7b24
2 changed files with 11 additions and 1 deletions

View File

@ -15,6 +15,8 @@ abstract class Auth extends Controller
{
/**
* 当前接口类型
* 小程序使用 wxapp
* 服务号使用 wechat
* @var string
*/
protected $type;

View File

@ -193,7 +193,15 @@ class Order extends Auth
if ($order['status'] != 2) $this->error('该订单不能发起支付哦!');
if ($order['payment_status']) $this->error('订单已经支付,不需要再次支付哦!');
try {
$params = PaymentService::build($data['payid'])->create($this->user['openid'], $order['order_no'], $order['amount_total'], '商城订单支付', '');
$openid = '';
if ($this->type === 'wxapp') {
$openid = $this->user['openid1'];
} elseif ($this->type === 'wechat') {
$openid = $this->user['openid2'];
} else {
$this->error("接口类型{$this->type}未绑定支付");
}
$params = PaymentService::build($data['payid'])->create($openid, $order['order_no'], $order['amount_total'], '商城订单支付', '');
$this->success('获取支付参数成功!', $params);
} catch (HttpResponseException $exception) {
throw $exception;