|
|
@ -41,28 +41,37 @@ class Amp extends CI_Controller
|
|
|
|
if ($data['information'] == FALSE) {
|
|
|
|
if ($data['information'] == FALSE) {
|
|
|
|
echo json_encode(array('result' => 'no', 'data' => '找不到这个页面'));
|
|
|
|
echo json_encode(array('result' => 'no', 'data' => '找不到这个页面'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获取网页当前源码,然后发送到信息平台
|
|
|
|
|
|
|
|
$html_source = GET_HTTP($this->config->item('site_url') . '/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url);
|
|
|
|
//144.76.185.44:8029
|
|
|
|
if (!empty($html_source)) {
|
|
|
|
|
|
|
|
//websitehost是表示资源下载的域名,在网页代码中有/css/xxx.css之类的路径,程序需要添加域名组成完整URL去下载文件,一般是data域名或者www域名
|
|
|
|
//根据站点不同,配置不同参数
|
|
|
|
$site_code = strtolower($this->config->item('site_code'));
|
|
|
|
$site_code = strtolower($this->config->item('site_code'));
|
|
|
|
switch ($site_code) {
|
|
|
|
switch ($site_code) {
|
|
|
|
case 'ah':
|
|
|
|
case 'ah':
|
|
|
|
|
|
|
|
//websitehost是表示资源下载的域名,在网页代码中有/css/xxx.css之类的路径,程序需要添加域名组成完整URL去下载文件,一般是data域名或者www域名
|
|
|
|
$websitehost = 'https://data.asiahighlights.com';
|
|
|
|
$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;
|
|
|
|
break;
|
|
|
|
case 'cht':
|
|
|
|
case 'cht':
|
|
|
|
$websitehost = 'https://data.chinahighlights.com';
|
|
|
|
$websitehost = 'https://data.chinahighlights.com';
|
|
|
|
|
|
|
|
$html_source_url = 'http://192.155.224.195:2222' . $data['information']->ic_url;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'gm':
|
|
|
|
case 'gm':
|
|
|
|
$websitehost = 'https://data.chinarundreisen.com';
|
|
|
|
$websitehost = 'https://data.chinarundreisen.com';
|
|
|
|
|
|
|
|
$html_source_url = 'http://144.76.185.44:8029' . $data['information']->ic_url;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'ct':
|
|
|
|
case 'ct':
|
|
|
|
$websitehost = 'https://data.chinatravel.com';
|
|
|
|
$websitehost = 'https://data.chinatravel.com';
|
|
|
|
|
|
|
|
$html_source_url = 'http://158.85.210.78:2222' . $data['information']->ic_url;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
$websitehost = $this->config->item('site_url');
|
|
|
|
$websitehost = $this->config->item('site_url');
|
|
|
|
|
|
|
|
$html_source_url = $this->config->item('site_url') . $data['information']->ic_url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取网页当前源码,然后发送到信息平台
|
|
|
|
|
|
|
|
$html_source = GET_HTTP($html_source_url);
|
|
|
|
|
|
|
|
if (!empty($html_source)) {
|
|
|
|
$post_data = array('websitehost' => $websitehost, 'template_name' => $site_code, 'create_amp' => 'true', 'htmlsource' => $html_source);
|
|
|
|
$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');
|
|
|
|
echo GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|