Merge branch 'feature/pay'

feature/pay
lyt 6 years ago
commit f6bdd4ae9b

@ -376,5 +376,6 @@ $config['site'] = array(
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'https://www.guilinchina.net'), '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'), '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'), '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')
); );

@ -549,6 +549,7 @@ class AlipayTradeService extends CI_Controller
$this->AlipayTradeQueryContentBuilder->setOutTradeNo($orderId); $this->AlipayTradeQueryContentBuilder->setOutTradeNo($orderId);
} }
$response = $this->Query($this->AlipayTradeQueryContentBuilder); $response = $this->Query($this->AlipayTradeQueryContentBuilder);
// return $this->output->set_content_type('application/json')->set_output(json_encode($response));
return $response; return $response;
} }

@ -276,7 +276,7 @@ class IPayLinksService extends CI_Controller
return; return;
} }
public function query_pay($orderid=NULL) public function query_pay($orderid=NULL, $output=true)
{ {
$this->query_info_arr["queryOrderId"] = $this->create_guid(); $this->query_info_arr["queryOrderId"] = $this->create_guid();
$this->query_info_arr["orderId"] = $orderid; $this->query_info_arr["orderId"] = $orderid;
@ -286,8 +286,10 @@ class IPayLinksService extends CI_Controller
$this->query_info_arr["signMsg"] = $this->generate_sign($this->query_info_arr); $this->query_info_arr["signMsg"] = $this->generate_sign($this->query_info_arr);
$resp = $this->curl($this->queryUrl,$this->query_info_arr); $resp = $this->curl($this->queryUrl,$this->query_info_arr);
$resp_obj = simplexml_load_string($resp); $resp_obj = simplexml_load_string($resp);
$this->output->set_content_type('application/json')->set_output(json_encode(simplexml_load_string($resp))); if ($output !== true) {
return; return $resp_obj->details;
}
return $this->output->set_content_type('application/json')->set_output(json_encode(simplexml_load_string($resp)));
} }
public function query_refund($refund_order_id) public function query_refund($refund_order_id)
{ {
@ -364,14 +366,14 @@ class IPayLinksService extends CI_Controller
* @date 2017-08-29 * @date 2017-08-29
* @param string $orderid 订单号 * @param string $orderid 订单号
*/ */
public function batch_send_note($pn_txn_id = false, $old_ssje=NULL) public function batch_send_note($pn_txn_id = false, $old_ssje=NULL, $pn_id=NULL)
{ {
$data = array(); $data = array();
$int = 0; $int = 0;
//优先处理指定的交易号,用于修正交易号直接发送通知 //优先处理指定的交易号,用于修正交易号直接发送通知
if ( ! empty($pn_txn_id)) { if ( ! empty($pn_txn_id)) {
$data['unsend_list'] = array($this->Note_model->note($pn_txn_id)); $data['unsend_list'] = array($this->Note_model->note($pn_txn_id, $pn_id));
} }
// 待处理的 // 待处理的
if (empty($data['unsend_list'])) { if (empty($data['unsend_list'])) {
@ -446,14 +448,14 @@ class IPayLinksService extends CI_Controller
$ht_memo = '交易号(自动录入):' . $item->IPL_dealId; $ht_memo = '交易号(自动录入):' . $item->IPL_dealId;
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; $GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
//CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断 //CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断
if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP') { if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP' && strstr($advisor_info->COLI_WebCode, "-") != '-biz') {
//只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单 //只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单
$this->IPayLinks_model->add_account_info_forAPP( $this->IPayLinks_model->add_account_info_forAPP(
$GAI_COLI_SN, $GAI_COLI_SN,
$advisor_info->COLI_ID, $advisor_info->COLI_ID,
$item->IPL_orderAmount, $item->IPL_orderAmount,
$item->IPL_completeTime, $item->IPL_completeTime,
mb_strtoupper($item->currencyCode), $currencyCode,
$ssje, $ssje,
$item->IPL_completeTime, $item->IPL_completeTime,
$item->IPL_completeTime, $item->IPL_completeTime,
@ -573,6 +575,197 @@ class IPayLinksService extends CI_Controller
return; return;
} }
/*!
* 退款处理
* @date 2019-05-08
* * TODO APP组的退款没有原始订单
*/
public function send_refund($item, $old_ssje=NULL)
{
if ($item->IPL_stateCode != 2) {
return false;
}
// 原始收款订单
$raw_memo = json_decode($item->IPL_memo);
$parent_order = $raw_memo->orderId;
// 查询原始收款的交易号
$parent_payment = $this->query_pay($parent_order, false);
if (empty($parent_payment)) {
$this->Note_model->update_send($item->IPL_dealId, 'sendfail');
return false;
}
$parent_payment = $parent_payment->detail;
$parent_dealId = $parent_payment->dealId;
$parent_note = $this->Note_model->note($parent_dealId);
// APP 组的退款查不到原始收款记录
if (empty($parent_note) && true === $this->IPayLinks_model->if_APP_order($parent_order) ) {
$parent_note = $parent_payment;
// 补充字段
$parent_note->IPL_orderId = $parent_order . '_B';
$parent_note->IPL_currencyCode = $parent_payment->currencyCode;
$parent_note->IPL_payerName = strval("''");
$parent_note->IPL_payerEmail = strval("''");
}
//订单号
$orderid_info = $this->analysis_orderid($parent_note->IPL_orderId);
$orderid_info = json_decode($orderid_info);
//根据订单号查找外联信息
$advisor_info = $this->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
//查不到订单信息
if (empty($advisor_info)) {
$this->Note_model->update_send($item->IPL_dealId, 'sendfail');
return false;
}
//更新正确的订单信息到记录中,以这个为主
$this->Note_model->set_invoice($item->IPL_dealId, $orderid_info->orderid . '_' . $orderid_info->ordertype);
//添加支付信息入库
//没有分配订单之前先添加付款记录,这个过程可能会执行多次,必须在添加记录前查找是否有数据
if (!empty($orderid_info)) {
$currencyCode = str_replace("CNY", "RMB", trim(mb_strtoupper($parent_note->IPL_currencyCode)));
$currencyCode = mb_strtoupper(trim($currencyCode));
$ssje = $this->IPayLinks_model->get_ssje($item->IPL_orderAmount, $currencyCode, '15018');
$ssje = $old_ssje===NULL ? $ssje : $old_ssje;
//更新还没有填的客邮和交易号de收款记录商务订单
if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) {
$ht_memo = '(自动录入)退款号:' . $item->IPL_dealId . "\n. ";
$ht_memo .= '原收款号:' . $parent_dealId;
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
//CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断
if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP' && strstr($advisor_info->COLI_WebCode, "-") != '-biz') {//只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单
$this->IPayLinks_model->add_account_info_forAPP(
$GAI_COLI_SN,
$advisor_info->COLI_ID,
$item->IPL_orderAmount,
$item->IPL_completeTime,
$currencyCode,
$ssje,
$item->IPL_completeTime,
$item->IPL_completeTime,
$item->IPL_acquiringTime,
$parent_note->IPL_payerName,
$parent_note->IPL_payerEmail,
$item->IPL_dealId,
$ht_memo);
$this->IPayLinks_model->insert_biz_order_log($GAI_COLI_SN, 'Refunded');
} else {
if (false == $this->IPayLinks_model->if_biz_gai_exists($item->IPL_dealId) ) {
$this->IPayLinks_model->insert_biz_order_log($GAI_COLI_SN, 'Refunded');
}
$this->IPayLinks_model->add_account_info(
$GAI_COLI_SN,
$advisor_info->COLI_ID,
$item->IPL_orderAmount,
$item->IPL_completeTime,
$currencyCode,
$ssje,
$item->IPL_completeTime,
$item->IPL_completeTime,
$item->IPL_acquiringTime,
$parent_note->IPL_payerName,
$parent_note->IPL_payerEmail,
$item->IPL_dealId,
$ht_memo);
}
}
//更新还没有填的客邮和交易号的收款记录(传统订单)
elseif (isset($advisor_info->order_type) && $advisor_info->order_type == 1) {
$ht_memo = '(自动)退款号:' . $item->IPL_dealId . "\n. ";
$ht_memo .= '原交易号:' . $parent_dealId;
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
$gai_sn = $this->IPayLinks_model->add_tour_account_info(
$GAI_COLI_SN,
$item->IPL_orderAmount,
$item->IPL_completeTime,
$currencyCode,
$ssje,
$item->IPL_completeTime,
$item->IPL_completeTime,
$item->IPL_acquiringTime,
$parent_note->IPL_payerName,
$parent_note->IPL_payerEmail,
$item->IPL_dealId,
$ht_memo);
//添加汉特的订单提醒
$this->IPayLinks_model->update_coli_introduction($GAI_COLI_SN, '已退款 ' . mb_strtoupper($currencyCode) . $item->IPL_orderAmount);
}
}
$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->IPL_dealId, 'sendfail');
return false;
}
//添加邮件发送记录
// if (true) { // test
if ($item->IPL_sent !== 'send' && substr($item->IPL_sent, 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->IPayLinks_model->get_advisor_detail($advisor_info->COLI_SN, $advisor_info->OPI_SN, $web_lgc);
$item->advisor_detail = $advisor_detail;
//给外联发送通知邮件
$fromName = !empty($parent_note->IPL_payerName) ? $parent_note->IPL_payerName : '';
$fromEmail = !empty($parent_note->IPL_payerEmail) ? $parent_note->IPL_payerEmail : '';
$toName = !empty($opi_firstname) ? $opi_firstname : '';
$toEmail = !empty($opi_email) ? $opi_email : '';
$subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->IPL_orderAmount . $currencyCode . ' / ' . $fromName;
$body = $this->load->view('receipt_mail', $item, true);
$M_RelatedInfo = $item->IPL_sn;
$M_AddTime = $item->IPL_completeTime;
$M_State = 0;
$this->IPayLinks_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'iPayLinks note');
// 通知客人, 客人邮箱
$customer_detail = $this->IPayLinks_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 = $currencyCode . " " . str_replace('-', '', $item->IPL_orderAmount) . " Refunded to your account, booking number " . $item->IPL_orderId;
// 修改一些字段名, 为了和Alipay等用同一个邮件模板
$item->payer = $customer_detail->fullname;
$item->payer_email = $customer_detail->email;
$item->total_amount = $item->IPL_orderAmount;
$item->payment_date = $item->IPL_completeTime;
$item->payment_status = "Refunfed";
$item->currency = $currencyCode;
$item->invoice = $item->IPL_orderId;
$c_body = $this->load->view('refund_buyer', $item, true);
$c_M_RelatedInfo = $item->IPL_sn;
$c_M_AddTime = $item->IPL_completeTime;
$c_M_State = 0;
$this->IPayLinks_model->save_automail(
$c_fromName,
$c_fromEmail,
$c_toName,
$c_toEmail,
$c_subject,
$c_body,
$c_M_RelatedInfo,
$c_M_State,
$c_M_AddTime,
'iPayLinks refund receipt');
$this->Note_model->update_send($item->IPL_dealId, 'send-customer');
}
//添加邮件发送记录 end
// TODO 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录
return ;
}
//解析出订单号 //解析出订单号
public function analysis_orderid($note_invoice_string) { public function analysis_orderid($note_invoice_string) {
$data = array(); $data = array();
@ -990,6 +1183,12 @@ class IPayLinksService extends CI_Controller
$data['note'] = $this->Note_model->note($pn_txn_id, $pn_id); $data['note'] = $this->Note_model->note($pn_txn_id, $pn_id);
$orderid_info = $this->analysis_orderid($data['note']->IPL_orderId); $orderid_info = $this->analysis_orderid($data['note']->IPL_orderId);
if (empty($orderid_info) && $data['note']->IPL_payType == 'refund'
&& true === $this->IPayLinks_model->if_APP_order($data['note']->IPL_orderId)
) {
// APP 组的退款订单是没有后缀的
$orderid_info = $this->analysis_orderid($data['note']->IPL_orderId . '_B');
}
if (!empty($orderid_info)) { if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info); $orderid_info = json_decode($orderid_info);
if ($orderid_info->ordertype === 'T') { if ($orderid_info->ordertype === 'T') {
@ -1014,7 +1213,7 @@ class IPayLinksService extends CI_Controller
$advisor_info = $this->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); $advisor_info = $this->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
if (!empty($advisor_info)) { if (!empty($advisor_info)) {
$this->Note_model->set_invoice($pn_txn_id, $neworder); $this->Note_model->set_invoice($pn_txn_id, $neworder);
$this->batch_send_note($pn_txn_id, $old_ssje); $this->batch_send_note($pn_txn_id, $old_ssje, $pn_id);
echo json_encode('修改成功!'); echo json_encode('修改成功!');
return true; return true;
} }

@ -18,7 +18,7 @@ class IPayLinks_model extends CI_Model {
$fieldsql = $orderinfo == false ? '' : " ,* "; $fieldsql = $orderinfo == false ? '' : " ,* ";
//先查商务订单B,APP订单A、再查传统订单T //先查商务订单B,APP订单A、再查传统订单T
if ($ordertype == 'B' || $ordertype == 'A') { if ($ordertype == 'B' || $ordertype == 'A') {
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode, COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode, COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_ID =?"; where COLI_ID =?";
$query = $this->HT->query($sql, array($COLI_ID)); $query = $this->HT->query($sql, array($COLI_ID));
@ -26,7 +26,7 @@ class IPayLinks_model extends CI_Model {
} }
//后查传统订单的原因是因为传统订单的订单号去掉外联名字首字母后可能会和商务订单的重合。 //后查传统订单的原因是因为传统订单的订单号去掉外联名字首字母后可能会和商务订单的重合。
if (empty($result) && ($ordertype == 'T')) { if (empty($result) && ($ordertype == 'T')) {
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_ID like '%$COLI_ID'"; where COLI_ID like '%$COLI_ID'";
$query = $this->HT->query($sql); $query = $this->HT->query($sql);
@ -36,7 +36,7 @@ class IPayLinks_model extends CI_Model {
//查传统订单add_code网前实时支付会先生成一个临时订单号存在add_code里如订单45103248 //查传统订单add_code网前实时支付会先生成一个临时订单号存在add_code里如订单45103248
if (empty($result) && ($ordertype == 'M')) { if (empty($result) && ($ordertype == 'M')) {
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_AddCode =? "; where COLI_AddCode =? ";
$query = $this->HT->query($sql, array($COLI_ID)); $query = $this->HT->query($sql, array($COLI_ID));
@ -44,7 +44,7 @@ class IPayLinks_model extends CI_Model {
} }
if (empty($result) && ($ordertype == 'M')) { if (empty($result) && ($ordertype == 'M')) {
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where where
EXISTS ( EXISTS (
@ -60,7 +60,7 @@ class IPayLinks_model extends CI_Model {
//订单号查询不到尝试使用团号查询 //订单号查询不到尝试使用团号查询
if (empty($result) && $ordertype == 'B') { if (empty($result) && $ordertype == 'B') {
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_GroupCode like '%-$COLI_ID%'"; where COLI_GroupCode like '%-$COLI_ID%'";
$query = $this->HT->query($sql); $query = $this->HT->query($sql);
@ -174,7 +174,7 @@ class IPayLinks_model extends CI_Model {
,GAI_Memo ,GAI_Memo
,GAI_State ,GAI_State
,DeleteFlag ,DeleteFlag
) VALUES (?,?,15018,?,?,?,?,?,?,?,?,?,?,?,0,0)"; ) VALUES (?,?,15018,?,?,?,?,?,?,?,N?,N?,?,?,0,0)";
$query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo)); $query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
$insertid = $this->HT->last_id('BIZ_GroupAccountInfo'); $insertid = $this->HT->last_id('BIZ_GroupAccountInfo');
return $query; return $query;
@ -207,7 +207,7 @@ class IPayLinks_model extends CI_Model {
,GAI_Memo ,GAI_Memo
,GAI_State ,GAI_State
,DeleteFlag ,DeleteFlag
) VALUES (?,?,15018,?,?,?,?,?,?,?,?,?,?,?,0,0)"; ) VALUES (?,?,15018,?,?,?,?,?,?,?,N?,N?,?,?,0,0)";
$query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo)); $query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
$insertid = $this->HT->last_id('BIZ_GroupAccountInfo'); $insertid = $this->HT->last_id('BIZ_GroupAccountInfo');
return $query; return $query;
@ -405,4 +405,58 @@ class IPayLinks_model extends CI_Model {
); );
return $this->HT->insert("BIZ_OrderOperationLog", $db_column); return $this->HT->insert("BIZ_OrderOperationLog", $db_column);
} }
public function get_advisor_detail($COLI_SN, $OPI_SN, $lgc=1)
{
$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)
{
if ($ordertype === 'T') {
$sql = "SELECT mei.MEI_FirstName+' '+isnull(mei.MEI_MiddleName,'')+' '+isnull(mei.MEI_LastName,'') fullname,
mei.MEI_MailList email
FROM MEmberInfo mei
INNER JOIN CUstomerList cul on mei.MEI_SN=cul.CUL_CUI_SN and cul.CUL_IsLinkMan=1
WHERE CUL_COLI_SN=? ";
return $this->HT->query($sql, $COLI_SN)->row();
} else {
$sql = "SELECT GUT_FirstName+' '+GUT_LastName fullname,GUT_Email email from BIZ_GUEST g
INNER JOIN BIZ_ConfirmLineInfo coli on coli.COLI_GUT_SN=g.GUT_SN
WHERE COLI_SN=? ";
return $this->HT->query($sql, $COLI_SN)->row();
}
}
public function if_APP_order($order_id)
{
$sql = "SELECT top 1 1
from BIZ_ConfirmLineInfo coli
where COLI_ID=?
and exists (
select 1 from OperatorInfo where OPI_SN=COLI_OPI_ID and OPI_DEI_SN=16
)";
return $this->HT->query($sql, array($order_id))->num_rows() > 0;
}
} }

@ -1 +1 @@
<html> <head><meta http-equiv=Content-Type content="text/html; charset=utf-8"></head> <body style="font-size: 12px;font-family: arial,helvetica,sans-serif;margin-top:0;margin-bottom:0;"> <div class=ppmail> <table align=center border=0 cellpadding=0 cellspacing=0 width=100%> <tbody> <tr valign=top> <td width=100%> <table align=center border=0 cellpadding=0 cellspacing=0 style="color:#333333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;" width=100%> <tbody> <tr valign=top> <td> <img src=https://data.chinahighlights.com/pic/alipay_logo.png border=0 alt="PayPal logo"> </td> <td valign=middle align=right> <?php echo $ALI_completeTime;?> <br>Transaction ID:<a target=new href=#> <?php echo $ALI_dealId;?> </a> </td> </tr> </tbody> </table> <div style="margin-top: 10px;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"> <span style="color:#333333 !important;font-weight:bold;font-family: arial,helvetica,sans-serif;">Hello Guilin China International Travel Service Co.,Ltd,</span> <br> <span style=font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;>You received a payment of <?php echo $ALI_orderAmount;?> <?php echo $ALI_currencyCode;?> </span> <br> <table cellpadding=5 style="color:#333333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"> <tbody> <tr> <td valign=top>Thanks for using iPayLinks.You can now ship any items.To see all the transaction details,log in to your iPayLinks account.<br>It may take a few moments for this transaction to appear in your account.<br> <span style=font-weight:bold;color:#333333;>Seller Protection-</span> <span style="color: #4c8f3a;"> </span> </td> <td> </td> </tr> </tbody> </table> <div style="margin-top:0px;border-bottom:1px solid #aaaaaa;"> </div> <table border=0 cellpadding=0 cellspacing=0 style="color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px; margin-bottom:5px;" width=98% align=left> <tbody> <tr> <td style=padding-top:5px; valign=top width=50% align=left> <span style=color:#333333;font-weight:bold;>Buyer</span> <br> <?php echo $ALI_payerName;?> <br> <?php echo $ALI_payerEmail;?> <br> </td> <td style=padding-top:5px; valign=top> </td> </tr> </tbody> </table> <table align=center border=0 cellpadding=0 cellspacing=0 style="clear:both;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;margin-top:5px;" width=100%> <tbody> <tr> <td style="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;" width=330 align=left>Description</td> <td style="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;" width=75 align=right>&nbsp;</td> <td style="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;" width=75 align=right>&nbsp;</td> <td style="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;" width=80 align=right>Amount</td> </tr> <tr> <td style=padding:10px; width=330 align=left> <?php echo $ALI_orderId;?> <br> </td> <td style=padding:10px; width=75 align=right> </td> <td style=padding:10px; width=75 align=right> </td> <td style=padding:10px; width=80 align=right> <?php echo $ALI_orderAmount;?> <?php echo $ALI_currencyCode;?> </td> </tr> </tbody> </table> </tr> </tbody> </table> </div> </body> </html> <html> <head><meta http-equiv=Content-Type content="text/html; charset=utf-8"></head> <body style="font-size: 12px;font-family: arial,helvetica,sans-serif;margin-top:0;margin-bottom:0;"> <div class=ppmail> <table align=center border=0 cellpadding=0 cellspacing=0 width=100%> <tbody> <tr valign=top> <td width=100%> <table align=center border=0 cellpadding=0 cellspacing=0 style="color:#333333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;" width=100%> <tbody> <tr valign=top> <td> <img src=https://data.chinahighlights.com/pic/alipay_logo.png border=0 alt="PayPal logo"> </td> <td valign=middle align=right> <?php echo $ALI_completeTime;?> <br>Transaction ID:<a target=new href=#> <?php echo $ALI_dealId;?> </a> </td> </tr> </tbody> </table> <div style="margin-top: 10px;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"> <span style="color:#333333 !important;font-weight:bold;font-family: arial,helvetica,sans-serif;">Hello Guilin China International Travel Service Co.,Ltd,</span> <br> <span style=font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;>You received a payment of <?php echo $ALI_orderAmount;?> <?php echo $ALI_currencyCode;?> </span> <br> <table cellpadding=5 style="color:#333333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"> <tbody> <tr> <td valign=top>Thanks for using Alipay.You can now ship any items.To see all the transaction details,log in to your Alipay account.<br>It may take a few moments for this transaction to appear in your account.<br> <span style=font-weight:bold;color:#333333;>Seller Protection-</span> <span style="color: #4c8f3a;"> </span> </td> <td> </td> </tr> </tbody> </table> <div style="margin-top:0px;border-bottom:1px solid #aaaaaa;"> </div> <table border=0 cellpadding=0 cellspacing=0 style="color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px; margin-bottom:5px;" width=98% align=left> <tbody> <tr> <td style=padding-top:5px; valign=top width=50% align=left> <span style=color:#333333;font-weight:bold;>Buyer</span> <br> <?php echo $ALI_payerName;?> <br> <?php echo $ALI_payerEmail;?> <br> </td> <td style=padding-top:5px; valign=top> </td> </tr> </tbody> </table> <table align=center border=0 cellpadding=0 cellspacing=0 style="clear:both;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;margin-top:5px;" width=100%> <tbody> <tr> <td style="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;" width=330 align=left>Description</td> <td style="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;" width=75 align=right>&nbsp;</td> <td style="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;" width=75 align=right>&nbsp;</td> <td style="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;" width=80 align=right>Amount</td> </tr> <tr> <td style=padding:10px; width=330 align=left> <?php echo $ALI_orderId;?> <br> </td> <td style=padding:10px; width=75 align=right> </td> <td style=padding:10px; width=75 align=right> </td> <td style=padding:10px; width=80 align=right> <?php echo $ALI_orderAmount;?> <?php echo $ALI_currencyCode;?> </td> </tr> </tbody> </table> </tr> </tbody> </table> </div> </body> </html>

@ -75,7 +75,7 @@
<body> <body>
<div id="wrapper" class="chkVisible print-none"> <div id="wrapper" class="chkVisible print-none">
<div class="navbar-header" style="float:none;border-bottom: 1px solid #ccc;"> <div class="navbar-header" style="float:none;border-bottom: 1px solid #ccc;">
<a class="navbar-brand text-muted" style="height: 52px;padding-top: 7px;padding-left: 30px;" href="http://www.mycht.cn/webht.php/index/index"> <a class="navbar-brand text-muted" style="height: 52px;padding-top: 7px;padding-left: 30px;" href="/webht.php/index/index">
<img width="150" style="height:40px;" src="/css/nav/img/6000.png"> <img width="150" style="height:40px;" src="/css/nav/img/6000.png">
</a> </a>
<h1>iPayLinks Notes</h1> <h1>iPayLinks Notes</h1>
@ -122,7 +122,7 @@
<!-- left --> <!-- left -->
<div class="col-md-4 col-xs-24 print-none"> <div class="col-md-4 col-xs-24 print-none">
<div class="row"> <div class="row">
<form method="post" id="search_list" action="http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/note_list/"> <form method="post" id="search_list" action="/webht.php/apps/pay/ipaylinksservice/note_list/">
<div class="input-group"> <div class="input-group">
<input type="text" name="keywords" value="<?php echo isset($search_key) ? $search_key : ''; ?>" class="form-control" placeholder="订单号" style="height: 33px;-webkit-box-shadow: inset 0 0px 0px rgba(0,0,0,0.075);box-shadow: inset 0 0px 0px rgba(0,0,0,0.075);border-bottom:1px solid #ddd;"> <input type="text" name="keywords" value="<?php echo isset($search_key) ? $search_key : ''; ?>" class="form-control" placeholder="订单号" style="height: 33px;-webkit-box-shadow: inset 0 0px 0px rgba(0,0,0,0.075);box-shadow: inset 0 0px 0px rgba(0,0,0,0.075);border-bottom:1px solid #ddd;">
<span class="input-group-addon search-btn" onclick="$('#search_list').submit();"></span> <span class="input-group-addon search-btn" onclick="$('#search_list').submit();"></span>
@ -132,11 +132,11 @@
</div> </div>
<p class="btn-lg"></p> <p class="btn-lg"></p>
<ul class="list-unstyled hidden-xs links"> <ul class="list-unstyled hidden-xs links">
<li><a class="text-primary" href="http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/note_list">&gt;全部收款邮件</a></li> <li><a class="text-primary" href="/webht.php/apps/pay/ipaylinksservice/note_list">&gt;全部收款邮件</a></li>
<li class="btn-sm"></li> <li class="btn-sm"></li>
<li><a class="text-primary" href="http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/note_faillist" >&gt;错误通知列表</a></li> <li><a class="text-primary" href="/webht.php/apps/pay/ipaylinksservice/note_faillist" >&gt;错误通知列表</a></li>
<li class="btn-sm"></li> <li class="btn-sm"></li>
<li><a class="text-primary" href="http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/batch_send_note" target="_blank">&gt;手动处理通知</a></li> <li><a class="text-primary" href="/webht.php/apps/pay/ipaylinksservice/batch_send_note" target="_blank">&gt;手动处理通知</a></li>
<li class="btn-sm"></li> <li class="btn-sm"></li>
<li><a class="text-primary" href="http://share.chtcdn.com/info.php/sendmail/send_mail" target="_blank">&gt;发送邮件</a></li> <li><a class="text-primary" href="http://share.chtcdn.com/info.php/sendmail/send_mail" target="_blank">&gt;发送邮件</a></li>
<li class="btn-lg"></li> <li class="btn-lg"></li>
@ -171,7 +171,7 @@
<li class="col-sm-1 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"><?php echo ($key + 1); ?></li> <li class="col-sm-1 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"><?php echo ($key + 1); ?></li>
<li class="col-sm-5 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"> <li class="col-sm-5 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;">
<?php if ($item->IPL_dealId) { ?> <?php if ($item->IPL_dealId) { ?>
<a class="seen" target="_blank" href="http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/receipt/<?php echo $item->IPL_dealId; ?>"> <a class="seen" target="_blank" href="/webht.php/apps/pay/ipaylinksservice/receipt/<?php echo $item->IPL_dealId; ?>">
<?php } else {?> <?php } else {?>
<a class="seen" target="_blank" href="#"> <a class="seen" target="_blank" href="#">
<?php } ?> <?php } ?>
@ -194,8 +194,8 @@
<?php <?php
$show_send = ''; $show_send = '';
$class_css = ''; $class_css = '';
if ($item->IPL_sent == 'send') { if ($item->IPL_sent == 'send' || substr($item->IPL_sent, 0, 5) == 'send-') {
$show_send = $item->IPL_sent; $show_send = 'send';
} else if ($item->IPL_sent == 'closeRecord') { } else if ($item->IPL_sent == 'closeRecord') {
$show_send = "已忽略"; $show_send = "已忽略";
} else if (strcmp(trim($item->IPL_stateCode), "2") && $item->IPL_stateCode != NULL) { } else if (strcmp(trim($item->IPL_stateCode), "2") && $item->IPL_stateCode != NULL) {
@ -297,7 +297,7 @@
defaultDate: '<?php echo $date; ?>', defaultDate: '<?php echo $date; ?>',
dateFormat: 'yy-mm-dd', dateFormat: 'yy-mm-dd',
onSelect: function(dateText) { onSelect: function(dateText) {
window.location.href = 'http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/note_list?date=' + dateText; window.location.href = '/webht.php/apps/pay/ipaylinksservice/note_list?date=' + dateText;
} }
}); });
$(".ui-datepicker").css('width', '15.7em'); $(".ui-datepicker").css('width', '15.7em');
@ -356,7 +356,7 @@
$.ajax({ $.ajax({
type: "get", type: "get",
dataType: "json", dataType: "json",
url: 'http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/closeGai/' + pn_txn_id, url: '/webht.php/apps/pay/ipaylinksservice/closeGai/' + pn_txn_id,
success: function(data, textStatus) { success: function(data, textStatus) {
alert(data); alert(data);
}, },
@ -415,7 +415,7 @@
$.ajax({ $.ajax({
type: "get", type: "get",
dataType: "json", dataType: "json",
url: 'http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/close_note/' + pn_txn_id, url: '/webht.php/apps/pay/ipaylinksservice/close_note/' + pn_txn_id,
success: function(data, textStatus) { success: function(data, textStatus) {
alert(data); alert(data);
}, },

@ -1,4 +1,4 @@
<form action="http://www.mycht.cn/webht.php/apps/pay/iPayLinksService/note_modal_save" method="post" id="form_modal_orderid" name="form_modal_orderid"> <form action="/webht.php/apps/pay/iPayLinksService/note_modal_save" method="post" id="form_modal_orderid" name="form_modal_orderid">
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>交易号</dt> <dt>交易号</dt>

@ -0,0 +1,10 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=http://www.w3.org/1999/xhtml> <head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><title>Your Submission Was Successful! - China Highlights</title><style type=text/css>* { margin:0; font-family: Verdana, Arial, Helvetica, sans-serif; }body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size:13px; color:#545454; right: auto; }img, ul, ul li { padding:0; margin:0; border:0; }#warp { border-top:8px solid #a31022!important; }#logo { border: none!important}#logo, #surveyContent { width:210mm; margin:5px auto; padding:5px; }h1 { margin:15px 0 10px 0; font-size:24px; border-bottom:1px solid #d9d9d9; color:#545454; }h2 { margin:15px 0 10px 0; font-size:20px; color:#545454; }.tableSurvey table td { padding:5px; }.tableSurvey table td strong { margin-top:8px; }.tableSurvey1 { border:1px solid #e1e1e1; }.tableSurvey1 th { border:1px solid #fff; height:30px; padding-right:10px; text-align:right; background:#f1f1f1; }.tableSurvey1 td { border:1px solid #f9f9f9; padding:5px; text-align:center; width:80px; }.tableSurvey2 { border:1px solid #e1e1e1; }.tableSurvey2 th { border:1px solid #fff; padding:5px 10px; text-align:right; background:#f1f1f1; font-weight:normal; }.tableSurvey2 td { border:1px solid #f9f9f9; padding:5px; text-align:center; width:80px; }.blue{ color:#0070C0}.text-bold {font-weight: bold;}.text-right{text-align: right;}.title-bold{font-weight: bold;background-color: #ddd;padding: 3px 0;}</style></head> <body> <div id=warp> <div id=surveyContent> <?php $c_gross = str_replace("-", "", $total_amount); ?> <p>Dear <?php echo $payer ?>,</p> <br> <p>China Highlights has refunded to your account today - <?php echo $c_gross ?><?php echo $currency ?>. The transaction to appear on your account may take up to 2-weeks.</p> <br> <p>Please find below details of your refund transaction:</p> <br> <p class=title-bold>Transaction details</p> <p><?php echo $payment_date ?></p> <p>Payment status: <?php echo $payment_status ?></p> <br> <p class=title-bold>Payment details</p> <p>Gross amount</p> <p class=text-right><?php echo $total_amount ?> <?php echo $currency ?></p> <br> <p class=title-bold>Invoice ID</p> <p><?php echo $invoice ?></p> <br> <p class=title-bold>Contact information</p> <p><?php echo $payer ?></p> <p><?php echo $payer_email ?></p> <br> <br> <pre style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size:13px;">
Best Regards!
<?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> </div> </body> </html>

@ -747,10 +747,8 @@ class Index extends CI_Controller {
} }
//退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理 //退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理
if ($item->pn_payment_status == 'Refunded') { if ($item->pn_payment_status == 'Refunded') {
$this->send_refund($item, $handpick, $old_ssje); $this->Note_model->update_send($item->pn_txn_id, 'send');
continue; continue;
// $this->Note_model->update_send($item->pn_txn_id, 'send');
// continue;
} }
//只处理完成状态,其他状态由陆燕处理 //只处理完成状态,其他状态由陆燕处理
@ -826,7 +824,7 @@ class Index extends CI_Controller {
$ht_memo = '交易号(自动录入):' . $item->pn_txn_id; $ht_memo = '交易号(自动录入):' . $item->pn_txn_id;
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; $GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
//CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断 //CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断
if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP') {//只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单 if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP' && strstr($advisor_info->COLI_WebCode, "-") !== '-biz') {//只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单
$this->Paypal_model->add_account_info_forAPP($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, '', $item->pn_payer_email, $item->pn_txn_id, $ht_memo); $this->Paypal_model->add_account_info_forAPP($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, '', $item->pn_payer_email, $item->pn_txn_id, $ht_memo);
if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) { //只修改APP组的订单状态并且订单进度是我的订单 if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) { //只修改APP组的订单状态并且订单进度是我的订单
$this->Paypal_model->update_biz_coli_state($GAI_COLI_SN, 8); //把订单状态改为已付款 $this->Paypal_model->update_biz_coli_state($GAI_COLI_SN, 8); //把订单状态改为已付款
@ -867,20 +865,22 @@ class Index extends CI_Controller {
//添加邮件发送记录 //添加邮件发送记录
//给外联发送通知邮件 if ($item->pn_send !== 'send') {
$fromName = !empty($item->pn_payer) ? $item->pn_payer : ''; //给外联发送通知邮件
$fromEmail = !empty($item->pn_payer_email) ? $item->pn_payer_email : ''; $fromName = !empty($item->pn_payer) ? $item->pn_payer : '';
$toName = !empty($opi_firstname) ? $opi_firstname : ''; $fromEmail = !empty($item->pn_payer_email) ? $item->pn_payer_email : '';
$toEmail = !empty($opi_email) ? $opi_email : ''; $toName = !empty($opi_firstname) ? $opi_firstname : '';
$subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->pn_mc_gross . $item->pn_mc_currency . ' / ' . $fromName; $toEmail = !empty($opi_email) ? $opi_email : '';
$body = $this->load->view('mail_templete', $item, true); //$item->pn_memo; $subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->pn_mc_gross . $item->pn_mc_currency . ' / ' . $fromName;
$M_RelatedInfo = $item->pn_sn; $body = $this->load->view('mail_templete', $item, true); //$item->pn_memo;
$M_AddTime = $item->pn_payment_date; $M_RelatedInfo = $item->pn_sn;
$M_State = 0; $M_AddTime = $item->pn_payment_date;
$this->Paypal_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'paypal note'); $M_State = 0;
//添加邮件发送记录 end $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'); $this->Note_model->update_send($item->pn_txn_id, 'send');
}
} }
//echo 'done!'; //echo 'done!';
} }
@ -897,6 +897,7 @@ class Index extends CI_Controller {
$parent_txn_id = json_decode($item->pn_memo)->parent_txn_id; $parent_txn_id = json_decode($item->pn_memo)->parent_txn_id;
$parent_note = $this->Note_model->note($parent_txn_id); $parent_note = $this->Note_model->note($parent_txn_id);
if (empty($parent_note)) { if (empty($parent_note)) {
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
return false; return false;
} }
//订单号 //订单号
@ -908,10 +909,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;
} }
//根据订单号查找外联信息 //根据订单号查找外联信息
@ -937,7 +937,7 @@ class Index extends CI_Controller {
$ht_memo .= '原收款号:' . $parent_txn_id; $ht_memo .= '原收款号:' . $parent_txn_id;
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0; $GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
//CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断 //CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断
if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP') {//只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单 if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP' && strstr($advisor_info->COLI_WebCode, "-") != '-biz') {//只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单
$this->Paypal_model->add_account_info_forAPP($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payer, $item->pn_payer_email, $item->pn_txn_id, $ht_memo); $this->Paypal_model->add_account_info_forAPP($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payer, $item->pn_payer_email, $item->pn_txn_id, $ht_memo);
$this->Paypal_model->insert_biz_order_log($GAI_COLI_SN, 'Refunded'); $this->Paypal_model->insert_biz_order_log($GAI_COLI_SN, 'Refunded');
} else { } else {
@ -947,7 +947,7 @@ class Index extends CI_Controller {
$this->Paypal_model->add_account_info($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payer, $item->pn_payer_email, $item->pn_txn_id, $ht_memo); $this->Paypal_model->add_account_info($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payer, $item->pn_payer_email, $item->pn_txn_id, $ht_memo);
} }
} }
//更新还没有填的客邮和交易号de收款记录(传统订单) //更新还没有填的客邮和交易号收款记录(传统订单)
elseif (isset($advisor_info->order_type) && $advisor_info->order_type == 1) { elseif (isset($advisor_info->order_type) && $advisor_info->order_type == 1) {
$ht_memo = '(自动)退款号:' . $item->pn_txn_id . "\n. "; $ht_memo = '(自动)退款号:' . $item->pn_txn_id . "\n. ";
$ht_memo .= '原交易号:' . $parent_txn_id; $ht_memo .= '原交易号:' . $parent_txn_id;
@ -967,32 +967,62 @@ class Index extends CI_Controller {
$this->Note_model->update_send($item->pn_txn_id, 'sendfail'); $this->Note_model->update_send($item->pn_txn_id, 'sendfail');
return false; return false;
} }
// TODO site_code
$site_info = $this->config->item('site');
$site_info = $site_info['cht'];
$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); //$item->pn_memo; 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'); }
// TODO 通知客人 $advisor_detail = $this->Paypal_model->get_advisor_detail($advisor_info->COLI_SN, $advisor_info->OPI_SN, $web_lgc);
$this->load->view('refund_buyer', $item); $item->advisor_detail = $advisor_detail;
// TODO 通知财务, 如果已做账
//添加邮件发送记录 end
//给外联发送通知邮件
$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 $this->Note_model->update_send($item->pn_txn_id, 'send'); return ;
} }
public function trippest_note($orderid_info, $paypal_msg) public function trippest_note($orderid_info, $paypal_msg)

@ -612,11 +612,46 @@ class Paypal_model extends CI_Model {
return $this->HT->query($sql)->row(); 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 $advisor_signature = $this->get_advisor_signature($COLI_SN);
FROM [Tourmanager].[dbo].[V_Operator_Info] if (empty($advisor_signature)) {
where OPI_SN=? and LGC_LGC=? "; $sql = "SELECT OPI_SN, '+86-'+OPI_MoveTelephone mobile,'+86-773-'+OPI_Telephone tel,OPI_Email email,OPI2_Name fullname,OPI2_FirstName,OPI2_LastName
return $this->HT->query($sql, array($OPI_SN, $lgc))->row(); 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)
{
if ($ordertype === 'T') {
$sql = "SELECT mei.MEI_FirstName+' '+isnull(mei.MEI_MiddleName,'')+' '+isnull(mei.MEI_LastName,'') fullname,
mei.MEI_MailList email
FROM MEmberInfo mei
INNER JOIN CUstomerList cul on mei.MEI_SN=cul.CUL_CUI_SN and cul.CUL_IsLinkMan=1
WHERE CUL_COLI_SN=? ";
return $this->HT->query($sql, $COLI_SN)->row();
} else {
$sql = "SELECT GUT_FirstName+' '+GUT_LastName fullname,GUT_Email email from BIZ_GUEST g
INNER JOIN BIZ_ConfirmLineInfo coli on coli.COLI_GUT_SN=g.GUT_SN
WHERE COLI_SN=? ";
return $this->HT->query($sql, $COLI_SN)->row();
}
} }
} }

@ -209,8 +209,8 @@ echo "<option value=\"$vf->TEL_SN@" . strstr($vf->TEL_transactionDate, " ", true
$show_send = ''; $show_send = '';
$class_css = ''; $class_css = '';
$show_record = '查看录入状态'; $show_record = '查看录入状态';
if ($item->pn_send == 'send') { if ($item->pn_send == 'send' || substr($item->pn_send, 0, 5) == "send-") {
$show_send = $item->pn_send; $show_send = 'send';
} elseif ($item->pn_send == 'closeRecord') { } elseif ($item->pn_send == 'closeRecord') {
$show_send = $show_record = '已忽略'; $show_send = $show_record = '已忽略';
} else if ($item->pn_payment_status == 'Completed') { } else if ($item->pn_payment_status == 'Completed') {

@ -1,46 +1,10 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=http://www.w3.org/1999/xhtml> <html xmlns=http://www.w3.org/1999/xhtml> <head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><title>Your Submission Was Successful! - China Highlights</title><style type=text/css>* { margin:0; font-family: Verdana, Arial, Helvetica, sans-serif; }body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size:13px; color:#545454; right: auto; }img, ul, ul li { padding:0; margin:0; border:0; }#warp { border-top:8px solid #a31022!important; }#logo { border: none!important}#logo, #surveyContent { width:210mm; margin:5px auto; padding:5px; }h1 { margin:15px 0 10px 0; font-size:24px; border-bottom:1px solid #d9d9d9; color:#545454; }h2 { margin:15px 0 10px 0; font-size:20px; color:#545454; }.tableSurvey table td { padding:5px; }.tableSurvey table td strong { margin-top:8px; }.tableSurvey1 { border:1px solid #e1e1e1; }.tableSurvey1 th { border:1px solid #fff; height:30px; padding-right:10px; text-align:right; background:#f1f1f1; }.tableSurvey1 td { border:1px solid #f9f9f9; padding:5px; text-align:center; width:80px; }.tableSurvey2 { border:1px solid #e1e1e1; }.tableSurvey2 th { border:1px solid #fff; padding:5px 10px; text-align:right; background:#f1f1f1; font-weight:normal; }.tableSurvey2 td { border:1px solid #f9f9f9; padding:5px; text-align:center; width:80px; }.blue{ color:#0070C0}.text-bold {font-weight: bold;}.text-right{text-align: right;}.title-bold{font-weight: bold;background-color: #ddd;padding: 3px 0;}</style></head> <body> <div id=warp> <div id=surveyContent> <?php $raw = json_decode($pn_memo); $c_gross = str_replace("-", "", $pn_mc_gross); ?> <p>Dear <?php echo $pn_payer ?>,</p> <br> <p>China Highlights has refunded to your account today - <?php echo $c_gross ?><?php echo $pn_mc_currency ?>. The transaction to appear on your account may take up to 2-weeks.</p> <br> <p>Please find below details of your refund transaction:</p> <br> <p class=title-bold>Transaction details</p> <p><?php echo $raw->payment_date ?></p> <p>Payment status: <?php echo $pn_payment_status ?></p> <br> <p class=title-bold>Payment details</p> <p>Gross amount</p> <p class=text-right><?php echo $pn_mc_gross ?> <?php echo $pn_mc_currency ?></p> <br> <p class=title-bold>Invoice ID</p> <p><?php echo $pn_invoice ?></p> <br> <p class=title-bold>Contact information</p> <p><?php echo $pn_payer ?></p> <p><?php echo $pn_payer_email ?></p> <br> <br> <pre style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size:13px;">
<head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><title>Your Submission Was Successful! - China Highlights</title><style type=text/css>* { margin:0; font-family: Verdana, Arial, Helvetica, sans-serif; }body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size:13px; color:#545454; right: auto; }img, ul, ul li { padding:0; margin:0; border:0; }#warp { border-top:8px solid #a31022!important; }#logo { border: none!important}#logo, #surveyContent { width:210mm; margin:5px auto; padding:5px; }h1 { margin:15px 0 10px 0; font-size:24px; border-bottom:1px solid #d9d9d9; color:#545454; }h2 { margin:15px 0 10px 0; font-size:20px; color:#545454; }.tableSurvey table td { padding:5px; }.tableSurvey table td strong { margin-top:8px; }.tableSurvey1 { border:1px solid #e1e1e1; }.tableSurvey1 th { border:1px solid #fff; height:30px; padding-right:10px; text-align:right; background:#f1f1f1; }.tableSurvey1 td { border:1px solid #f9f9f9; padding:5px; text-align:center; width:80px; }.tableSurvey2 { border:1px solid #e1e1e1; }.tableSurvey2 th { border:1px solid #fff; padding:5px 10px; text-align:right; background:#f1f1f1; font-weight:normal; }.tableSurvey2 td { border:1px solid #f9f9f9; padding:5px; text-align:center; width:80px; }.blue{ color:#0070C0}
.text-bold {font-weight: bold;}
.text-right{text-align: right;}
.title-bold{font-weight: bold;background-color: #ddd;padding: 3px 0;}
</style></head>
<body>
<div id=warp>
<div id=surveyContent>
<?php $raw = json_decode($pn_memo); $c_gross = str_replace("-", "", $pn_mc_gross); ?>
<p>Dear <?php echo $pn_payer ?>,</p>
<br>
<p>China Highlights has refunded to your account today - <?php echo $c_gross ?><?php echo $pn_mc_currency ?>. The transaction to appear on your account may take up to 2-weeks.</p>
<br>
<p>Please find below details of your refund transaction:</p>
<br>
<p class="title-bold">Transaction details</p>
<p ><?php echo $raw->payment_date ?></p>
<p >Payment status: <?php echo $pn_payment_status ?></p>
<br>
<p class="title-bold">Payment details</p>
<p>Gross amount</p>
<p class="text-right"><?php echo $pn_mc_gross ?> <?php echo $pn_mc_currency ?></p>
<br>
<p class="title-bold">Invoice ID</p>
<p><?php echo $pn_invoice ?></p>
<br>
<p class="title-bold">Contact information</p>
<p ><?php echo $pn_payer ?></p>
<p ><?php echo $pn_payer_email ?></p>
<br>
<br>
<pre style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size:13px;">
Best Regards! Best Regards!
<?php echo $advisor_detail->OPI2_Name ?>, Travel Advisor<br> <?php echo $advisor_detail->fullname ?>, Travel Advisor<br>
Tel: +86-773-<?php echo $advisor_detail->OPI_Telephone ?> Mobile: +86-<?php echo $advisor_detail->OPI_MoveTelephone ?><br> Tel: <?php echo $advisor_detail->tel ?> Mobile: <?php echo $advisor_detail->mobile ?><br>
E-mail: <?php echo $advisor_detail->OPI_Email ?><br> E-mail: <?php echo $advisor_detail->email ?><br>
<?php echo $site; ?><br> <?php if(isset($site)) { echo $site . '<br>'; } ?>
Address: Building 6, Chuangyi Business Park, 70 Qilidian Road, Guilin, Guangxi, 541004, China Address: Building 6, Chuangyi Business Park, 70 Qilidian Road, Guilin, Guangxi, 541004, China
</pre> </pre> </div> </div> </body> </html>
</div>
</div>
</body>
</html>

Loading…
Cancel
Save