|
|
@ -879,17 +879,16 @@ class Index extends CI_Controller {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$orderid_info = json_decode($orderid_info);
|
|
|
|
$orderid_info = json_decode($orderid_info);
|
|
|
|
// 仅自动程序发送提醒 false == $handpick &&
|
|
|
|
// 仅自动程序发送提醒 && false == $handpick &&
|
|
|
|
if (strtolower($item->pn_payment_status) === 'completed'
|
|
|
|
if (strtolower($item->pn_payment_status) === 'completed'
|
|
|
|
&& $orderid_info->ordertype == 'A'
|
|
|
|
&& $orderid_info->ordertype == 'A'
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
// APP 组的China Train Booking-开头的订单号
|
|
|
|
// APP 组的China Train Booking-开头的订单号
|
|
|
|
// 发送邮件提醒外联核对收款金额, 不写入收款记录
|
|
|
|
// 发送邮件提醒外联核对收款金额, 不写入收款记录
|
|
|
|
$if_empty_gai = $this->process_notify_APP($item, $orderid_info);
|
|
|
|
$if_empty_gai = $this->process_notify_APP($item, $orderid_info);
|
|
|
|
if($if_empty_gai !== true) {
|
|
|
|
$send = $if_empty_gai !== true ? 'send-app' : 'sendfail';
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, 'send', $item->pn_sn);
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, $send, $item->pn_sn);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
} // 收款记录为空, 需要补录
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//检测是否是APP订单,默认不处理
|
|
|
|
//检测是否是APP订单,默认不处理
|
|
|
@ -1607,6 +1606,15 @@ class Index extends CI_Controller {
|
|
|
|
|
|
|
|
|
|
|
|
public function process_notify_APP($item, $orderid_info)
|
|
|
|
public function process_notify_APP($item, $orderid_info)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
$content = json_decode($item->pn_memo, true);
|
|
|
|
|
|
|
|
$post_body = http_build_query($content);
|
|
|
|
|
|
|
|
$post_body .= '&appkey=jdfk*$jfjdk1688';
|
|
|
|
|
|
|
|
$app_return = $this->async_curl("http://wx.chinatrainbooking.com/paypalend/", $post_body, 5);
|
|
|
|
|
|
|
|
if (intval($app_return)===200) {
|
|
|
|
|
|
|
|
return false; // 下一步更新为send
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true; // 下一步: sendfail
|
|
|
|
|
|
|
|
|
|
|
|
$advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
|
|
|
|
$advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
|
|
|
|
//查不到订单信息
|
|
|
|
//查不到订单信息
|
|
|
|
if (empty($advisor_info)) {
|
|
|
|
if (empty($advisor_info)) {
|
|
|
@ -1642,4 +1650,43 @@ class Index extends CI_Controller {
|
|
|
|
return empty($order_gai);
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$http_ret_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
|
|
|
|
|
|
curl_close($ch);
|
|
|
|
|
|
|
|
return $http_ret_code;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|