|
@@ -959,10 +959,6 @@ class WholeController extends Curd
|
|
|
}
|
|
|
// 去支付
|
|
|
$result = OrderService::qrcodePay($params);
|
|
|
- // $result = [
|
|
|
- // 'return_code'=>'SUCCESS',
|
|
|
- // 'result_code' => 'SUCCESS'
|
|
|
- // ];
|
|
|
$result = json_encode($result);
|
|
|
$params['pay_json_response'] = $result;
|
|
|
$result = json_decode($result, true);
|
|
@@ -970,15 +966,27 @@ class WholeController extends Curd
|
|
|
$prefix = substr($params['qrcode_nbr'], 0, 2);
|
|
|
if (in_array($prefix, [10, 11, 12, 13, 14, 15])) {
|
|
|
$params['pay_category'] = 'WXPAY';
|
|
|
- if ($result['return_code'] != 'SUCCESS' || $result['result_code'] != 'SUCCESS') {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('支付失败');
|
|
|
+ if ((!isset($result['return_code']) || $result['return_code'] != 'SUCCESS') || (!isset($result['result_code']) || $result['result_code'] != 'SUCCESS') || (empty($result['trade_state']) || $result['trade_state'] != 'SUCCESS')) {
|
|
|
+ $order->order_status_system = 'PAYING';
|
|
|
+ $order->order_status_payment = 'PENDING';
|
|
|
+ $order->order_is_complete = 'N';
|
|
|
+// Db::rollBack();
|
|
|
+// return json_fail('支付失败');
|
|
|
+ } else {
|
|
|
+ $order->order_status_system = $systemStatus;
|
|
|
+ $order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
} else if (in_array($prefix, [25, 26, 27, 28, 29, 30])) {
|
|
|
$params['pay_category'] = 'ALIPAY';
|
|
|
- if ($result['code'] != '10000' || $result['msg'] != 'Success') {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('支付失败');
|
|
|
+ if ((!isset($result['code']) || $result['code'] != '10000') || (empty($result['trade_status']) || $result['trade_status'] != 'TRADE_SUCCESS')) {
|
|
|
+ $order->order_status_system = 'PAYING';
|
|
|
+ $order->order_status_payment = 'PENDING';
|
|
|
+ $order->order_is_complete = 'N';
|
|
|
+// Db::rollBack();
|
|
|
+// return json_fail('支付失败');
|
|
|
+ } else {
|
|
|
+ $order->order_status_system = $systemStatus;
|
|
|
+ $order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
} else {
|
|
|
Db::rollBack();
|
|
@@ -1006,8 +1014,6 @@ class WholeController extends Curd
|
|
|
$params['pay_category'] = $submitPayCategory;
|
|
|
}
|
|
|
|
|
|
- $order->order_status_system = $systemStatus;
|
|
|
- $order->order_status_payment = 'SUCCESS';
|
|
|
// 账户支付的金额
|
|
|
$params['order_amount_pay'] = $accountAmount;
|
|
|
}
|
|
@@ -1167,6 +1173,10 @@ class WholeController extends Curd
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if ($order->order_status_payment != 'SUCCESS') {
|
|
|
+ _syslog("订单", "支付异常,检查是否有轮询");
|
|
|
+ return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
|
+ }
|
|
|
_syslog("订单", "订单支付成功");
|
|
|
return json_success('支付成功');
|
|
|
} catch (\Exception $e) {
|
|
@@ -1356,15 +1366,27 @@ class WholeController extends Curd
|
|
|
$prefix = substr($params['qrcode_nbr'], 0, 2);
|
|
|
if (in_array($prefix, [10, 11, 12, 13, 14, 15])) {
|
|
|
$params['pay_category'] = 'WXPAY';
|
|
|
- if ($result['return_code'] != 'SUCCESS' || $result['result_code'] != 'SUCCESS') {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('支付失败');
|
|
|
+ if ((!isset($result['return_code']) || $result['return_code'] != 'SUCCESS') || (!isset($result['result_code']) || $result['result_code'] != 'SUCCESS') || (empty($result['trade_state']) || $result['trade_state'] != 'SUCCESS')) {
|
|
|
+ $order->order_status_system = 'PAYING';
|
|
|
+ $order->order_status_payment = 'PENDING';
|
|
|
+ $order->order_is_complete = 'N';
|
|
|
+// Db::rollBack();
|
|
|
+// return json_fail('支付失败');
|
|
|
+ } else {
|
|
|
+ $order->order_status_system = $systemStatus;
|
|
|
+ $order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
} else if (in_array($prefix, [25, 26, 27, 28, 29, 30])) {
|
|
|
$params['pay_category'] = 'ALIPAY';
|
|
|
- if ($result['code'] != '10000' || $result['msg'] != 'Success') {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('支付失败');
|
|
|
+ if ((!isset($result['code']) || $result['code'] != '10000') || (empty($result['trade_status']) || $result['trade_status'] != 'TRADE_SUCCESS')) {
|
|
|
+ $order->order_status_system = 'PAYING';
|
|
|
+ $order->order_status_payment = 'PENDING';
|
|
|
+ $order->order_is_complete = 'N';
|
|
|
+// Db::rollBack();
|
|
|
+// return json_fail('支付失败');
|
|
|
+ } else {
|
|
|
+ $order->order_status_system = $systemStatus;
|
|
|
+ $order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
} else {
|
|
|
Db::rollBack();
|
|
@@ -1376,8 +1398,6 @@ class WholeController extends Curd
|
|
|
OrderService::createPayConstituteDetail($params, $payDetail);
|
|
|
// 账户支付的金额
|
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
|
- $order->order_status_system = $systemStatus;
|
|
|
- $order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
$orderConfigJson = [];
|
|
|
if (!empty($order->order_config_json)) {
|
|
@@ -1455,7 +1475,10 @@ class WholeController extends Curd
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ if ($order->order_status_payment != 'SUCCESS') {
|
|
|
+ _syslog("订单", "支付异常,检查是否有轮询");
|
|
|
+ return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
|
+ }
|
|
|
_syslog("订单", "订单支付成功");
|
|
|
return json_success('支付成功');
|
|
|
} catch (\Exception $e) {
|
|
@@ -1872,13 +1895,13 @@ class WholeController extends Curd
|
|
|
} else {
|
|
|
$params['order_status_system'] = $systemStatus;
|
|
|
$params['order_status_payment'] = 'SUCCESS';
|
|
|
- $params['order_is_complete'] = 'N';
|
|
|
}
|
|
|
} else if (in_array($prefix, [25, 26, 27, 28, 29, 30])) {
|
|
|
$params['pay_category'] = 'ALIPAY';
|
|
|
if ((!isset($result['code']) || $result['code'] != '10000') || (empty($result['trade_status']) || $result['trade_status'] != 'TRADE_SUCCESS')) {
|
|
|
$params['order_status_system'] = 'PAYING';
|
|
|
$params['order_status_payment'] = 'PENDING';
|
|
|
+ $params['order_is_complete'] = 'N';
|
|
|
// Db::rollBack();
|
|
|
// return json_fail('支付失败');
|
|
|
} else {
|
|
@@ -2112,11 +2135,11 @@ class WholeController extends Curd
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- dump($params['settlement_now'], $params['order_status_payment']);
|
|
|
- _syslog("订单", "创建订单成功");
|
|
|
if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] != 'SUCCESS') {
|
|
|
+ _syslog("订单", "支付异常,检查是否有轮询");
|
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
|
}
|
|
|
+ _syslog("订单", "创建订单成功");
|
|
|
return json_success('创建订单成功');
|
|
|
} catch (BusinessException $e) {
|
|
|
Db::rollBack();
|
|
@@ -2378,6 +2401,7 @@ class WholeController extends Curd
|
|
|
if ((!isset($result['code']) || $result['code'] != '10000') || (empty($result['trade_status']) || $result['trade_status'] != 'TRADE_SUCCESS')) {
|
|
|
$params['order_status_system'] = 'PAYING';
|
|
|
$params['order_status_payment'] = 'PENDING';
|
|
|
+ $params['order_is_complete'] = 'N';
|
|
|
// Db::rollBack();
|
|
|
// return json_fail('支付失败');
|
|
|
} else {
|
|
@@ -2589,10 +2613,11 @@ class WholeController extends Curd
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- _syslog("订单", "创建订单成功");
|
|
|
if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] != 'SUCCESS') {
|
|
|
+ _syslog("订单", "支付异常,检查是否有轮询");
|
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
|
}
|
|
|
+ _syslog("订单", "创建订单成功");
|
|
|
return json_success('创建订单成功');
|
|
|
} catch (BusinessException $e) {
|
|
|
Db::rollBack();
|