From 03fbd1eb5dfad3673557d72d3609590aeb84dc13 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 28 Dec 2023 14:28:33 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20PayPal:=20=E6=94=AF=E6=8C=81=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=20=E9=80=80=E6=AC=BE=E7=9A=84=E5=8E=9F=E7=BA=AA?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webht/third_party/paypal/models/note_model.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webht/third_party/paypal/models/note_model.php b/webht/third_party/paypal/models/note_model.php index 19b6d014..4023d06e 100644 --- a/webht/third_party/paypal/models/note_model.php +++ b/webht/third_party/paypal/models/note_model.php @@ -41,7 +41,7 @@ class Note_model extends CI_Model { $this->topnum = $topnum; $this->pn_send = " AND (pn_send='sendfail' OR pn_send='') AND pn_payment_status='Completed' "; // 1小时前 - $date = date("Y-m-d H:i:s", time() - 3600); + $date = date("Y-m-d H:i:s", time() - 1800); $this->search = " AND pn_datetime < '$date' " ; //$this->orderby = ' ORDER BY pn.pn_sn ASC '; return $this->get_list(); @@ -97,7 +97,7 @@ class Note_model extends CI_Model { $search_sql = " AND (pn.pn_datetime BETWEEN '$date 00:00:00' AND '$date 23:59:59' OR isnull(pn_send,'') in ('sendfail','unsend','')) AND pn_memo NOT LIKE '{\"id\":\"WH-%' "; // {"id":"WH- $this->search = $search_sql; // $this->orderby=" ORDER BY CASE pn.pn_send WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.pn_sn DESC "; - $this->orderby=" ORDER BY CASE WHEN pn.pn_send='sendfail' AND pn.pn_payment_status='Completed' THEN 1 WHEN pn.pn_send = 'sendfail' THEN 2 ELSE 9 END ,pn.pn_sn DESC "; + $this->orderby=" ORDER BY CASE WHEN pn.pn_send='sendfail' AND pn.pn_payment_status='Completed' THEN 1 WHEN pn.pn_send = 'sendfail' THEN 2 ELSE 9 END, pn.pn_payment_date DESC ,pn.pn_sn DESC "; // WHEN pn.pn_send = 'sendfail' THEN 2 return $this->get_list(); @@ -124,7 +124,8 @@ class Note_model extends CI_Model { OR pn.pn_item_name like '%$search_key%' OR pn.pn_item_number like '%$search_key%' OR pn.pn_payer like '%$search_key%' - OR pn.pn_payer_email like '%$search_key%' )"; + OR pn.pn_payer_email like '%$search_key%' + OR SUBSTRING(pn_memo, CHARINDEX('parent_txn_id\"', pn_memo) + 16, 17) = '$search_key' ) "; } $this->search = $search_sql; return $this->get_list(); @@ -149,10 +150,10 @@ class Note_model extends CI_Model { public function get_list() { $this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT "; + // ,dbo.GetOrderCusCountry(pn_invoice) as payer_country $sql .= " pn.pn_sn ,pn.pn_txn_id - ,dbo.GetOrderCusCountry(pn_invoice) as payer_country ,replace(replace(pn.pn_invoice,char(13),' '),char(10),' ') pn_invoice ,pn.pn_custom ,pn.pn_mc_gross