|
@@ -216,8 +216,8 @@ class OrderService
|
|
|
'auth_code' => $params['qrcode_nbr'],
|
|
|
];
|
|
|
try {
|
|
|
- $result = self::findWxpay('OD20240816113023HNSQDI',0);
|
|
|
- $result = Pay::wechat(config('payment.wxpay'))->pos($payData);
|
|
|
+ Pay::wechat(config('payment.wxpay'))->pos($payData);
|
|
|
+ $result = self::findWxpay($params['orderGroupId'], 0);
|
|
|
} catch (\Exception $e) {
|
|
|
$log->error("WXPAY", ['msg' => $e->getMessage()]);
|
|
|
throw new BusinessException("支付失败");
|
|
@@ -233,7 +233,8 @@ class OrderService
|
|
|
'auth_code' => $params['qrcode_nbr'],
|
|
|
];
|
|
|
try {
|
|
|
- $result = Pay::alipay(config('payment.alipay'))->pos($payData);
|
|
|
+ $result = self::findAlipay('OD202408151627038Q790K', 0);
|
|
|
+ Pay::alipay(config('payment.alipay'))->pos($payData);
|
|
|
} catch (\Exception $e) {
|
|
|
$log->error("ALIPAY", ['msg' => $e->getMessage()]);
|
|
|
throw new BusinessException("支付失败");
|
|
@@ -248,26 +249,55 @@ class OrderService
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Desc 查询微信支付
|
|
|
+ * @Author Gorden
|
|
|
+ * @Date 2024/8/16 14:55
|
|
|
+ *
|
|
|
+ * @param $orderId
|
|
|
+ * @param $nbr
|
|
|
+ * @return mixed|void
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
public static function findWxpay($orderId, $nbr = 0)
|
|
|
{
|
|
|
- if($nbr >= 10){
|
|
|
+ if ($nbr >= 10) {
|
|
|
throw new BusinessException("订单查询失败");
|
|
|
}
|
|
|
- try{
|
|
|
- if ($nbr > 3){
|
|
|
- $result = Pay::wechat(config('payment.wxpay'))->find($orderId,'pos');
|
|
|
- $result = json_decode(json_encode($result),true);
|
|
|
- }
|
|
|
- }catch (\Exception $e){
|
|
|
+ try {
|
|
|
+ $result = Pay::wechat(config('payment.wxpay'))->find($orderId, 'pos');
|
|
|
+ $result = json_decode(json_encode($result), true);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ throw new BusinessException("订单查询失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function findAlipay($orderId, $nbr = 0)
|
|
|
+ {
|
|
|
+ if ($nbr >= 10) {
|
|
|
+ throw new BusinessException("订单查询失败");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ $result = Pay::alipay(config('payment.alipay'))->find($orderId,'pos');
|
|
|
+ $result = json_decode(json_encode($result), true);
|
|
|
+ dump($result);
|
|
|
+ } catch (\Exception $e) {
|
|
|
throw new BusinessException("订单查询失败");
|
|
|
}
|
|
|
|
|
|
- if (!empty($result['return_code']) && $result['return_code'] == 'SUCCESS' && !empty($result['result_code']) && $result['result_code'] == 'SUCCESS'){
|
|
|
+ if (!empty($result['return_code']) && $result['return_code'] == 'SUCCESS' && !empty($result['result_code']) && $result['result_code'] == 'SUCCESS') {
|
|
|
return $result;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
dump("睡:".$nbr);
|
|
|
sleep(6);
|
|
|
- self::findWxpay($orderId,$nbr + 1);
|
|
|
+ self::findWxpay($orderId, $nbr + 1);
|
|
|
}
|
|
|
}
|
|
|
|