From 9722f8ab86b9265c922cda763232e5d9bf518931 Mon Sep 17 00:00:00 2001 From: Jimmy Liow <18777396951@163.com> Date: Wed, 8 Feb 2023 10:48:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=20PayPal=20=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webht/third_party/paypal/controllers/index.php | 16 +++++++++++++--- webht/third_party/paypal/models/note_model.php | 12 ++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index b895c87b..54666eb5 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -1389,7 +1389,6 @@ class Index extends CI_Controller { $filter_list[] = $row; } } - $export_list = $filter_list; // 修改导出的第一条记录, 金额改为剩余金额 if ( ! empty($last_notice_record[0]) && $last_notice_record[0]->TEL_transactionNoticeId==$export_list[0]->pn_sn) { @@ -1488,16 +1487,25 @@ class Index extends CI_Controller { ->SetCellValue('E1', '付款人') ->SetCellValue('F1', '付款人邮箱') ->SetCellValue('G1', '交易号') - ->SetCellValue('H1', '收单时间'); + ->SetCellValue('H1', '收单时间') + ->SetCellValue('I1', '付款人国籍') + ->SetCellValue('J1', '是否重复'); $currency_sum = array(); bcscale(2); $rowCount = 2; + $txn_list = []; foreach ($export_list as $key => $row) { if( trim($row->pn_mc_currency) != "") { $currency_sum[trim($row->pn_mc_currency)] = @ bcadd($currency_sum[trim($row->pn_mc_currency)], $row->pn_mc_gross); } $payer = $row->pn_payer ? ($row->pn_payer . "<" . $row->pn_payer_email . ">") : "退款"; $orderid = $row->pn_invoice ? $row->pn_invoice : $row->pn_item_number; + $txn_duplicated = ''; + if (in_array($row->pn_txn_id, $txn_list)) { + $txn_duplicated = 'X'; + } + $txn_list[] = $row->pn_txn_id; + $objPHPExcel->getActiveSheet() ->SetCellValue('A'.$rowCount, ($rowCount-1)) // ->SetCellValue('A'.$rowCount, $row->pn_sn) @@ -1507,7 +1515,9 @@ class Index extends CI_Controller { ->SetCellValue('E'.$rowCount, $row->pn_payer) ->SetCellValue('F'.$rowCount, $row->pn_payer_email) ->setCellValueExplicit('G'.$rowCount, $row->pn_txn_id,PHPExcel_Cell_DataType::TYPE_STRING) - ->SetCellValue('H'.$rowCount, $row->pn_datetime); + ->SetCellValue('H'.$rowCount, $row->pn_datetime) + ->SetCellValue('I'.$rowCount, $row->payer_country) + ->setCellValueExplicit('J'.$rowCount, $txn_duplicated,PHPExcel_Cell_DataType::TYPE_STRING); $payer = $orderid = ""; $rowCount++; } diff --git a/webht/third_party/paypal/models/note_model.php b/webht/third_party/paypal/models/note_model.php index 07a02bf4..d7916cbe 100644 --- a/webht/third_party/paypal/models/note_model.php +++ b/webht/third_party/paypal/models/note_model.php @@ -200,9 +200,17 @@ class Note_model extends CI_Model { } $this->search = $search_sql; $this->orderby = " order by pn.pn_sn asc"; - + + $filter_list = []; + $txn_list = []; $query_list = $this->get_list(); - return $query_list; + foreach ($query_list as $key => $row) { + if (!in_array($row->pn_txn_id, $txn_list)) { + $txn_list[] = $row->pn_txn_id; + $filter_list[] = $row; + } + } + return $filter_list; }