...
|
...
|
@@ -476,22 +476,24 @@ class PayModel |
|
|
|
|
|
// 初始化日志
|
|
|
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
|
|
$log->LogInfo('========[' . $orderCode . ']========');
|
|
|
$log->LogInfo('========开始查询微信扫码支付状态========');
|
|
|
$log->LogInfo('=====[' . $orderCode . ']===开始查询微信扫码支付状态========');
|
|
|
|
|
|
// 组装微信支付的订单号
|
|
|
$tradeNo = 'YOHOBuy_' . $orderCode;
|
|
|
$input = new WxPayOrderQuery();
|
|
|
$input->SetOut_trade_no($tradeNo);
|
|
|
$payResult = WxPayApi::orderQuery($input);
|
|
|
$log->LogInfo(var_export($payResult, true));
|
|
|
|
|
|
if (isset($payResult['trade_state']) && $payResult['trade_state'] === 'SUCCESS') {
|
|
|
$log->LogInfo('========微信扫码支付成功========');
|
|
|
$log->LogInfo('====[' . $orderCode . ']====微信扫码支付成功========');
|
|
|
$result = array(
|
|
|
'code' => '200',
|
|
|
'message' => 'success'
|
|
|
);
|
|
|
}
|
|
|
|
|
|
$log->LogInfo('====[' . $orderCode . ']====微信扫码支付失败========');
|
|
|
} while (false);
|
|
|
|
|
|
return $result;
|
...
|
...
|
@@ -518,13 +520,13 @@ class PayModel |
|
|
$log->LogInfo('========[' . $payResult->orderCode . ']========');
|
|
|
$log->LogInfo(var_export($payResult, true));
|
|
|
|
|
|
$log->LogInfo('===开始调用获取订单详情方式接口,接口方法为app.SpaceOrders.detail===');
|
|
|
$log->LogInfo('==[' . $payResult->orderCode . ']=开始调用获取订单详情方式接口,接口方法为app.SpaceOrders.detail===');
|
|
|
$orderInfo = OrderData::getOrderDetail($uid, $payResult->orderCode);
|
|
|
$log->LogInfo('===结束调用获取订单详情方式接口,返回结果为===');
|
|
|
$log->LogInfo('==[' . $payResult->orderCode . ']=结束调用获取订单详情方式接口,返回结果为===');
|
|
|
$log->LogInfo(var_export($orderInfo, true));
|
|
|
|
|
|
if (!isset($orderInfo['data']) || empty($orderInfo['data'])) {
|
|
|
$log->LogInfo('===订单支付失败,未获取到订单详情信息===');
|
|
|
$log->LogInfo('==[' . $payResult->orderCode . ']=订单支付失败,未获取到订单详情信息===');
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -539,9 +541,9 @@ class PayModel |
|
|
// 初始化日志
|
|
|
$log = new PhpLog(self::SEND_MESSAGE_LOG, 'PRC', self::LOG_LEVEL);
|
|
|
$log->LogInfo('===[' . $orderCode . ']===');
|
|
|
$log->LogInfo('===开始调用订单取消时给用户发短信接口,接口方法为app.message.sendMsg===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=开始调用订单取消时给用户发短信接口,接口方法为app.message.sendMsg===');
|
|
|
$messageReturn = PayData::sendMessage($orderData['mobile'], 'error_sms', '支付成功,但订单已取消,订单号为' . $orderCode);
|
|
|
$log->LogInfo('===结束调用给用户发短信接口,返回结果为===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=结束调用给用户发短信接口,返回结果为===');
|
|
|
$log->LogInfo(var_export($messageReturn, true));
|
|
|
|
|
|
$result['code'] = 417;
|
...
|
...
|
@@ -552,7 +554,7 @@ class PayModel |
|
|
// 支付金额与订单金额不一致
|
|
|
if (round($amount, 2) != round($payResult->totalFee, 2)) {
|
|
|
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
|
|
$log->LogInfo('===订单支付失败,支付金额与订单金额不一致===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=订单支付失败,支付金额与订单金额不一致===');
|
|
|
$result['code'] = 415;
|
|
|
$result['message'] = '支付金额与订单金额不一致';
|
|
|
break;
|
...
|
...
|
@@ -569,20 +571,20 @@ class PayModel |
|
|
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
|
|
$log->LogInfo('===[' . $orderCode . ']===');
|
|
|
|
|
|
$log->LogInfo('===开始调用ERP提交订单状态接口,接口方法为web.SpaceOrders.submitOrderStatus===');
|
|
|
$log->LogInfo('===请求参数为orderCode=' . $orderCode . '===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=开始调用ERP提交订单状态接口,接口方法为web.SpaceOrders.submitOrderStatus===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=请求参数为orderCode=' . $orderCode . '===');
|
|
|
// ERP提交订单状态
|
|
|
$erpReturn = PayData::submitOrderStatus($orderCode, $payment, $bankName, $bankCode, $amount, $payOrderCode, $tradeNo, $bankBillNo);
|
|
|
$log->LogInfo('===结束调用ERP提交订单状态接口,返回结果为===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=结束调用ERP提交订单状态接口,返回结果为===');
|
|
|
$log->LogInfo(var_export($erpReturn, true));
|
|
|
|
|
|
$log->LogInfo('===开始调用更新订单状态接口,接口方法为web.SpaceOrders.updatePaymentStatus===');
|
|
|
$log->LogInfo('===请求参数为orderId=' . $orderData['order_id'] . 'uid=' . $uid . '===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=开始调用更新订单状态接口,接口方法为web.SpaceOrders.updatePaymentStatus===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=请求参数为orderId=' . $orderData['order_id'] . 'uid=' . $uid . '===');
|
|
|
// 更新订单的状态
|
|
|
$updateOrderStatus = PayData::updateOrderStatus($orderData['order_id'], $uid, $payment, 'Y', $bankCode);
|
|
|
$log->LogInfo('===结束调用更新订单状态接口,返回结果为===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=结束调用更新订单状态接口,返回结果为===');
|
|
|
$log->LogInfo(var_export($updateOrderStatus, true));
|
|
|
$log->LogInfo('===订单支付成功,请等待发货===');
|
|
|
$log->LogInfo('==[' . $orderCode . ']=订单支付成功,请等待发货===');
|
|
|
|
|
|
$result['code'] = 200;
|
|
|
$result['message'] = '支付成功,请等待发货';
|
...
|
...
|
|