|
|
@ -6,18 +6,21 @@ if (!defined('BASEPATH'))
|
|
|
|
* AMP的相关方法
|
|
|
|
* AMP的相关方法
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
class Amplib {
|
|
|
|
class Amplib
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var $CI;
|
|
|
|
var $CI;
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
public function __construct()
|
|
|
|
$this->CI = & get_instance();
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->CI = &get_instance();
|
|
|
|
$this->CI->load->model('Information_model');
|
|
|
|
$this->CI->load->model('Information_model');
|
|
|
|
$this->CI->load->model('InfoMetas_model');
|
|
|
|
$this->CI->load->model('InfoMetas_model');
|
|
|
|
$this->CI->load->model('Logs_model');
|
|
|
|
$this->CI->load->model('Logs_model');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function edit($ic_id) {
|
|
|
|
public function edit($ic_id)
|
|
|
|
|
|
|
|
{
|
|
|
|
$data = array();
|
|
|
|
$data = array();
|
|
|
|
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
|
|
|
|
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
|
|
|
|
if ($data['information'] == FALSE) {
|
|
|
|
if ($data['information'] == FALSE) {
|
|
|
@ -25,9 +28,9 @@ class Amplib {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//查询上一次保存记录
|
|
|
|
//查询上一次保存记录
|
|
|
|
$amp_log = $this->CI->Logs_model->get_last_edit_amp($ic_id);
|
|
|
|
$amp_log = $this->CI->Logs_model->get_last_edit_amp($ic_id);
|
|
|
|
if(!empty($amp_log)){
|
|
|
|
if (!empty($amp_log)) {
|
|
|
|
$data['last_edit_amp_id'] = $amp_log->log_id;
|
|
|
|
$data['last_edit_amp_id'] = $amp_log->log_id;
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
$data['last_edit_amp_id'] = '';
|
|
|
|
$data['last_edit_amp_id'] = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -36,9 +39,10 @@ class Amplib {
|
|
|
|
$this->CI->load->view('bootstrap3/footer');
|
|
|
|
$this->CI->load->view('bootstrap3/footer');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function auto_create($ic_id) {
|
|
|
|
public function auto_create($ic_id)
|
|
|
|
|
|
|
|
{
|
|
|
|
$data = array();
|
|
|
|
$data = array();
|
|
|
|
if(strtolower($this->CI->config->item('site_code')) == 'cht'){
|
|
|
|
if (strtolower($this->CI->config->item('site_code')) == 'cht') {
|
|
|
|
$this->CI->Information_model->ic_type = "AND ic.ic_type != 'none'";
|
|
|
|
$this->CI->Information_model->ic_type = "AND ic.ic_type != 'none'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
|
|
|
|
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
|
|
|
@ -61,7 +65,7 @@ class Amplib {
|
|
|
|
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;
|
|
|
|
$html_source_url = 'https://www.chinarundreisen.com/' . $data['information']->ic_url;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'ct':
|
|
|
|
case 'ct':
|
|
|
|
$websitehost = 'https://data.chinatravel.com';
|
|
|
|
$websitehost = 'https://data.chinatravel.com';
|
|
|
@ -76,22 +80,23 @@ class Amplib {
|
|
|
|
if (!empty($html_source)) {
|
|
|
|
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);
|
|
|
|
//德语站点走另外一个控制器,其他站点还是走原来的流程
|
|
|
|
//德语站点走另外一个控制器,其他站点还是走原来的流程
|
|
|
|
if($site_code == 'gm'){
|
|
|
|
if ($site_code == 'gm') {
|
|
|
|
if($data['information']->ic_url == '/massgeschneiderte-china-reisen/'){
|
|
|
|
if ($data['information']->ic_url == '/massgeschneiderte-china-reisen/') {
|
|
|
|
return json_encode(array());
|
|
|
|
return json_encode(array());
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
return GET_HTTP(site_url('/apps/htmlcompressor/index_gm/choose_way'), $post_data, 'POST');
|
|
|
|
return GET_HTTP(site_url('/apps/htmlcompressor/index_gm/choose_way'), $post_data, 'POST');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}elseif($site_code == 'ah'){
|
|
|
|
} elseif ($site_code == 'ah') {
|
|
|
|
return GET_HTTP(site_url('/apps/htmlcompressor/index_ah/choose_way'), $post_data, 'POST');
|
|
|
|
return GET_HTTP(site_url('/apps/htmlcompressor/index_ah/choose_way'), $post_data, 'POST');
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
|
|
|
|
return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return json_encode(array('result' => 'no', 'data' => '不知道哪里错了,看代码'));
|
|
|
|
return json_encode(array('result' => 'no', 'data' => '不知道哪里错了,看代码'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false) {
|
|
|
|
public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false)
|
|
|
|
|
|
|
|
{
|
|
|
|
$data = array();
|
|
|
|
$data = array();
|
|
|
|
if ($ic_id === false) {
|
|
|
|
if ($ic_id === false) {
|
|
|
|
$ic_id = $this->CI->input->post('ic_id');
|
|
|
|
$ic_id = $this->CI->input->post('ic_id');
|
|
|
|