|
@@ -112,10 +112,19 @@ class Passport extends Api
|
|
|
|
|
|
$pay = new PayUtil();
|
|
|
$order_no = !empty($order_no) ? $order_no : time() . rand(1, 200);
|
|
|
- $pay->jsPay($openid, "D0{$order_no}", '0.01', '开通会员');
|
|
|
- return json_encode([
|
|
|
- 'order_no' => $order_no,
|
|
|
- 'data' => $pay->getData()
|
|
|
+ $res = $pay->jsPay($openid, "D0{$order_no}", '0.01', '开通会员');
|
|
|
+ if (empty($res['data']['bank_code']) || $res['data']['bank_code'] != 'SUCCESS'){
|
|
|
+ $this->error($res['data']['bank_message'] ?? '下单失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (empty($res['data']['pay_info']) || !$pay_info = json_decode($res['data']['pay_info'],true)){
|
|
|
+ $this->error('支付信息有误');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('success', [
|
|
|
+ 'pay_info' => $pay_info,
|
|
|
+ 'order_no' => $order_no
|
|
|
]);
|
|
|
}
|
|
|
}
|