|
@@ -401,7 +401,12 @@ class PayModel |
|
@@ -401,7 +401,12 @@ class PayModel |
401
|
$result = array();
|
401
|
$result = array();
|
402
|
|
402
|
|
403
|
do {
|
403
|
do {
|
|
|
404
|
+ // 初始化日志
|
|
|
405
|
+ $log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
|
|
406
|
+ $log->LogInfo('=====[' . $orderCode . ']===开始生成微信支付二维码========');
|
|
|
407
|
+
|
404
|
if (empty($orderCode)) {
|
408
|
if (empty($orderCode)) {
|
|
|
409
|
+ $log->LogInfo('=====[' . $orderCode . ']===微信支付时,订单号为空========');
|
405
|
$result['error'] = true;
|
410
|
$result['error'] = true;
|
406
|
$result['message'] = '订单号不能为空';
|
411
|
$result['message'] = '订单号不能为空';
|
407
|
break;
|
412
|
break;
|
|
@@ -410,6 +415,7 @@ class PayModel |
|
@@ -410,6 +415,7 @@ class PayModel |
410
|
/* 判断订单信息是否存在 */
|
415
|
/* 判断订单信息是否存在 */
|
411
|
$orderDetail = OrderData::getOrderDetail($uid, $orderCode);
|
416
|
$orderDetail = OrderData::getOrderDetail($uid, $orderCode);
|
412
|
if (!isset($orderDetail['data']) || empty($orderDetail['data'])) {
|
417
|
if (!isset($orderDetail['data']) || empty($orderDetail['data'])) {
|
|
|
418
|
+ $log->LogInfo('=====[' . $orderCode . ']===微信支付时,订单信息未查到========');
|
413
|
$result['error'] = true;
|
419
|
$result['error'] = true;
|
414
|
$result['message'] = '没有找到该订单';
|
420
|
$result['message'] = '没有找到该订单';
|
415
|
break;
|
421
|
break;
|
|
@@ -436,6 +442,8 @@ class PayModel |
|
@@ -436,6 +442,8 @@ class PayModel |
436
|
$input->SetProduct_id($orderCode);
|
442
|
$input->SetProduct_id($orderCode);
|
437
|
$notify = new WxPayNativePay();
|
443
|
$notify = new WxPayNativePay();
|
438
|
$payResult = $notify->GetPayUrl($input);
|
444
|
$payResult = $notify->GetPayUrl($input);
|
|
|
445
|
+ $log->LogInfo('=====[' . $orderCode . ']===微信支付时,微信统一下单的返回结果为:========');
|
|
|
446
|
+ $log->LogInfo(var_export($payResult, true));
|
439
|
|
447
|
|
440
|
$orderData = $orderDetail['data'];
|
448
|
$orderData = $orderDetail['data'];
|
441
|
$firstGoods = current($orderData['order_goods']);
|
449
|
$firstGoods = current($orderData['order_goods']);
|
|
@@ -447,10 +455,12 @@ class PayModel |
|
@@ -447,10 +455,12 @@ class PayModel |
447
|
'tellphoneNum' => $orderData['mobile'],
|
455
|
'tellphoneNum' => $orderData['mobile'],
|
448
|
'tradeName' => $firstGoods['product_name'],
|
456
|
'tradeName' => $firstGoods['product_name'],
|
449
|
'choosePayUrl' => Helpers::url('/shopping/pay', array('order_code' => $orderData['order_code'])),
|
457
|
'choosePayUrl' => Helpers::url('/shopping/pay', array('order_code' => $orderData['order_code'])),
|
450
|
- 'qrcodeUrl' => $payResult['code_url']//$reqPars['pay_url'] // 'http://paysdk.weixin.qq.com/example/qrcode.php?data=' . $result['code_url']
|
458
|
+ 'qrcodeUrl' => $payResult['code_url'] // 'http://paysdk.weixin.qq.com/example/qrcode.php?data=' . $result['code_url']
|
451
|
);
|
459
|
);
|
452
|
|
460
|
|
453
|
} while (false);
|
461
|
} while (false);
|
|
|
462
|
+ $log->LogInfo('=====[' . $orderCode . ']===微信支付时,处理微信支付的结果为:========');
|
|
|
463
|
+ $log->LogInfo(var_export($result, true));
|
454
|
|
464
|
|
455
|
return $result;
|
465
|
return $result;
|
456
|
}
|
466
|
}
|
|
@@ -476,22 +486,24 @@ class PayModel |
|
@@ -476,22 +486,24 @@ class PayModel |
476
|
|
486
|
|
477
|
// 初始化日志
|
487
|
// 初始化日志
|
478
|
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
488
|
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
479
|
- $log->LogInfo('========[' . $orderCode . ']========');
|
|
|
480
|
- $log->LogInfo('========开始查询微信扫码支付状态========');
|
489
|
+ $log->LogInfo('=====[' . $orderCode . ']===开始查询微信扫码支付状态========');
|
481
|
|
490
|
|
482
|
// 组装微信支付的订单号
|
491
|
// 组装微信支付的订单号
|
483
|
$tradeNo = 'YOHOBuy_' . $orderCode;
|
492
|
$tradeNo = 'YOHOBuy_' . $orderCode;
|
484
|
$input = new WxPayOrderQuery();
|
493
|
$input = new WxPayOrderQuery();
|
485
|
$input->SetOut_trade_no($tradeNo);
|
494
|
$input->SetOut_trade_no($tradeNo);
|
486
|
$payResult = WxPayApi::orderQuery($input);
|
495
|
$payResult = WxPayApi::orderQuery($input);
|
|
|
496
|
+ $log->LogInfo(var_export($payResult, true));
|
487
|
|
497
|
|
488
|
if (isset($payResult['trade_state']) && $payResult['trade_state'] === 'SUCCESS') {
|
498
|
if (isset($payResult['trade_state']) && $payResult['trade_state'] === 'SUCCESS') {
|
489
|
- $log->LogInfo('========微信扫码支付成功========');
|
499
|
+ $log->LogInfo('====[' . $orderCode . ']====微信扫码支付成功========');
|
490
|
$result = array(
|
500
|
$result = array(
|
491
|
'code' => '200',
|
501
|
'code' => '200',
|
492
|
'message' => 'success'
|
502
|
'message' => 'success'
|
493
|
);
|
503
|
);
|
494
|
}
|
504
|
}
|
|
|
505
|
+
|
|
|
506
|
+ $log->LogInfo('====[' . $orderCode . ']====微信扫码支付失败========');
|
495
|
} while (false);
|
507
|
} while (false);
|
496
|
|
508
|
|
497
|
return $result;
|
509
|
return $result;
|
|
@@ -518,13 +530,13 @@ class PayModel |
|
@@ -518,13 +530,13 @@ class PayModel |
518
|
$log->LogInfo('========[' . $payResult->orderCode . ']========');
|
530
|
$log->LogInfo('========[' . $payResult->orderCode . ']========');
|
519
|
$log->LogInfo(var_export($payResult, true));
|
531
|
$log->LogInfo(var_export($payResult, true));
|
520
|
|
532
|
|
521
|
- $log->LogInfo('===开始调用获取订单详情方式接口,接口方法为app.SpaceOrders.detail===');
|
533
|
+ $log->LogInfo('==[' . $payResult->orderCode . ']=开始调用获取订单详情方式接口,接口方法为app.SpaceOrders.detail===');
|
522
|
$orderInfo = OrderData::getOrderDetail($uid, $payResult->orderCode);
|
534
|
$orderInfo = OrderData::getOrderDetail($uid, $payResult->orderCode);
|
523
|
- $log->LogInfo('===结束调用获取订单详情方式接口,返回结果为===');
|
535
|
+ $log->LogInfo('==[' . $payResult->orderCode . ']=结束调用获取订单详情方式接口,返回结果为===');
|
524
|
$log->LogInfo(var_export($orderInfo, true));
|
536
|
$log->LogInfo(var_export($orderInfo, true));
|
525
|
|
537
|
|
526
|
if (!isset($orderInfo['data']) || empty($orderInfo['data'])) {
|
538
|
if (!isset($orderInfo['data']) || empty($orderInfo['data'])) {
|
527
|
- $log->LogInfo('===订单支付失败,未获取到订单详情信息===');
|
539
|
+ $log->LogInfo('==[' . $payResult->orderCode . ']=订单支付失败,未获取到订单详情信息===');
|
528
|
break;
|
540
|
break;
|
529
|
}
|
541
|
}
|
530
|
|
542
|
|
|
@@ -539,9 +551,9 @@ class PayModel |
|
@@ -539,9 +551,9 @@ class PayModel |
539
|
// 初始化日志
|
551
|
// 初始化日志
|
540
|
$log = new PhpLog(self::SEND_MESSAGE_LOG, 'PRC', self::LOG_LEVEL);
|
552
|
$log = new PhpLog(self::SEND_MESSAGE_LOG, 'PRC', self::LOG_LEVEL);
|
541
|
$log->LogInfo('===[' . $orderCode . ']===');
|
553
|
$log->LogInfo('===[' . $orderCode . ']===');
|
542
|
- $log->LogInfo('===开始调用订单取消时给用户发短信接口,接口方法为app.message.sendMsg===');
|
554
|
+ $log->LogInfo('==[' . $orderCode . ']=开始调用订单取消时给用户发短信接口,接口方法为app.message.sendMsg===');
|
543
|
$messageReturn = PayData::sendMessage($orderData['mobile'], 'error_sms', '支付成功,但订单已取消,订单号为' . $orderCode);
|
555
|
$messageReturn = PayData::sendMessage($orderData['mobile'], 'error_sms', '支付成功,但订单已取消,订单号为' . $orderCode);
|
544
|
- $log->LogInfo('===结束调用给用户发短信接口,返回结果为===');
|
556
|
+ $log->LogInfo('==[' . $orderCode . ']=结束调用给用户发短信接口,返回结果为===');
|
545
|
$log->LogInfo(var_export($messageReturn, true));
|
557
|
$log->LogInfo(var_export($messageReturn, true));
|
546
|
|
558
|
|
547
|
$result['code'] = 417;
|
559
|
$result['code'] = 417;
|
|
@@ -552,7 +564,7 @@ class PayModel |
|
@@ -552,7 +564,7 @@ class PayModel |
552
|
// 支付金额与订单金额不一致
|
564
|
// 支付金额与订单金额不一致
|
553
|
if (round($amount, 2) != round($payResult->totalFee, 2)) {
|
565
|
if (round($amount, 2) != round($payResult->totalFee, 2)) {
|
554
|
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
566
|
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
555
|
- $log->LogInfo('===订单支付失败,支付金额与订单金额不一致===');
|
567
|
+ $log->LogInfo('==[' . $orderCode . ']=订单支付失败,支付金额与订单金额不一致===');
|
556
|
$result['code'] = 415;
|
568
|
$result['code'] = 415;
|
557
|
$result['message'] = '支付金额与订单金额不一致';
|
569
|
$result['message'] = '支付金额与订单金额不一致';
|
558
|
break;
|
570
|
break;
|
|
@@ -569,20 +581,20 @@ class PayModel |
|
@@ -569,20 +581,20 @@ class PayModel |
569
|
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
581
|
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
|
570
|
$log->LogInfo('===[' . $orderCode . ']===');
|
582
|
$log->LogInfo('===[' . $orderCode . ']===');
|
571
|
|
583
|
|
572
|
- $log->LogInfo('===开始调用ERP提交订单状态接口,接口方法为web.SpaceOrders.submitOrderStatus===');
|
|
|
573
|
- $log->LogInfo('===请求参数为orderCode=' . $orderCode . '===');
|
584
|
+ $log->LogInfo('==[' . $orderCode . ']=开始调用ERP提交订单状态接口,接口方法为web.SpaceOrders.submitOrderStatus===');
|
|
|
585
|
+ $log->LogInfo('==[' . $orderCode . ']=请求参数为orderCode=' . $orderCode . '===');
|
574
|
// ERP提交订单状态
|
586
|
// ERP提交订单状态
|
575
|
$erpReturn = PayData::submitOrderStatus($orderCode, $payment, $bankName, $bankCode, $amount, $payOrderCode, $tradeNo, $bankBillNo);
|
587
|
$erpReturn = PayData::submitOrderStatus($orderCode, $payment, $bankName, $bankCode, $amount, $payOrderCode, $tradeNo, $bankBillNo);
|
576
|
- $log->LogInfo('===结束调用ERP提交订单状态接口,返回结果为===');
|
588
|
+ $log->LogInfo('==[' . $orderCode . ']=结束调用ERP提交订单状态接口,返回结果为===');
|
577
|
$log->LogInfo(var_export($erpReturn, true));
|
589
|
$log->LogInfo(var_export($erpReturn, true));
|
578
|
|
590
|
|
579
|
- $log->LogInfo('===开始调用更新订单状态接口,接口方法为web.SpaceOrders.updatePaymentStatus===');
|
|
|
580
|
- $log->LogInfo('===请求参数为orderId=' . $orderData['order_id'] . 'uid=' . $uid . '===');
|
591
|
+ $log->LogInfo('==[' . $orderCode . ']=开始调用更新订单状态接口,接口方法为web.SpaceOrders.updatePaymentStatus===');
|
|
|
592
|
+ $log->LogInfo('==[' . $orderCode . ']=请求参数为orderId=' . $orderData['order_id'] . 'uid=' . $uid . '===');
|
581
|
// 更新订单的状态
|
593
|
// 更新订单的状态
|
582
|
$updateOrderStatus = PayData::updateOrderStatus($orderData['order_id'], $uid, $payment, 'Y', $bankCode);
|
594
|
$updateOrderStatus = PayData::updateOrderStatus($orderData['order_id'], $uid, $payment, 'Y', $bankCode);
|
583
|
- $log->LogInfo('===结束调用更新订单状态接口,返回结果为===');
|
595
|
+ $log->LogInfo('==[' . $orderCode . ']=结束调用更新订单状态接口,返回结果为===');
|
584
|
$log->LogInfo(var_export($updateOrderStatus, true));
|
596
|
$log->LogInfo(var_export($updateOrderStatus, true));
|
585
|
- $log->LogInfo('===订单支付成功,请等待发货===');
|
597
|
+ $log->LogInfo('==[' . $orderCode . ']=订单支付成功,请等待发货===');
|
586
|
|
598
|
|
587
|
$result['code'] = 200;
|
599
|
$result['code'] = 200;
|
588
|
$result['message'] = '支付成功,请等待发货';
|
600
|
$result['message'] = '支付成功,请等待发货';
|