From 36192408b1de63044a0190ae86b67bf7e4962818 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 14 Oct 2025 16:27:35 +0800 Subject: [PATCH] =?UTF-8?q?PayPal=20=E4=BB=98=E6=AC=BE=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E7=9A=84=E8=AE=A4=E8=AF=81=E7=8A=B6=E6=80=81,=20=E5=85=88?= =?UTF-8?q?=E4=BB=8Eapproved=E4=BA=8B=E4=BB=B6=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/PaymentService.php | 17 ++++++++++++++--- .../pay/models/Online_payment_note_model.php | 11 ++++++----- webht/third_party/pay/views/payment_list.php | 2 ++ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/webht/third_party/pay/controllers/PaymentService.php b/webht/third_party/pay/controllers/PaymentService.php index 7a5a7afe..69cad932 100644 --- a/webht/third_party/pay/controllers/PaymentService.php +++ b/webht/third_party/pay/controllers/PaymentService.php @@ -55,8 +55,13 @@ class PaymentService extends CI_Controller { $search_date = $this->note_model->search_date($data['date'], $method); $unsend = $this->note_model->unsend_note(false, $method); $sendfail = $this->note_model->sendfail_note(false, $method); + $pengding = []; + // $this->note_model->get_note_where([ + // 'OPN_transactionResult' => ['=', 'pending'], + // 'OPN_noticeSendStatus' => ['!=', 'closed'], + // ], 200); $closed = $this->note_model->closed_note($data['date'], 300, $method); - $data['notelist'] = array_merge(array_merge($unsend, $sendfail), array_merge($search_date, $closed)); + $data['notelist'] = array_merge(array_merge($unsend, $sendfail, $pengding), array_merge($search_date, $closed)); } array_walk($data["notelist"], 'PaymentService::set_brandname'); @@ -449,7 +454,11 @@ class PaymentService extends CI_Controller { // log_message('error','test: ' . __METHOD__ . ': ' . __LINE__ . ' ' . PHP_EOL . var_export($paypal_order, 1)); // log_message('error','test: ' . __METHOD__ . ': ' . __LINE__ . ' ' . PHP_EOL . var_export($paypal_account, 1)); // log_message('error','test: ' . __METHOD__ . ': ' . __LINE__ . ' ' . PHP_EOL . var_export($item->OPN_noticeType, 1)); - if (!empty($paypal_order) && !empty($paypal_account) && $item->OPN_noticeType == 'pay') { + if (!empty($paypal_order) && !empty($paypal_account) + && $item->OPN_noticeType == 'pay' + // && substr($item->OPN_noticeSendStatus, 0, 4) !== 'send' + && $item->OPN_noticeSendStatus == '' + ) { $payment_ret = $this->get_paypal_order($paypal_order, $paypal_account); if (!empty($payment_ret)) { $where_str = " OPN_SN=" . $item->OPN_SN; @@ -459,8 +468,9 @@ class PaymentService extends CI_Controller { 'OPN_payerLogId' => isset($payment_ret->payer->payer_id) ? $payment_ret->payer->payer_id : '', 'OPN_payerName' => isset($payment_ret->payer->fullname) ? $payment_ret->payer->fullname : '', 'OPN_payerEmail' => isset($payment_ret->payer->email_address) ? $payment_ret->payer->email_address : '', + 'OPN_payerStatus' => isset($payment_ret->payer->account_status) ? $payment_ret->payer->account_status : '', 'OPN_subject' => isset($payment_ret->item_number) && empty($item->subject) ? $payment_ret->item_number : $item->subject, - 'OPN_noticeSendStatus' => 'closed', // 先忽略 + 'OPN_noticeSendStatus' => $item->OPN_transactionResult!=='pending' ? 'closed' : 'sendfail', // 先忽略 ); $this->note_model->update_note($where_str, $update_note_column); return false; @@ -517,6 +527,7 @@ class PaymentService extends CI_Controller { $payer->fullname = $paypal_order_rows[0]->OPN_payerName; $payer->payer_id = $paypal_order_rows[0]->OPN_payerLogId; $payer->email_address = $paypal_order_rows[0]->OPN_payerEmail; + $payer->account_status = $paypal_order_rows[0]->OPN_payerStatus; } $ret = new stdClass(); diff --git a/webht/third_party/pay/models/Online_payment_note_model.php b/webht/third_party/pay/models/Online_payment_note_model.php index 8542d374..4bcd3a17 100644 --- a/webht/third_party/pay/models/Online_payment_note_model.php +++ b/webht/third_party/pay/models/Online_payment_note_model.php @@ -177,7 +177,7 @@ class Online_payment_note_model extends CI_Model { $this->transactionId ? $sql.=$this->transactionId : false; $this->orderby ? $sql.=$this->orderby : false; - // log_message('error', PHP_EOL . $sql); + log_message('error', PHP_EOL . $sql); $query = $this->info->query($sql); $result = $query->result(); @@ -196,13 +196,14 @@ class Online_payment_note_model extends CI_Model { /** * @param mixed $where ['OPN_SN' => ['=', {val}] ] */ - public function get_note_where($where) { + public function get_note_where($where, $num=1) { $this->init_query(); - $this->topnum=1; + $this->topnum=$num; $this->search = ''; foreach ($where as $key => $value) { $where_val = ''; - switch (strtolower($value[0])) { + $sysbol = strtolower($value[0]); + switch ($sysbol) { case '=': $where_val = " = {$this->info->escape($value[1])}"; break; @@ -211,7 +212,7 @@ class Online_payment_note_model extends CI_Model { break; default: - $where_val = " = {$this->info->escape($value[1])}"; + $where_val = " {$sysbol} {$this->info->escape($value[1])}"; break; } $this->search .= " AND {$key} {$where_val} "; diff --git a/webht/third_party/pay/views/payment_list.php b/webht/third_party/pay/views/payment_list.php index 8370f09c..eb6f5051 100644 --- a/webht/third_party/pay/views/payment_list.php +++ b/webht/third_party/pay/views/payment_list.php @@ -32,6 +32,8 @@ .wechat-color {background-color: #62B900;} .paypal-color {background-color: #002D89;} .alipay-color {background-color: #00AAEE;} + .dev-color {background-color: #00A2E8;} + .test-color {background-color: #00A2E8;} .ipaylinks-color,.creditcard-color,.creditcard-ipaylinks-color {background-color: #AD1818;} .creditcard-lianlian-color {background-color: #1985ff;} .modal {background-color: rgba(0,0,0,0.075);}