diff --git a/application/service/OrderService.php b/application/service/OrderService.php index 46dc338ea..1752b3a14 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -143,7 +143,7 @@ class OrderService } } - // 发起支付 + // 发起支付数据 $pay_data = array( 'user' => $params['user'], 'out_user' => md5($params['user']['id']), @@ -173,6 +173,17 @@ class OrderService return $ret; } + // 微信中打开并且webopenid为空 + if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5'])) + { + if(!empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false && empty($pay_data['user']['weixin_web_openid'])) + { + // 授权成功后回调订单详情页面重新自动发起支付 + $url = MyUrl('index/order/detail', ['id'=>$pay_data['order_id'], 'is_pay_auto'=>1, 'is_pay_submit'=>1]); + session('plugins_weixinwebauth_pay_callback_view_url', $url); + } + } + // 发起支付 $pay_name = 'payment\\'.$payment[0]['payment']; $ret = (new $pay_name($payment[0]['config']))->Pay($pay_data);