From 56a546875f19fa2451843d53d8247eb5c3fb5a8e Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 6 Aug 2024 16:21:01 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20PayPal=E9=80=80=E6=AC=BE=E5=A4=84?= =?UTF-8?q?=E7=90=86:=20=E4=BB=8E=E6=94=B6=E6=AC=BE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=AE=A2=E5=8D=95=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webht/third_party/paypal/controllers/index.php | 13 +++++++++++++ webht/third_party/paypal/models/paypal_model.php | 13 ++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 627ac868..34b10ce0 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -1263,6 +1263,19 @@ class Index extends CI_Controller { //根据订单号查找外联信息, 从临时表 $advisor_info_from_tmp = $this->Paypal_model->get_order($orderid_info->orderid, false, 'M', $handpick); + + if (empty($advisor_info)) { + if ($orderid_info->ordertype === 'T') { + $parent_order_info = $this->Paypal_model->get_money_t($parent_txn_id); + } else { + $parent_order_info = $this->Paypal_model->get_money_B($parent_txn_id); + } + if ( ! empty($parent_order_info)) { + $advisor_info = $this->Paypal_model->get_order($parent_order_info[0]->COLI_ID, false, $orderid_info->ordertype, $handpick); + $orderid_info = $this->analysis_orderid("{$parent_order_info[0]->COLI_ID}_{$orderid_info->ordertype}"); + $orderid_info = json_decode($orderid_info); + } + } /** * 传统订单, 网站支付 * @author LYT diff --git a/webht/third_party/paypal/models/paypal_model.php b/webht/third_party/paypal/models/paypal_model.php index f2278b71..68672dce 100644 --- a/webht/third_party/paypal/models/paypal_model.php +++ b/webht/third_party/paypal/models/paypal_model.php @@ -33,7 +33,7 @@ class Paypal_model extends CI_Model { order by CHARINDEX('$COLI_ID', COLI_ID) "; $query = $this->HT->query($sql); $result = $query->result(); - if ($handpick === TRUE) { + if ($handpick === TRUE && count($result) > 0) { $result = array($result[0]); } } @@ -598,22 +598,25 @@ class Paypal_model extends CI_Model { } //根据交易号获取收款记录(传统订单) public function get_money_t($pn_invoice) { - $sql = "SELECT GroupAccountInfo.* - from GroupAccountInfo - where DeleteFlag=0 and GAI_AccreditNo=? + $sql = "SELECT cli.COLI_ID, gai.* + from GroupAccountInfo gai + LEFT JOIN ConfirmLineInfo AS cli ON cli.COLI_SN =GAI_COLI_SN + where gai.DeleteFlag=0 and gai.GAI_AccreditNo=? "; $query = $this->HT->query($sql, array($pn_invoice)); + // log_message('error','test: ' . __METHOD__ . ': ' . __LINE__ . PHP_EOL . var_export($this->HT->last_query(), 1)); $result = $query->result(); return $result; } //根据交易号获取收款记录(商务订单) public function get_money_b($pn_invoice, $find_memo = true) { $find_memo_sql = $find_memo === true ? " OR GAI_Memo='$pn_invoice' " : ""; - $sql = "SELECT BIZ_GroupAccountInfo.* + $sql = "SELECT GAI_COLI_ID AS COLI_ID, BIZ_GroupAccountInfo.* from BIZ_GroupAccountInfo where DeleteFlag=0 and ( GAI_AccreditNo=? $find_memo_sql ) "; $query = $this->HT->query($sql, array($pn_invoice)); + // log_message('error','test: ' . __METHOD__ . ': ' . __LINE__ . PHP_EOL . var_export($this->HT->last_query(), 1)); $result = $query->result(); return $result; }