|
|
@ -653,6 +653,8 @@ class Index extends CI_Controller {
|
|
|
|
$ordertype = 'T';
|
|
|
|
$ordertype = 'T';
|
|
|
|
} elseif (substr($ordertype_temp, 0, 1) == 'B') {
|
|
|
|
} elseif (substr($ordertype_temp, 0, 1) == 'B') {
|
|
|
|
$ordertype = 'B';
|
|
|
|
$ordertype = 'B';
|
|
|
|
|
|
|
|
} elseif (substr($ordertype_temp, 0, 1) == 'A') {
|
|
|
|
|
|
|
|
$ordertype = 'A';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 2018.05.28 for Trippest, tourMaster的订单号是01开头
|
|
|
|
// 2018.05.28 for Trippest, tourMaster的订单号是01开头
|
|
|
@ -909,10 +911,9 @@ class Index extends CI_Controller {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$orderid_info = json_decode($orderid_info);
|
|
|
|
$orderid_info = json_decode($orderid_info);
|
|
|
|
// for trippest tourMaster 2018.05.28
|
|
|
|
|
|
|
|
if ($orderid_info->ordertype == 'TP') {
|
|
|
|
if (in_array($orderid_info->ordertype, array('TP', 'A')) ) {
|
|
|
|
$this->trippest_note($orderid_info, $item);
|
|
|
|
$orderid_info->ordertype = 'B';
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//根据订单号查找外联信息
|
|
|
|
//根据订单号查找外联信息
|
|
|
@ -968,52 +969,59 @@ class Index extends CI_Controller {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$web_code = $advisor_info->COLI_WebCode;
|
|
|
|
|
|
|
|
$site_info = $this->config->item('site');
|
|
|
|
|
|
|
|
if ( ! isset($site_info[$web_code])) {
|
|
|
|
|
|
|
|
$web_code = 'cht';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$site_info = $site_info[$web_code];
|
|
|
|
|
|
|
|
$advisor_detail = $this->Paypal_model->get_advisor_detail($advisor_info->OPI_SN, $site_info['site_lgc']);
|
|
|
|
|
|
|
|
$item->advisor_detail = $advisor_detail;
|
|
|
|
|
|
|
|
$item->site = $site_info['site_url'];
|
|
|
|
|
|
|
|
//添加邮件发送记录
|
|
|
|
//添加邮件发送记录
|
|
|
|
//给外联发送通知邮件
|
|
|
|
if ($item->pn_send !== 'send' && substr($item->pn_send, 0, 5) !== 'send-') {
|
|
|
|
$fromName = !empty($item->pn_payer) ? $item->pn_payer : '';
|
|
|
|
// 客人邮件中的外联落款
|
|
|
|
$fromEmail = !empty($item->pn_payer_email) ? $item->pn_payer_email : '';
|
|
|
|
// $web_code = 'cht'; // 默认cht
|
|
|
|
$toName = !empty($opi_firstname) ? $opi_firstname : '';
|
|
|
|
$web_lgc = 1;
|
|
|
|
$toEmail = !empty($opi_email) ? $opi_email : '';
|
|
|
|
$web_code = strtolower($advisor_info->COLI_WebCode);
|
|
|
|
$subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->pn_mc_gross . $item->pn_mc_currency . ' / ' . $fromName;
|
|
|
|
$site_info = $this->config->item('site');
|
|
|
|
$body = $this->load->view('mail_templete', $item, true);
|
|
|
|
if (isset($site_info[$web_code])) {
|
|
|
|
$M_RelatedInfo = $item->pn_sn;
|
|
|
|
$site_info = $site_info[$web_code];
|
|
|
|
$M_AddTime = $item->pn_payment_date;
|
|
|
|
$item->site = $site_info['site_url'];
|
|
|
|
$M_State = 0;
|
|
|
|
$web_lgc = $site_info['site_lgc'];
|
|
|
|
$this->Paypal_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'paypal note');
|
|
|
|
}
|
|
|
|
// 通知客人, 客人邮箱
|
|
|
|
$advisor_detail = $this->Paypal_model->get_advisor_detail($advisor_info->COLI_SN, $advisor_info->OPI_SN, $web_lgc);
|
|
|
|
$customer_detail = $this->Paypal_model->get_customer_detail($advisor_info->COLI_SN, $orderid_info->ordertype);
|
|
|
|
$item->advisor_detail = $advisor_detail;
|
|
|
|
$c_fromName = $advisor_detail->OPI2_Name;
|
|
|
|
|
|
|
|
$c_fromEmail = $advisor_detail->OPI_Email;
|
|
|
|
//给外联发送通知邮件
|
|
|
|
$c_toName = $customer_detail->fullname;
|
|
|
|
$fromName = !empty($item->pn_payer) ? $item->pn_payer : '';
|
|
|
|
$c_toEmail = $customer_detail->email;
|
|
|
|
$fromEmail = !empty($item->pn_payer_email) ? $item->pn_payer_email : '';
|
|
|
|
$c_subject = $item->pn_mc_currency . " " . str_replace('-', '', $item->pn_mc_gross) . " Refunded to your account, booking number " . $item->pn_invoice;
|
|
|
|
$toName = !empty($opi_firstname) ? $opi_firstname : '';
|
|
|
|
$c_body = $this->load->view('refund_buyer', $item, true);
|
|
|
|
$toEmail = !empty($opi_email) ? $opi_email : '';
|
|
|
|
$c_M_RelatedInfo = $item->pn_sn;
|
|
|
|
$subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->pn_mc_gross . $item->pn_mc_currency . ' / ' . $fromName;
|
|
|
|
$c_M_AddTime = $item->pn_payment_date;
|
|
|
|
$body = $this->load->view('mail_templete', $item, true);
|
|
|
|
$c_M_State = 0;
|
|
|
|
$M_RelatedInfo = $item->pn_sn;
|
|
|
|
$this->Paypal_model->save_automail(
|
|
|
|
$M_AddTime = $item->pn_payment_date;
|
|
|
|
$c_fromName,
|
|
|
|
$M_State = 0;
|
|
|
|
$c_fromEmail,
|
|
|
|
$this->Paypal_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'paypal note');
|
|
|
|
$c_toName,
|
|
|
|
// 通知客人, 客人邮箱
|
|
|
|
$c_toEmail,
|
|
|
|
$customer_detail = $this->Paypal_model->get_customer_detail($advisor_info->COLI_SN, $orderid_info->ordertype);
|
|
|
|
$c_subject,
|
|
|
|
$c_fromName = $advisor_detail->fullname;
|
|
|
|
$c_body,
|
|
|
|
$opi_email_list = explode(";", $advisor_detail->email); // 解析外联的邮件
|
|
|
|
$c_M_RelatedInfo,
|
|
|
|
$c_fromEmail = trim($opi_email_list[0]);
|
|
|
|
$c_M_State,
|
|
|
|
$c_toName = $customer_detail->fullname;
|
|
|
|
$c_M_AddTime,
|
|
|
|
$c_toEmail = $customer_detail->email;
|
|
|
|
'paypal refund receipt');
|
|
|
|
$c_subject = $item->pn_mc_currency . " " . str_replace('-', '', $item->pn_mc_gross) . " Refunded to your account, booking number " . $item->pn_invoice;
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, 'send-customer');
|
|
|
|
$c_body = $this->load->view('refund_buyer', $item, true);
|
|
|
|
// TODO 通知财务, 如果已做账
|
|
|
|
$c_M_RelatedInfo = $item->pn_sn;
|
|
|
|
|
|
|
|
$c_M_AddTime = $item->pn_payment_date;
|
|
|
|
|
|
|
|
$c_M_State = 0;
|
|
|
|
|
|
|
|
$this->Paypal_model->save_automail(
|
|
|
|
|
|
|
|
$c_fromName,
|
|
|
|
|
|
|
|
$c_fromEmail,
|
|
|
|
|
|
|
|
$c_toName,
|
|
|
|
|
|
|
|
$c_toEmail,
|
|
|
|
|
|
|
|
$c_subject,
|
|
|
|
|
|
|
|
$c_body,
|
|
|
|
|
|
|
|
$c_M_RelatedInfo,
|
|
|
|
|
|
|
|
$c_M_State,
|
|
|
|
|
|
|
|
$c_M_AddTime,
|
|
|
|
|
|
|
|
'paypal refund receipt');
|
|
|
|
|
|
|
|
$this->Note_model->update_send($item->pn_txn_id, 'send-customer');
|
|
|
|
|
|
|
|
}
|
|
|
|
//添加邮件发送记录 end
|
|
|
|
//添加邮件发送记录 end
|
|
|
|
|
|
|
|
// TODO 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录
|
|
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|