|
|
|
@ -757,40 +757,50 @@ class Index extends CI_Controller {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//检测是否是APP订单,默认不处理
|
|
|
|
|
// && $item->pn_payment_status !== 'Refunded'
|
|
|
|
|
if (
|
|
|
|
|
( (strpos($item->pn_memo, 'China Train Booking') !== false)
|
|
|
|
|
|| (strpos($item->pn_memo, 'ChinaTrainBooking') !== false)
|
|
|
|
|
)
|
|
|
|
|
&& empty($pn_txn_id)
|
|
|
|
|
) { //APP自动出票的订单不需要处理
|
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, 'send');
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据note信息找到订单号
|
|
|
|
|
$get_order_no = $item->pn_invoice;
|
|
|
|
|
$orderid_info = $this->analysis_orderid($item->pn_invoice);
|
|
|
|
|
if (empty($orderid_info)) {
|
|
|
|
|
$get_order_no = $item->pn_custom;
|
|
|
|
|
$orderid_info = $this->analysis_orderid($item->pn_custom);
|
|
|
|
|
}
|
|
|
|
|
if (empty($orderid_info)) {
|
|
|
|
|
$get_order_no = $item->pn_item_name;
|
|
|
|
|
$orderid_info = $this->analysis_orderid($item->pn_item_name);
|
|
|
|
|
}
|
|
|
|
|
if (empty($orderid_info)) {
|
|
|
|
|
$get_order_no = $item->pn_item_number;
|
|
|
|
|
$orderid_info = $this->analysis_orderid($item->pn_item_number);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//找不到订单号,设置为发送失败标示
|
|
|
|
|
if (empty($orderid_info)) {
|
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$orderid_info = json_decode($orderid_info);
|
|
|
|
|
// 仅自动程序发送提醒 false == $handpick &&
|
|
|
|
|
if ($item->pn_payment_status === 'Completed'
|
|
|
|
|
&& $orderid_info->ordertype == 'A' && strpos($get_order_no, 'China Train Booking') !== false) {
|
|
|
|
|
// APP 组的China Train Booking-开头的订单号
|
|
|
|
|
// 发送邮件提醒外联核对收款金额, 不写入收款记录
|
|
|
|
|
$this->process_notify_APP($item, $orderid_info);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//检测是否是APP订单,默认不处理
|
|
|
|
|
// && $item->pn_payment_status !== 'Refunded'
|
|
|
|
|
if (
|
|
|
|
|
( (strpos($item->pn_memo, 'China Train Booking') !== false)
|
|
|
|
|
|| (strpos($item->pn_memo, 'ChinaTrainBooking') !== false)
|
|
|
|
|
)
|
|
|
|
|
&& empty($pn_txn_id)
|
|
|
|
|
) { //APP自动出票的订单不需要处理
|
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, 'send');
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据订单号查找外联信息
|
|
|
|
|
$orderid_info = json_decode($orderid_info);
|
|
|
|
|
$handpick = empty($pn_txn_id) ? false : TRUE;
|
|
|
|
|
$advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick);
|
|
|
|
|
|
|
|
|
|
// for trippest tourMaster 2018.05.28
|
|
|
|
@ -1457,4 +1467,39 @@ class Index extends CI_Controller {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function process_notify_APP($item, $orderid_info)
|
|
|
|
|
{
|
|
|
|
|
$advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
|
|
|
|
|
//查不到订单信息
|
|
|
|
|
if (empty($advisor_info)) {
|
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
$opi_email = !empty($advisor_info->OPI_Email) ? $advisor_info->OPI_Email : ''; //lussie@chinahighlights.net
|
|
|
|
|
$opi_firstname = !empty($advisor_info->OPI_FirstName) ? $advisor_info->OPI_FirstName : !empty($advisor_info->OPI_Name) ? $advisor_info->OPI_Name : ''; //lussie
|
|
|
|
|
//没有外联信息表示订单未分配
|
|
|
|
|
if (empty($opi_email) || empty($opi_firstname)) {
|
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//添加邮件发送记录
|
|
|
|
|
if ($item->pn_send !== 'send') {
|
|
|
|
|
//给外联发送通知邮件
|
|
|
|
|
$fromName = !empty($item->pn_payer) ? $item->pn_payer : '';
|
|
|
|
|
$fromEmail = !empty($item->pn_payer_email) ? $item->pn_payer_email : '';
|
|
|
|
|
$toName = !empty($opi_firstname) ? $opi_firstname : '';
|
|
|
|
|
$toEmail = !empty($opi_email) ? $opi_email : '';
|
|
|
|
|
// $subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->pn_mc_gross . $item->pn_mc_currency . ' / ' . $fromName;
|
|
|
|
|
$subject = "请核对收款_" . $orderid_info->orderid . "_" . $item->pn_mc_currency . "_" . $item->pn_mc_gross;
|
|
|
|
|
$body = $this->load->view('mail_templete', $item, true); //$item->pn_memo;
|
|
|
|
|
$M_RelatedInfo = $item->pn_sn;
|
|
|
|
|
$M_AddTime = $item->pn_payment_date;
|
|
|
|
|
$M_State = 0;
|
|
|
|
|
$this->Paypal_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'paypal note');
|
|
|
|
|
//添加邮件发送记录 end
|
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, 'send');
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|