config 增加Trippest站点;退款处理的客人邮件:+外联的签名

feature/pay
lyt 6 years ago
parent cc7fc45dba
commit 1ce0e268df

@ -376,5 +376,6 @@ $config['site'] = array(
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'https://www.guilinchina.net'),
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'https://www.mybeijingchina.com'),
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'https://www.chinatravel.com'),
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'https://www.diychinatours.com')
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'https://www.diychinatours.com'),
'trippest' => array('site_code' => 'trippest', 'site_id' => 0, 'site_lgc' => '1', 'site_url' => 'https://www.trippest.com')
);

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

@ -612,12 +612,30 @@ class Paypal_model extends CI_Model {
return $this->HT->query($sql)->row();
}
public function get_advisor_detail($OPI_SN, $lgc=1)
public function get_advisor_detail($COLI_SN, $OPI_SN, $lgc=1)
{
$sql = "SELECT OPI_SN,OPI_MoveTelephone,OPI_Telephone,OPI_Email,OPI2_Name,OPI2_FirstName,OPI2_LastName
FROM [Tourmanager].[dbo].[V_Operator_Info]
where OPI_SN=? and LGC_LGC=? ";
return $this->HT->query($sql, array($OPI_SN, $lgc))->row();
$advisor_signature = $this->get_advisor_signature($COLI_SN);
if (empty($advisor_signature)) {
$sql = "SELECT OPI_SN, '+86-'+OPI_MoveTelephone mobile,'+86-773-'+OPI_Telephone tel,OPI_Email email,OPI2_Name fullname,OPI2_FirstName,OPI2_LastName
FROM [Tourmanager].[dbo].[V_Operator_Info]
where OPI_SN=? and LGC_LGC=? ";
$advisor_signature = $this->HT->query($sql, array($OPI_SN, $lgc))->row();
}
return $advisor_signature;
}
public function get_advisor_signature($COLI_SN)
{
$sql = "SELECT top 1 dbo.agenter_user.Name fullname, dbo.agenter_user.tel,
dbo.agenter_user.Email email, dbo.agenter_user.mobile, OPI_DEI_SN, COLI_OPI_ID
FROM dbo.BIZ_ConfirmLineInfo
INNER JOIN dbo.agenter_user ON dbo.BIZ_ConfirmLineInfo.COLI_OPI_ID = dbo.agenter_user.AU_OPI_SN
AND
(dbo.BIZ_ConfirmLineInfo.COLI_WebCode = dbo.agenter_user.agenter
OR (COLI_WebCode in ('EXPCH','MESENLLA','traba','wayaway','guias') and agenter='VAC')
)
LEFT JOIN OperatorInfo on COLI_OPI_ID = OPI_SN
WHERE (dbo.BIZ_ConfirmLineInfo.COLI_SN = ?)";
return $this->HT->query($sql, array($COLI_SN))->row();
}
public function get_customer_detail($COLI_SN, $ordertype)

@ -34,10 +34,10 @@
<pre style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size:13px;">
Best Regards!
<?php echo $advisor_detail->OPI2_Name ?>, Travel Advisor<br>
Tel: +86-773-<?php echo $advisor_detail->OPI_Telephone ?> Mobile: +86-<?php echo $advisor_detail->OPI_MoveTelephone ?><br>
E-mail: <?php echo $advisor_detail->OPI_Email ?><br>
<?php echo $site; ?><br>
<?php echo $advisor_detail->fullname ?>, Travel Advisor<br>
Tel: <?php echo $advisor_detail->tel ?> Mobile: <?php echo $advisor_detail->mobile ?><br>
E-mail: <?php echo $advisor_detail->email ?><br>
<?php if(isset($site)) { echo $site . '<br>'; } ?>
Address: Building 6, Chuangyi Business Park, 70 Qilidian Road, Guilin, Guangxi, 541004, China
</pre>
</div>

Loading…
Cancel
Save