|
@@ -250,22 +250,23 @@ class OrderService
|
|
|
|
|
|
public static function findWxpay($orderId, $nbr = 0)
|
|
|
{
|
|
|
- dump('进来了');
|
|
|
- $order = [
|
|
|
- 'out_trade_no' => $orderId,
|
|
|
- ];
|
|
|
+ if($nbr >= 10){
|
|
|
+ throw new BusinessException("订单查询失败");
|
|
|
+ }
|
|
|
try{
|
|
|
- $config = config('payment.wxpay');
|
|
|
- unset($config['notify_url']);
|
|
|
- dump(Pay::wechat($config));
|
|
|
- $result = Pay::wechat($config)->find($orderId,'pos');
|
|
|
+ $result = Pay::wechat(config('payment.wxpay'))->find($orderId,'pos');
|
|
|
+ $result = json_decode(json_encode($result),true);
|
|
|
+
|
|
|
}catch (\Exception $e){
|
|
|
- dump($e->getMessage());
|
|
|
+ throw new BusinessException("订单查询失败");
|
|
|
}
|
|
|
|
|
|
- dump($result);
|
|
|
-
|
|
|
- return $result;
|
|
|
+ if (!empty($result['return_code']) && $result['return_code'] == 'SUCCESS' && !empty($result['result_code']) && $result['result_code'] == 'SUCCESS'){
|
|
|
+ return $result;
|
|
|
+ }else{
|
|
|
+ sleep(6);
|
|
|
+ self::findWxpay($orderId,$nbr + 1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|