From af70b69cbfed980b4f8eb4f6ba7df5ade4877f5e Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 22 Dec 2023 17:07:53 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20PayPal:=20=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=8C=89=E6=97=B6=E9=97=B4=20=E5=A4=84?= =?UTF-8?q?=E7=90=86,=20=E9=81=BF=E5=85=8D=E5=8D=A1=E4=BD=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webht/third_party/paypal/controllers/index.php | 4 +++- webht/third_party/paypal/models/note_model.php | 9 ++++++++- webht/third_party/paypal/views/note_list.php | 10 +++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index d60206bb..5ddc4bcf 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -602,7 +602,9 @@ class Index extends CI_Controller { $pn_payment_date = $this->input->post('payment_date'); $pn_payer = $this->input->post('first_name') . ' ' . $this->input->post('last_name'); $pn_payer_email = $this->input->post('payer_email'); - $pn_memo = json_encode($_POST); + $post_data = $_POST; + $post_data['ipn_time'] = date('Y-m-d H:i:s'); + $pn_memo = json_encode($post_data); if (!empty($pn_txn_id)) { //把PDT时间转成GMT时间 $pn_payment_date = gmdate('Y-m-d H:i:s', strtotime($pn_payment_date)); diff --git a/webht/third_party/paypal/models/note_model.php b/webht/third_party/paypal/models/note_model.php index 8ba5a906..adbd8a71 100644 --- a/webht/third_party/paypal/models/note_model.php +++ b/webht/third_party/paypal/models/note_model.php @@ -40,6 +40,9 @@ class Note_model extends CI_Model { $this->init(); $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); + $this->search = " AND pn_datetime < '$date' " ; //$this->orderby = ' ORDER BY pn.pn_sn ASC '; return $this->get_list(); } @@ -48,6 +51,9 @@ class Note_model extends CI_Model { $this->init(); $this->topnum = $topnum; $this->pn_send = " AND (pn_send='sendfail' OR pn_send='') "; + // 1小时前 + $date = date("Y-m-d H:i:s", time() - 3600); + $this->search = $topnum === 20 ? " AND pn_datetime < '$date' " : ''; //$this->orderby = ' ORDER BY pn.pn_sn ASC '; return $this->get_list(); } @@ -192,12 +198,13 @@ class Note_model extends CI_Model { $ele->fundsource = ''; } $ele->parent_txn_id = isset($raw->parent_txn_id) ? $raw->parent_txn_id : ''; + $ele->ipn_time = isset($raw->ipn_time)? $raw->ipn_time : $ele->pn_datetime; } public function update_send($pn_txn_id, $pn_send, $pn_sn=NULL) { $sql = " UPDATE paypal_note - SET pn_send = ? + SET pn_send = ?, pn_datetime=GETDATE() WHERE pn_txn_id = ? "; $sql .= ($pn_sn===NULL) ? "" : " and pn_sn=$pn_sn "; diff --git a/webht/third_party/paypal/views/note_list.php b/webht/third_party/paypal/views/note_list.php index ab02daf6..14a590af 100644 --- a/webht/third_party/paypal/views/note_list.php +++ b/webht/third_party/paypal/views/note_list.php @@ -202,11 +202,11 @@ @@ -216,7 +216,7 @@