From 1ce0e268df6a6bd452ea5c71fa77d899101f9be8 Mon Sep 17 00:00:00 2001 From: lyt Date: Tue, 7 May 2019 17:52:26 +0800 Subject: [PATCH] =?UTF-8?q?config=20=E5=A2=9E=E5=8A=A0Trippest=E7=AB=99?= =?UTF-8?q?=E7=82=B9;=E9=80=80=E6=AC=BE=E5=A4=84=E7=90=86=E7=9A=84?= =?UTF-8?q?=E5=AE=A2=E4=BA=BA=E9=82=AE=E4=BB=B6:+=E5=A4=96=E8=81=94?= =?UTF-8?q?=E7=9A=84=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webht/config/config.php | 3 +- .../third_party/paypal/controllers/index.php | 104 ++++++++++-------- .../paypal/models/paypal_model.php | 28 ++++- .../third_party/paypal/views/refund_buyer.php | 8 +- 4 files changed, 85 insertions(+), 58 deletions(-) diff --git a/webht/config/config.php b/webht/config/config.php index 31b9d963..38dc5444 100644 --- a/webht/config/config.php +++ b/webht/config/config.php @@ -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') ); diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index a930c19a..9569c86f 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -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 ; } diff --git a/webht/third_party/paypal/models/paypal_model.php b/webht/third_party/paypal/models/paypal_model.php index 0684017d..0f8697f5 100644 --- a/webht/third_party/paypal/models/paypal_model.php +++ b/webht/third_party/paypal/models/paypal_model.php @@ -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) diff --git a/webht/third_party/paypal/views/refund_buyer.php b/webht/third_party/paypal/views/refund_buyer.php index 4624db39..a4b05563 100644 --- a/webht/third_party/paypal/views/refund_buyer.php +++ b/webht/third_party/paypal/views/refund_buyer.php @@ -34,10 +34,10 @@
 Best Regards!
 
-OPI2_Name ?>, Travel Advisor
-Tel: +86-773-OPI_Telephone ?> Mobile: +86-OPI_MoveTelephone ?>
-E-mail: OPI_Email ?>
-
+fullname ?>, Travel Advisor
+Tel: tel ?> Mobile: mobile ?>
+E-mail: email ?>
+'; } ?> Address: Building 6, Chuangyi Business Park, 70 Qilidian Road, Guilin, Guangxi, 541004, China