From 463ba24da8a85c2e4ddf91895db326fdde419d83 Mon Sep 17 00:00:00 2001 From: lyt Date: Fri, 8 Nov 2019 14:17:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9F=A5=E5=88=B0=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=B7=E6=97=B6=E6=8C=89=E7=85=A7=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=9C=89=E6=95=88=E8=AE=A2=E5=8D=95=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/AlipayTradeService.php | 16 ++++++++-------- .../pay/controllers/PaymentService.php | 6 +++--- .../pay/controllers/iPayLinksService.php | 17 +++++++++-------- webht/third_party/pay/models/Alipay_model.php | 8 ++++---- .../third_party/pay/models/IPayLinks_model.php | 11 +++++------ .../pay/models/Online_payment_account_model.php | 6 +++--- .../third_party/paypal/models/paypal_model.php | 6 +++--- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/webht/third_party/pay/controllers/AlipayTradeService.php b/webht/third_party/pay/controllers/AlipayTradeService.php index 5df1530b..92ee309d 100644 --- a/webht/third_party/pay/controllers/AlipayTradeService.php +++ b/webht/third_party/pay/controllers/AlipayTradeService.php @@ -349,7 +349,7 @@ class AlipayTradeService extends CI_Controller if (empty($data['unsend_list'])) { $data['unsend_list'] = $this->Alipay_note_model->failnote(20); } - + $handpick = empty($pn_txn_id) ? false : true; $show_index = 0; foreach ($data['unsend_list'] as $item) { @@ -366,7 +366,7 @@ class AlipayTradeService extends CI_Controller //退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理 if ($item->ALI_payType == 'refund') { - $this->send_refund($item, $old_ssje); + $this->send_refund($item, $old_ssje, $handpick); // $this->Alipay_note_model->update_send($item->ALI_dealId, 'send'); continue; } @@ -388,7 +388,7 @@ class AlipayTradeService extends CI_Controller //根据订单号查找外联信息 $orderid_info = json_decode($orderid_info); - $advisor_info = $this->Alipay_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); + $advisor_info = $this->Alipay_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick); //查不到订单信息 if (empty($advisor_info)) { @@ -531,7 +531,7 @@ class AlipayTradeService extends CI_Controller * @date 2019-05-09 * * TODO 线下收款之后产生的退款没有通知 */ - public function send_refund($item, $old_ssje=null) + public function send_refund($item, $old_ssje=null, $handpick) { // raw $raw = json_decode($item->ALI_memo); @@ -554,7 +554,7 @@ class AlipayTradeService extends CI_Controller $orderid_info = analysis_orderid($parent_note->ALI_orderId); $orderid_info = json_decode($orderid_info); //根据订单号查找外联信息 - $advisor_info = $this->Alipay_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); + $advisor_info = $this->Alipay_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick); //查不到订单信息 if (empty($advisor_info)) { $this->Alipay_note_model->update_send($item->ALI_dealId, 'sendfail'); @@ -1097,7 +1097,7 @@ class AlipayTradeService extends CI_Controller $neworder_id = analysis_orderid($pn_invoice); $neworder_id = json_decode($neworder_id); if ( ! empty($neworder_id)) { - $data['order_info'] = $this->Alipay_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype); + $data['order_info'] = $this->Alipay_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype, true); } } $data["paytext"] = $this->payment_status(); @@ -1117,7 +1117,7 @@ class AlipayTradeService extends CI_Controller } if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); - $data['order_info'] = $this->Alipay_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype); + $data['order_info'] = $this->Alipay_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype, true); } $data["paytext"] = $this->payment_status(); echo json_encode($this->load->view('alipay_note_setting', $data, true)); @@ -1178,7 +1178,7 @@ class AlipayTradeService extends CI_Controller $orderid_info = analysis_orderid($pn_invoice); if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); - $advisor_info = $this->Alipay_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); + $advisor_info = $this->Alipay_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, true); if (!empty($advisor_info)) { $this->Alipay_note_model->set_invoice($pn_txn_id, $pn_invoice); $this->send_alipay($pn_txn_id, $old_ssje); diff --git a/webht/third_party/pay/controllers/PaymentService.php b/webht/third_party/pay/controllers/PaymentService.php index 674c8270..9d8c26e0 100644 --- a/webht/third_party/pay/controllers/PaymentService.php +++ b/webht/third_party/pay/controllers/PaymentService.php @@ -428,7 +428,7 @@ class PaymentService extends CI_Controller { $orderid_info = analysis_orderid($pn_invoice); if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); - $data['order_info'] = $this->account_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype); + $data['order_info'] = $this->account_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype, true); if ($orderid_info->ordertype === 'T') { $data['gai_info'] = $this->account_model->get_money_t($pn_txn_id); } elseif ($orderid_info->ordertype === 'B' || $orderid_info->ordertype === 'TP' @@ -443,7 +443,7 @@ class PaymentService extends CI_Controller { $neworder_id = analysis_orderid($neworder); $neworder_id = json_decode($neworder_id); if ( ! empty($neworder_id)) { - $data['order_info'] = $this->account_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype); + $data['order_info'] = $this->account_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype, true); } } echo json_encode($this->load->view('payment_gai_setting', $data, true)); @@ -483,7 +483,7 @@ class PaymentService extends CI_Controller { $orderid_info = analysis_orderid($neworder); if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); - $advisor_info = $this->account_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); + $advisor_info = $this->account_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, true); if (!empty($advisor_info)) { $this->note_model->set_invoice($data['note']->OPN_SN, $neworder); $this->send_notify($data['note']->OPN_SN, $old_ssje); diff --git a/webht/third_party/pay/controllers/iPayLinksService.php b/webht/third_party/pay/controllers/iPayLinksService.php index 2b903b2d..e75625dc 100644 --- a/webht/third_party/pay/controllers/iPayLinksService.php +++ b/webht/third_party/pay/controllers/iPayLinksService.php @@ -385,6 +385,7 @@ class IPayLinksService extends CI_Controller $data['unsend_list'] = $this->Note_model->failnote(20); } + $handpick = empty($pn_txn_id) ? false : true; $show_index = 0; foreach ($data['unsend_list'] as $item) { @@ -395,7 +396,7 @@ class IPayLinksService extends CI_Controller //退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理 if ($item->IPL_payType == 'refund') { - $this->send_refund($item, $old_ssje); + $this->send_refund($item, $old_ssje, $handpick); // $this->Note_model->update_send($item->IPL_dealId, 'send'); continue; } @@ -423,7 +424,7 @@ class IPayLinksService extends CI_Controller //根据订单号查找外联信息 $orderid_info = json_decode($orderid_info); - $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, $handpick); //查不到订单信息 if (empty($advisor_info)) { @@ -586,7 +587,7 @@ class IPayLinksService extends CI_Controller * @date 2019-05-08 * * TODO APP组的退款没有原始订单 */ - public function send_refund($item, $old_ssje=NULL) + public function send_refund($item, $old_ssje=NULL, $handpick) { if ($item->IPL_stateCode != 2) { return false; @@ -618,7 +619,7 @@ class IPayLinksService extends CI_Controller $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); + $advisor_info = $this->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick); //查不到订单信息 if (empty($advisor_info)) { $this->Note_model->update_send($item->IPL_dealId, 'sendfail'); @@ -1186,7 +1187,7 @@ class IPayLinksService extends CI_Controller $neworder_id = $this->analysis_orderid($neworder); $neworder_id = json_decode($neworder_id); if ( ! empty($neworder_id)) { - $data['order_info'] = $this->IPayLinks_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype); + $data['order_info'] = $this->IPayLinks_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype, true); } } echo json_encode($this->load->view('gai_setting', $data, true)); @@ -1229,7 +1230,7 @@ class IPayLinksService extends CI_Controller $orderid_info = $this->analysis_orderid($neworder); if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); - $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, true); if (!empty($advisor_info)) { $this->Note_model->set_invoice($pn_txn_id, $neworder); $this->batch_send_note($pn_txn_id, $old_ssje, $pn_id); @@ -1270,7 +1271,7 @@ class IPayLinksService extends CI_Controller } if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); - $data['order_info'] = $this->IPayLinks_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype); + $data['order_info'] = $this->IPayLinks_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype, true); } $data["paytext"] = $this->payment_status(); echo json_encode($this->load->view('note_setting', $data, true)); @@ -1293,7 +1294,7 @@ class IPayLinksService extends CI_Controller } if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); - $data['order_info'] = $this->IPayLinks_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype); + $data['order_info'] = $this->IPayLinks_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype, true); } $data["paytext"] = $this->payment_status(); echo json_encode($this->load->view('note_setting', $data, true)); diff --git a/webht/third_party/pay/models/Alipay_model.php b/webht/third_party/pay/models/Alipay_model.php index f441c038..e45844dc 100644 --- a/webht/third_party/pay/models/Alipay_model.php +++ b/webht/third_party/pay/models/Alipay_model.php @@ -13,14 +13,14 @@ class Alipay_model extends CI_Model { } //根据订单号获取外联邮箱 - public function get_order($COLI_ID, $orderinfo = false, $ordertype = 'N') { + public function get_order($COLI_ID, $orderinfo = false, $ordertype = 'N', $handpick=false) { $result = ''; $fieldsql = $orderinfo == false ? '' : " ,* "; //先查商务订单B,APP订单A、再查传统订单T if ($ordertype == 'B' || $ordertype == 'A') { $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,COLI_GRI_SN,OPI_Email,OPI_FirstName,OPI_SN,OPI_Name,COLI_WebCode,COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN - where COLI_ID =? "; // and COLI_State<>50 + where COLI_ID =? order by CHARINDEX('50',COLI_State) asc"; // and COLI_State<>50 $query = $this->HT->query($sql, array($COLI_ID)); $result = $query->result(); } @@ -62,7 +62,7 @@ class Alipay_model extends CI_Model { if (empty($result) && $ordertype == 'B') { $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,COLI_GRI_SN,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 - where COLI_GroupCode like '%-$COLI_ID%' and COLI_State<>50"; + where COLI_GroupCode like '%-$COLI_ID%' order by CHARINDEX('50',COLI_State) asc"; $query = $this->HT->query($sql); $result = $query->result(); } @@ -71,7 +71,7 @@ class Alipay_model extends CI_Model { if (!empty($result) && is_array($result) ) { //print_r($result[0]); //die(); - if (count($result) > 1) { + if (count($result) > 1 && $handpick===false) { $result = array(); } else { $result = $result[0]; diff --git a/webht/third_party/pay/models/IPayLinks_model.php b/webht/third_party/pay/models/IPayLinks_model.php index dfa93cc7..aafff2e1 100644 --- a/webht/third_party/pay/models/IPayLinks_model.php +++ b/webht/third_party/pay/models/IPayLinks_model.php @@ -13,14 +13,14 @@ class IPayLinks_model extends CI_Model { } //根据订单号获取外联邮箱 - public function get_order($COLI_ID, $orderinfo = false, $ordertype = 'N') { + public function get_order($COLI_ID, $orderinfo = false, $ordertype = 'N', $handpick=false) { $result = ''; $fieldsql = $orderinfo == false ? '' : " ,* "; //先查商务订单B,APP订单A、再查传统订单T if ($ordertype == 'B' || $ordertype == 'A') { $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,COLI_GRI_SN,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 - where COLI_ID =? ";// and COLI_State<>50 + where COLI_ID =? order by CHARINDEX('50',COLI_State) asc";// and COLI_State<>50 $query = $this->HT->query($sql, array($COLI_ID)); $result = $query->result(); } @@ -28,7 +28,7 @@ class IPayLinks_model extends CI_Model { if (empty($result) && ($ordertype == 'T')) { $sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,COLI_GRI_SN,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo 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); $result = $query->result(); } @@ -62,7 +62,7 @@ class IPayLinks_model extends CI_Model { if (empty($result) && $ordertype == 'B') { $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,COLI_GRI_SN,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 - where COLI_GroupCode like '%-$COLI_ID%' and COLI_State<>50"; + where COLI_GroupCode like '%-$COLI_ID%' order by CHARINDEX('50',COLI_State) asc"; $query = $this->HT->query($sql); $result = $query->result(); } @@ -71,13 +71,12 @@ class IPayLinks_model extends CI_Model { if (!empty($result) && is_array($result) ) { //print_r($result[0]); //die(); - if (count($result) > 1) { + if (count($result) > 1 && $handpick===false) { $result = array(); // 找到多条匹配的订单记录时,不处理 } else { $result = $result[0]; } } - return $result; } diff --git a/webht/third_party/pay/models/Online_payment_account_model.php b/webht/third_party/pay/models/Online_payment_account_model.php index 3b10cb1a..272f441a 100644 --- a/webht/third_party/pay/models/Online_payment_account_model.php +++ b/webht/third_party/pay/models/Online_payment_account_model.php @@ -32,7 +32,7 @@ class Online_payment_account_model extends CI_Model { if ($ordertype == 'B' || $ordertype == 'A' || $ordertype == 'TP') { $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 LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN - where COLI_ID =? "; // and COLI_State<>50 + where COLI_ID =? order by CHARINDEX('50',COLI_State) asc"; // and COLI_State<>50 $query = $this->HT->query($sql, array($COLI_ID)); $result = $query->result(); } @@ -78,7 +78,7 @@ class Online_payment_account_model extends CI_Model { 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 LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN - where COLI_GroupCode like '%-$COLI_ID%' and COLI_State<>50"; + where COLI_GroupCode like '%-$COLI_ID%' order by CHARINDEX('50',COLI_State) asc"; $query = $this->HT->query($sql); $result = $query->result(); } @@ -87,7 +87,7 @@ class Online_payment_account_model extends CI_Model { if (!empty($result) && is_array($result) ) { //print_r($result[0]); //die(); - if (count($result) > 1) { + if (count($result) > 1 && $handpick===false) { $result = array(); } else { $result = $result[0]; diff --git a/webht/third_party/paypal/models/paypal_model.php b/webht/third_party/paypal/models/paypal_model.php index 3da582c6..17f06f3b 100644 --- a/webht/third_party/paypal/models/paypal_model.php +++ b/webht/third_party/paypal/models/paypal_model.php @@ -21,7 +21,7 @@ class Paypal_model extends CI_Model { if ($ordertype == 'B' || $ordertype == 'A') { $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,COLI_GRI_SN,OPI_Email,OPI_FirstName,OPI_SN,OPI_Name,COLI_WebCode,COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN - where COLI_ID =? "; // and COLI_State<>50 + where COLI_ID =? order by CHARINDEX('50',COLI_State) asc"; // and COLI_State<>50 $query = $this->HT->query($sql, array($COLI_ID)); $result = $query->result(); } @@ -67,7 +67,7 @@ class Paypal_model extends CI_Model { if (empty($result) && $ordertype == 'B') { $sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,COLI_GRI_SN,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 - where COLI_GroupCode like '%-$COLI_ID%' and COLI_State<>50"; + where COLI_GroupCode like '%-$COLI_ID%' order by CHARINDEX('50',COLI_State) asc"; $query = $this->HT->query($sql); $result = $query->result(); } @@ -76,7 +76,7 @@ class Paypal_model extends CI_Model { if (!empty($result) && is_array($result) ) { //print_r($result[0]); //die(); - if (count($result) > 1) { + if (count($result) > 1 && $handpick===false) { $result = array(); } else { $result = $result[0];