From e388fdecd35b8a1d936a169eaf48a1668ffd75da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Thu, 21 Jun 2018 11:25:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BE=B7=E8=AF=ADAMP?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/amp.php | 49 ++++---- .../htmlcompressor/views/amp-template/gm.php | 109 ++++++++++++++++++ 2 files changed, 138 insertions(+), 20 deletions(-) create mode 100644 application/third_party/htmlcompressor/views/amp-template/gm.php diff --git a/application/controllers/amp.php b/application/controllers/amp.php index de54b267..6c369f63 100644 --- a/application/controllers/amp.php +++ b/application/controllers/amp.php @@ -41,28 +41,37 @@ class Amp extends CI_Controller if ($data['information'] == FALSE) { echo json_encode(array('result' => 'no', 'data' => '找不到这个页面')); } + + //144.76.185.44:8029 + + //根据站点不同,配置不同参数 + $site_code = strtolower($this->config->item('site_code')); + switch ($site_code) { + case 'ah': + //websitehost是表示资源下载的域名,在网页代码中有/css/xxx.css之类的路径,程序需要添加域名组成完整URL去下载文件,一般是data域名或者www域名 + $websitehost = 'https://data.asiahighlights.com'; + $html_source_url = 'https://www.asiahighlights.com/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url; + break; + case 'cht': + $websitehost = 'https://data.chinahighlights.com'; + $html_source_url = 'http://192.155.224.195:2222' . $data['information']->ic_url; + break; + case 'gm': + $websitehost = 'https://data.chinarundreisen.com'; + $html_source_url = 'http://144.76.185.44:8029' . $data['information']->ic_url; + break; + case 'ct': + $websitehost = 'https://data.chinatravel.com'; + $html_source_url = 'http://158.85.210.78:2222' . $data['information']->ic_url; + break; + default: + $websitehost = $this->config->item('site_url'); + $html_source_url = $this->config->item('site_url') . $data['information']->ic_url; + } + //获取网页当前源码,然后发送到信息平台 - $html_source = GET_HTTP($this->config->item('site_url') . '/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url); + $html_source = GET_HTTP($html_source_url); if (!empty($html_source)) { - //websitehost是表示资源下载的域名,在网页代码中有/css/xxx.css之类的路径,程序需要添加域名组成完整URL去下载文件,一般是data域名或者www域名 - $site_code = strtolower($this->config->item('site_code')); - switch ($site_code) { - case 'ah': - $websitehost = 'https://data.asiahighlights.com'; - break; - case 'cht': - $websitehost = 'https://data.chinahighlights.com'; - break; - case 'gm': - $websitehost = 'https://data.chinarundreisen.com'; - break; - case 'ct': - $websitehost = 'https://data.chinatravel.com'; - break; - default: - $websitehost = $this->config->item('site_url'); - } - $post_data = array('websitehost' => $websitehost, 'template_name' => $site_code, 'create_amp' => 'true', 'htmlsource' => $html_source); echo GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST'); return; diff --git a/application/third_party/htmlcompressor/views/amp-template/gm.php b/application/third_party/htmlcompressor/views/amp-template/gm.php new file mode 100644 index 00000000..48ac18f8 --- /dev/null +++ b/application/third_party/htmlcompressor/views/amp-template/gm.php @@ -0,0 +1,109 @@ + + + + + <!--@TITLE@--> + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + +
+
+ Anfragen
+
+ + + +
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + +
+
+
+ + + + + +
+ + +
+ + + + + +
+ + + + \ No newline at end of file