From c589ada3d1024c001776e9a8c7f65e713bd5430b Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 5 Dec 2023 11:34:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?perf:=20=E6=94=AF=E4=BB=98=E5=AE=9D?= =?UTF-8?q?=E5=A4=9A=E8=B4=A6=E6=88=B7:=20+Trippest=20=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=AF=B9=E8=B4=A6=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + webht/third_party/pay/config/alipay.php | 13 +-- webht/third_party/pay/config/alipay_cht.php | 13 +++ webht/third_party/pay/config/alipay_tp.php | 22 +++++ .../pay/controllers/AlipayTradeService.php | 90 +++++++++++++------ 5 files changed, 99 insertions(+), 40 deletions(-) create mode 100644 webht/third_party/pay/config/alipay_cht.php create mode 100644 webht/third_party/pay/config/alipay_tp.php diff --git a/.gitignore b/.gitignore index a286a2b9..6f1c4033 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ /kcfinder/cache/* */cache/* /author/document/* +*/settlement_files/* */statement_files/* */paypal_activities/* /author/document/* diff --git a/webht/third_party/pay/config/alipay.php b/webht/third_party/pay/config/alipay.php index 1c846214..1906ab44 100644 --- a/webht/third_party/pay/config/alipay.php +++ b/webht/third_party/pay/config/alipay.php @@ -1,13 +1,4 @@ load->library('alipay/AopSdk'); // real URL - $this->config->load('alipay'); + $this->config->load('alipay', true); $this->config->load('wxpay', true); // test URL // $this->config->load('dev_alipay'); @@ -54,38 +55,49 @@ class AlipayTradeService extends CI_Controller $this->load->helper('payment'); $this->load->model('Online_payment_account_model', 'payment_model'); - $this->gateway_url = $this->config->item('gatewayUrl'); - $this->appid = $this->config->item('app_id'); - $this->seller_id = $this->config->item('seller_id'); - $this->private_key = $this->config->item('merchant_private_key'); - $this->alipay_public_key = $this->config->item('alipay_public_key'); - $this->charset = $this->config->item('charset'); - $this->signtype = $this->config->item('sign_type'); - $this->timeout_express = $this->config->item('timeout_express'); + $this->set_merchant('cht'); - $this->return_url = $this->config->item('return_url'); - $this->notify_url = $this->config->item('notify_url'); + header('Access-Control-Allow-Origin:*'); + header('Access-Control-Allow-Methods:POST, GET'); + header('Access-Control-Max-Age:0'); + header('Access-Control-Allow-Headers:x-requested-with, Content-Type'); + } - if(empty($this->appid)||trim($this->appid)==""){ - log_message('error','Alipay ERROR appid should not be NULL!'); + private function set_merchant($account = 'cht') + { + $this->merchant_account = $account; + + $this->ali_site_config = $this->config->item(strtolower($account), 'alipay'); + + $this->gateway_url = $this->ali_site_config['gatewayUrl']; + $this->appid = $this->ali_site_config['app_id']; + $this->seller_id = $this->ali_site_config['seller_id']; + $this->private_key = $this->ali_site_config['merchant_private_key']; + $this->alipay_public_key = $this->ali_site_config['alipay_public_key']; + $this->charset = $this->ali_site_config['charset']; + $this->signtype = $this->ali_site_config['sign_type']; + $this->timeout_express = $this->ali_site_config['timeout_express']; + + $this->return_url = $this->ali_site_config['return_url']; + $this->notify_url = $this->ali_site_config['notify_url']; + + if (empty($this->appid) || trim($this->appid) == "") { + log_message('error', 'Alipay ERROR appid should not be NULL!'); } - if(empty($this->private_key)||trim($this->private_key)==""){ - log_message('error','Alipay ERROR private_key should not be NULL!'); + if (empty($this->private_key) || trim($this->private_key) == "") { + log_message('error', 'Alipay ERROR private_key should not be NULL!'); } - if(empty($this->alipay_public_key)||trim($this->alipay_public_key)==""){ - log_message('error','Alipay ERROR alipay_public_key should not be NULL!'); + if (empty($this->alipay_public_key) || trim($this->alipay_public_key) == "") { + log_message('error', 'Alipay ERROR alipay_public_key should not be NULL!'); } - if(empty($this->charset)||trim($this->charset)==""){ - log_message('error','Alipay ERROR charset should not be NULL!'); + if (empty($this->charset) || trim($this->charset) == "") { + log_message('error', 'Alipay ERROR charset should not be NULL!'); } - if(empty($this->gateway_url)||trim($this->gateway_url)==""){ - log_message('error','Alipay ERROR gateway_url should not be NULL!'); + if (empty($this->gateway_url) || trim($this->gateway_url) == "") { + log_message('error', 'Alipay ERROR gateway_url should not be NULL!'); } - header('Access-Control-Allow-Origin:*'); - header('Access-Control-Allow-Methods:POST, GET'); - header('Access-Control-Max-Age:0'); - header('Access-Control-Allow-Headers:x-requested-with, Content-Type'); } + public function index() { $this->note_list(); @@ -752,6 +764,7 @@ class AlipayTradeService extends CI_Controller $response = $this->aopclientRequestExecute ($request); $response = $response->alipay_trade_query_response; + // log_message('error','test:rrr2 ' . __CLASS__ . PHP_EOL . var_export($response, 1)); return $response; } @@ -794,6 +807,17 @@ class AlipayTradeService extends CI_Controller return $this->output->set_content_type('application/json')->set_output(json_encode($response)); } + public function get_billfile($date=NULL) + { + ignore_user_abort(true); + $all_account = array_keys($this->config->item('alipay')); + foreach ($all_account as $key => $account) { + $this->set_merchant($account); + $this->download_billfile($date); + sleep(2); + } + return false; + } /*! * 对账单 * 流程: @@ -805,7 +829,7 @@ class AlipayTradeService extends CI_Controller * @date 2017-10-10 * @param [type] $date 按天yyyy-MM-dd;按月yyyy-MM */ - public function get_billfile($date=NULL) + public function download_billfile($date=NULL) { ignore_user_abort(true); $request = new AlipayDataDataserviceBillDownloadurlQueryRequest(); @@ -822,8 +846,8 @@ class AlipayTradeService extends CI_Controller } set_time_limit(0); $file = file_get_contents($response->$responseNode->bill_download_url); - $file_name = FCPATH.'download_statement\settlement_files\alipay\\' . $date . ".zip"; - $target = FCPATH.'download_statement\settlement_files\alipay\\' . $date ; + $file_name = FCPATH.'download_statement\settlement_files\alipay\\' . $this->merchant_account . $date . ".zip"; + $target = FCPATH.'download_statement\settlement_files\alipay\\' . $this->merchant_account . $date ; file_put_contents($file_name, $file); $biz_detail_table = array(); $biz_data_title = $this->bill_data_title(); @@ -855,6 +879,7 @@ class AlipayTradeService extends CI_Controller } $row_arr[$title] = trim($row[$key]); } + $row_arr['app_id'] = $this->appid; $biz_detail_table[] = $row_arr; } @@ -869,7 +894,7 @@ class AlipayTradeService extends CI_Controller foreach ($biz_detail_table as $key => $row) { $total_amount = 0;$trade_type='';$trade_no = '';$has_charge=null; if (isset($row['finance_id'])) { - if ($row['biz_type'] !== '其它') { + if ($row['biz_type'] !== '其它' && $row['biz_type'] !== '在线支付') { continue; } $total_amount = floatval($row['income'])>0 ? $row['income'] : $row['expenditure']; @@ -1000,6 +1025,7 @@ class AlipayTradeService extends CI_Controller * $size:生成二维码的尺寸,宽度和高度的值 * $lev:可选参数,纠错等级 * $margin:生成的二维码离边框的距离 + * @example http://chart.apis.google.com/chart?chs=200x200&cht=qr&chld=L|0&chl=content */ function create_erweima($content, $size = '200', $lev = 'L', $margin= '0') { $content = urlencode($content); @@ -1019,8 +1045,14 @@ class AlipayTradeService extends CI_Controller if (!empty($data['keywords'])) { $data['notelist'] = $this->Alipay_note_model->search_key($data['keywords']); /** 手动查询通过收钱码的收款, 必须输入交易号 */ + // if (true) { // debug: 0 if (empty($data['notelist'])) { $query_pay = $this->query_pay($data["keywords"]); + if (empty($query_pay)) { + $this->set_merchant('trippest'); + $query_pay = $this->query_pay($data["keywords"]); + } + $query_pay->app_id = $this->appid; if ( ! empty($query_pay) && strval($query_pay->code)==="10000" && in_array(strval($query_pay->trade_status), array("TRADE_SUCCESS", "TRADE_FINISHED")) ) { $pay_type = $query_pay->total_amount>0 ? "pay" : "refund"; From 010a598fb9bca807da308f1ff45fdeaf0bb1e587 Mon Sep 17 00:00:00 2001 From: candice Date: Wed, 6 Dec 2023 16:57:17 +0800 Subject: [PATCH 2/6] 11 --- application/views/mobile_first/ch-pc.php | 4 ++-- application/views/mobile_first/ch.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/application/views/mobile_first/ch-pc.php b/application/views/mobile_first/ch-pc.php index 31fde450..e25a9081 100644 --- a/application/views/mobile_first/ch-pc.php +++ b/application/views/mobile_first/ch-pc.php @@ -42,8 +42,8 @@ })(window, document, 'script', 'dataLayer', 'GTM-T75N4LL'); - - - -'; $data["ADDONCSS"] .= ''; @@ -2828,7 +2827,7 @@ class Information extends CI_Controller $exclude_ids = array($information->is_id); //需要排除的is_id,防止通过页面显示相同内容,默认排除本身,每个推荐内容都需要排除已经推荐过的 foreach ($root_recommands as $item) { if ($this->config->item('site_code') == 'ah') { //如果是AH的页面,取消重复检测 - $exclude_ids=array(0); + $exclude_ids = array(0); } $result = $this->recommand_information_rule($information, $root_detail, $item, $exclude_ids); if (!empty($result)) { @@ -2837,8 +2836,8 @@ class Information extends CI_Controller } foreach ($group_recommands as $item) { - if ($this->config->item('site_code') == 'ah' or $this->config->item('site_code') == 'ch' or $this->config->item('site_code') == 'gh' ) { //如果是AH CH GH的页面,取消重复检测 - $exclude_ids=array(0); + if ($this->config->item('site_code') == 'ah' or $this->config->item('site_code') == 'ch' or $this->config->item('site_code') == 'gh') { //如果是AH CH GH的页面,取消重复检测 + $exclude_ids = array(0); } if (empty($data[$item->ir_name])) { $result = $this->recommand_information_rule($information, $root_detail, $item, $exclude_ids); diff --git a/application/helpers/info_helper.php b/application/helpers/info_helper.php index afa24dfb..3f98988e 100644 --- a/application/helpers/info_helper.php +++ b/application/helpers/info_helper.php @@ -77,7 +77,7 @@ function is_series_site() { $CI = &get_instance(); $sitecode = $CI->config->item('site_code'); - if ($sitecode == 'vc' || $sitecode == 'ru' || $sitecode == 'jp' || $sitecode == 'vac' || $sitecode == 'it') { + if (in_array($sitecode, array('jp', 'vc', 'vac', 'ru', 'it', 'gh_jp', 'gh_vc', 'gh_vac', 'gh_ru', 'gh_it', 'gh_gm'))) { return true; } else { return false; @@ -103,7 +103,7 @@ function is_mobile_first() { $CI = &get_instance(); $sitecode = $CI->config->item('site_code'); - if ($sitecode == 'ch' || $sitecode == 'ah' || $sitecode=='chinatravel' || $sitecode == 'gh' || $sitecode=='shanghai') { + if ($sitecode == 'ch' || $sitecode == 'ah' || $sitecode == 'chinatravel' || $sitecode == 'gh' || $sitecode == 'shanghai') { return true; } else { return false; @@ -222,7 +222,7 @@ function get_task_count_by_status() function get_author_photo($author_code_id = false) { $CI = &get_instance(); - $root_url = '';//'http://data.chtcdn.com'; + $root_url = ''; //'http://data.chtcdn.com'; $avatar = $root_url . '/css/images/avatar.jpg'; if ($author_code_id && is_numeric($author_code_id)) { $CI->load->model('Infoauthors_model'); @@ -237,7 +237,7 @@ function get_author_photo($author_code_id = false) //补全图片路径 function get_photo_url($photo) { - $root_url = '';//'http://data.chtcdn.com'; + $root_url = ''; //'http://data.chtcdn.com'; if ($photo == '') { $avatar = $root_url . '/css/images/uploadPic.jpg'; } else { @@ -275,7 +275,8 @@ function show_page($page) } $html = ''; - if ($nowview > 1) $befor--; + if ($nowview > 1) + $befor--; if ($pageSize <= $total) { for ($i = $befor; $i <= $after; $i++) { if ($i == $currentPage) { @@ -338,7 +339,7 @@ function GET_HTTP($url, $data = '', $method = 'GET') curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 $tmpInfo = curl_exec($curl); // 执行操作 $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); - if ($httpCode >= 400) {//页面状态,如果大于400说明页面打不开 + if ($httpCode >= 400) { //页面状态,如果大于400说明页面打不开 log_message('error', " curl {$httpCode} {$url} "); return false; } @@ -371,7 +372,8 @@ function compress_css($buffer) } //把临时多媒体中心预览图片地址替换为网前地址 -function replace_image_url($ic_content){ +function replace_image_url($ic_content) +{ $CI = &get_instance(); - return str_replace($CI->config->item('media_image_url'), $CI->config->item('site_image_url'),$ic_content); + return str_replace($CI->config->item('media_image_url'), $CI->config->item('site_image_url'), $ic_content); } \ No newline at end of file From 2ff1d7298d05fb6642893ab214962aa4c6f1d691 Mon Sep 17 00:00:00 2001 From: candice Date: Mon, 11 Dec 2023 09:53:34 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=A4=B4=E9=83=A8=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/views/mobile_first/ah-pc.php | 117 +--------------------- application/views/mobile_first/ah.php | 120 ++--------------------- 2 files changed, 9 insertions(+), 228 deletions(-) diff --git a/application/views/mobile_first/ah-pc.php b/application/views/mobile_first/ah-pc.php index 49fbb4b2..2a5075f7 100644 --- a/application/views/mobile_first/ah-pc.php +++ b/application/views/mobile_first/ah-pc.php @@ -55,53 +55,7 @@ alt="Asiahighlights logo" class="asiahighlightslogo img-responsive"> - +