diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 4a0c9567..ec678a57 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -1354,6 +1354,7 @@ class Index extends CI_Controller { $currency = $this->input->post("currency"); $amount = $this->input->post("set_amount"); $last_record = $this->input->post("date_history"); + $filter_list = []; if (empty($amount)) { $export_list = $this->Note_model->date_range($from_date, $to_date, $currency, null, false); } else { @@ -1388,6 +1389,15 @@ class Index extends CI_Controller { if ($export_list == false) { echo "Not found any records for export."; return false; + } else { + // 过滤交易号重复的数据 + $txn_list = []; + foreach ($export_list as $key => $row) { + if (!in_array($row->pn_txn_id, $txn_list)) { + $txn_list[] = $row->pn_txn_id; + $filter_list[] = $row; + } + } } // 记录这次导出的最后一条 if (isset($all_list['last_flag']) && ! empty($all_list['last_flag'])) { @@ -1406,12 +1416,12 @@ class Index extends CI_Controller { ); $this->Note_model->export_record($insert_db); // 修改导出的最后一条 - array_pop($export_list); + array_pop($filter_list); $all_list['last_flag']->pn_mc_gross = $last_record_export; - array_push($export_list, $all_list['last_flag']); + array_push($filter_list, $all_list['last_flag']); } - $this->save_excel($export_list); + $this->save_excel($filter_list); } /*! @@ -1464,6 +1474,7 @@ class Index extends CI_Controller { $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20); $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20); $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20); + $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20); // 对齐 $objPHPExcel->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); $objPHPExcel->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); @@ -1477,7 +1488,8 @@ class Index extends CI_Controller { ->SetCellValue('E1', '付款人') ->SetCellValue('F1', '付款人邮箱') ->SetCellValue('G1', '交易号') - ->SetCellValue('H1', '收单时间'); + ->SetCellValue('H1', '收单时间') + ->SetCellValue('I1', '付款人国籍'); $currency_sum = array(); bcscale(2); $rowCount = 2; @@ -1496,7 +1508,8 @@ 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); $payer = $orderid = ""; $rowCount++; } diff --git a/webht/third_party/paypal/models/note_model.php b/webht/third_party/paypal/models/note_model.php index 0c912567..ce9e1977 100644 --- a/webht/third_party/paypal/models/note_model.php +++ b/webht/third_party/paypal/models/note_model.php @@ -101,7 +101,7 @@ class Note_model extends CI_Model { $sql .= " pn.pn_sn ,pn.pn_txn_id - --,pn.pn_invoice + ,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 @@ -122,7 +122,7 @@ class Note_model extends CI_Model { $this->search ? $sql.=$this->search : false; $this->pn_txn_id ? $sql.=$this->pn_txn_id : false; $this->orderby ? $sql.=$this->orderby : false; -// log_message('error',$sql); + // log_message('error', 'DEBUG: '.$sql); $query = $this->HT->query($sql); //print_r($this->HT->queries); if ($this->topnum === 1) {