diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index e84e7eb4..91466d8d 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -879,7 +879,7 @@ class Index extends CI_Controller { continue; } $orderid_info = json_decode($orderid_info); - // 仅自动程序发送提醒 false == $handpick && + // 仅自动程序发送提醒 && false == $handpick && if (strtolower($item->pn_payment_status) === 'completed' && $orderid_info->ordertype == 'A' ) { @@ -1607,6 +1607,10 @@ class Index extends CI_Controller { public function process_notify_APP($item, $orderid_info) { + $content = json_decode($item->pn_memo, true); + $post_body = http_build_query($content); + $this->async_curl("http://wx.chinatrainbooking.com/paypalend/", $post_body, 5); + return false; $advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); //查不到订单信息 if (empty($advisor_info)) { @@ -1642,4 +1646,42 @@ class Index extends CI_Controller { return empty($order_gai); } + function async_curl($url, $body=null, $second = 1) + { + $ch = curl_init(); + $curlVersion = curl_version(); + $ua = "Webht (".PHP_OS.") PHP/".PHP_VERSION." CURL/".$curlVersion['version']." " . "AsyncJob"; + //设置超时 + curl_setopt($ch, CURLOPT_TIMEOUT, $second); + curl_setopt($ch,CURLOPT_URL, $url); + if(stripos($url,"https://")!==FALSE){ + // curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); + // curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); + } else { + // curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,TRUE); + // curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);//严格校验 + } + curl_setopt($ch,CURLOPT_USERAGENT, $ua); + //设置header + curl_setopt($ch, CURLOPT_HEADER, FALSE); + //要求结果为字符串且输出到屏幕上 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + if ($body !== null) { + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $body); + } + + //运行curl + $data = curl_exec($ch); + if (curl_errno($ch) && !in_array(curl_errno($ch),array(0,28)) ) { + log_message('error',"Webht Async Curl Call 出错,错误码:" . curl_errno($ch) . ": " . curl_error($ch) . ", url: " . $url); + } + if (!in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE),array(0,200)) ) { + log_message('error', "Webht Async Curl Call Request html Status Code: ".curl_getinfo($ch, CURLINFO_HTTP_CODE)."; curl url: ".$url); + } + curl_close($ch); + return $data; + } + }