|
@@ -65,13 +65,16 @@ class Payment extends Api
|
|
|
return $this->error('请选择支付方式');
|
|
|
}
|
|
|
|
|
|
+ $payType = $params['pay_type'];
|
|
|
+ $platform = $params['platform'];
|
|
|
+
|
|
|
$model = new BillModel();
|
|
|
$bill = $model->getDetail(['id'=>$params['bill_id']]);
|
|
|
if (!$bill || $bill['status'] !== 0) {
|
|
|
return $this->error('订单已支付');
|
|
|
}
|
|
|
|
|
|
- if (!$model->where('id',$params['bill_id'])->update(['pay_type'=>$params['pay_type'],'platform'=>$params['platform']])){
|
|
|
+ if (!$model->where('id',$params['bill_id'])->update(['pay_type'=>$payType,'platform'=>$platform])){
|
|
|
return $this->error('操作失败');
|
|
|
}
|
|
|
|
|
@@ -98,20 +101,20 @@ class Payment extends Api
|
|
|
|
|
|
// 第三方支付下单
|
|
|
$params = [
|
|
|
- 'type' => $params['pay_type'],
|
|
|
+ 'type' => $payType,
|
|
|
'orderid' => $bill['order_no'],
|
|
|
'title' => $remark,
|
|
|
'amount' => $bill['pay_amount'],
|
|
|
- 'method' => $params['platform'],
|
|
|
- 'notifyurl' => config('pay_notify_url') . "/api/notify/bill/pay_type/{$params['pay_type']}",
|
|
|
+ 'method' => $platform,
|
|
|
+ 'notifyurl' => config('pay_notify_url') . "/api/notify/bill/pay_type/{$payType}",
|
|
|
'returnurl' => '',
|
|
|
];
|
|
|
// 如果是小程序则需要添加 openid
|
|
|
- if ($params['pay_type'] == 'wechat' && $params['platform'] == 'miniapp') {
|
|
|
+ if ($payType == 'wechat' && $platform == 'miniapp') {
|
|
|
$params['openid'] = $this->auth->mini_openid;
|
|
|
}
|
|
|
$res = Service::submitOrder($params);
|
|
|
- if ($params['pay_type'] == 'wechat') {
|
|
|
+ if ($payType == 'wechat') {
|
|
|
return $this->success('下单成功', json_decode($res, true));
|
|
|
}
|
|
|
return $this->success('下单成功', $res);
|