diff --git a/.gitignore b/.gitignore index c9c1fc39..e4e0264d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea .svn/* */logs/log* /web.config @@ -6,3 +7,4 @@ */cache/* */statement_files/* */paypal_activities/* +/author/document/* \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 88646b84..29b1b372 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ staging: production: script: - curl -sSf http://cht.mycht.cn/please_dont_delete_this_file_4a4f500ae61d9e44b931d9f72fb14aaf95517b7e.php?branch=master + - curl -sSf https://www.arachina.com/pull-from-origin-by-icht.php?branch=info only: - master - /^deploy-.*$/ \ No newline at end of file diff --git a/application/config/config.php b/application/config/config.php index df5cd0d1..a6ad6f16 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -382,6 +382,8 @@ $config['site'] = array( 'mct' => array('site_code' => 'mct', 'site_id' => 6, 'site_lgc' => '101', 'site_image_url' => '', 'site_url' => 'https://www.mychinatours.com', 'site_authors' => array('cj')), 'diy' => array('site_code' => 'diy', 'site_id' => 99, 'site_lgc' => '1', 'sitemap_name' => 'E:/Dropbox/wwwroot/diychinatours.com/information.sitemap.xml', 'site_image_url' => '//images.diychinatours.com', 'site_url' => 'http://www.diychinatours.com', 'site_sitemap' => 'E:/Dropbox/wwwroot/diychinatours.com/information.sitemap.xml', 'site_authors' => array('ycc,lyy')), 'ah' => array('site_code' => 'ah', 'site_id' => 141, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => '//images.asiahighlights.com', 'site_url' => 'https://www.asiahighlights.com', 'site_sitemap' => '', 'site_authors' => array('X', 'sfx'), 'site_user' => array(',ycc,sfx,X,')), + 'pgr' => array('site_code' => 'pgr', 'site_id' => 148, 'site_lgc' => '2', 'sitemap_name' => '', 'site_image_url' => '', 'site_url' => 'http://www.peregrine.cn', 'site_sitemap' => '', 'site_authors' => array('X', 'sfx'), 'site_user' => array(',ycc,sfx,X,')), + 'ts' => array('site_code' => 'ts', 'site_id' => 149, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => '', 'site_url' => 'http://www.trainspread.com', 'site_sitemap' => '', 'site_authors' => array('X', 'sfx'), 'site_user' => array(',ycc,sfx,X,')), 'bht' => array('site_code' => 'bht', 'site_id' => 6565, 'site_lgc' => '1', 'site_image_url' => '', 'site_url' => 'http://www.beijinghighlights.com', 'site_authors' => array('cj')) ); @@ -561,42 +563,6 @@ $config['InfoType_citizen'] = array( '产品' => 'product' ); -//可选模板 -$config['templates'] = array( - '通用内容模板' => 'guide_info_detail', - '城市-列表模板' => 'city_info_list', - '城市-首页模板' => 'city_info_index', - '城市-首页模板[简]' => 'city_info_s_index', - '城市-景点列表模板' => 'city_info_attractions_list', - '城市-景点列表模板[简]' => 'city_info_s_attractions_list', - '城市-景点详细模板' => 'city_attractions', - '城市-特色产品模板' => 'city_info_diytour', - '城市-一线城市首页' => 'city_info_index_one', - '省份-首页' => "area_info_index", - '省份-列表模板' => 'area_info_list', - '省份-通用内容模板' => 'area_info_detail', - '文化模板 [列表式]' => "culture_info_detail_just_list", - '文化模板 [单页式]' => 'culture_info_detail_one_page', - '文化模板 [导航式]' => 'culture_info_detail_with_category', - '信息专题模板' => 'guide_top_series', - '火车专题模板' => 'train_top_series', - '旅游攻略' => 'travel_story', - '节庆-详细模板' => 'festival_detail', - '节庆-列表模板' => 'festival_list', - '大使馆-详细页' => 'embassy_info_detail', - '城市-线路详细' => 'city_circuit', - '专题模板(大)' => 'guide_big_series', - '[国际站]响应式-空白模板' => 'r_tpl_empty', - '[国际站]响应式-专题首页' => 'r_tpl_empty_navi0', - '[国际站]响应式-专题列表页' => 'r_tpl_empty_navi1', - '[国际站]响应式-专题列表页+' => 'r_tpl_empty_navi1p', - '[国际站]响应式-专题详细页' => 'r_tpl_empty_navi2', - '[-------已废弃-------]空白模板' => 'tpl_empty', - '[-------已废弃-------]专题-温暖' => 'warm', - '[-------已废弃-------]专题-庄重' => 'solemn', - '[-------已废弃-------]专题-节庆' => 'festival', - '[-------已废弃-------]专题-线路促销' => 'promotion_tour' -); //可选模板 $config['templates_i'] = array( @@ -605,7 +571,8 @@ $config['templates_i'] = array( '[城市]C首页模板' => 'city_info_index', '[城市]C景点列表模板' => 'city_info_attractions_list', '[城市]C景点详细模板' => 'city_attractions', - '[专题]T0空白模板' => 'r_tpl_empty', + '[专题]T0空白' => 'r_tpl_empty', + '[专题]T0空白(带框架)' => 'r_empty2', '----------二级目录----------' => '------2------', '[专题]T2首页' => 'r_t2_index', '[专题]T2详细' => 'r_t2_detail', @@ -649,6 +616,7 @@ $config['area_type'] = array( '大使馆' => 'y', '公民游' => 'z', '交换链接' => 'k', + '首页' => 'h', 'FAQ' => 'q' ); @@ -903,6 +871,7 @@ $config['templates'] = array( '通用内容模板' => 'guide_info_detail', '城市-列表模板' => 'city_info_list', '城市-首页模板' => 'city_info_index', + '城市-首页模板(GM)' => 'city_info_index_new', '城市-首页模板[简]' => 'city_info_s_index', '城市-景点列表模板' => 'city_info_attractions_list', '城市-景点列表模板[简]' => 'city_info_s_attractions_list', @@ -938,6 +907,55 @@ $config['templates'] = array( 'food列表' => 'food_list' ); +//德语信息模板 +$config['templates_gm'] = array( + '通用内容模板' => 'guide_info_detail', + '城市-列表模板' => 'city_info_list', + '城市-首页模板' => 'city_info_index', + '城市-首页模板(GM)' => 'city_info_index_new', + '城市-首页模板[简]' => 'city_info_s_index', + '城市-景点列表模板' => 'city_info_attractions_list', + '城市-景点列表模板[简]' => 'city_info_s_attractions_list', + '城市-特色产品模板' => 'city_info_diytour', + '城市-一线城市首页' => 'city_info_index_one', + '省份-首页' => "area_info_index", + '文化模板 [列表式]' => "culture_info_detail_just_list", + '文化模板 [单页式]' => 'culture_info_detail_one_page', + '文化模板 [导航式]' => 'culture_info_detail_with_category', + '信息专题模板' => 'guide_top_series', + '空白模板'=>'none' +); + +// CHT 信息模板 +$config['templates_cht'] = array( + '通用内容模板' => 'guide_info_detail', + '城市-列表模板' => 'city_info_list', + '城市-首页模板' => 'city_info_index', + '城市-首页模板[简]' => 'city_info_s_index', + '城市-景点列表模板' => 'city_info_attractions_list', + '城市-景点列表模板[简]' => 'city_info_s_attractions_list', + '城市-特色产品模板' => 'city_info_diytour', + '城市-一线城市首页' => 'city_info_index_one', + '省份-首页' => "area_info_index", + '省份-列表模板' => 'area_info_list', + '省份-通用内容模板' => 'area_info_detail', + '文化模板 [列表式]' => "culture_info_detail_just_list", + '文化模板 [单页式]' => 'culture_info_detail_one_page', + '文化模板 [导航式]' => 'culture_info_detail_with_category', + '信息专题模板' => 'guide_top_series', + '火车专题模板' => 'train_top_series', + '旅游攻略' => 'travel_story', + '节庆-详细模板' => 'festival_detail', + '节庆-列表模板' => 'festival_list', + '大使馆-详细页' => 'embassy_info_detail', + '城市-线路详细' => 'city_circuit', + '专题模板(大)' => 'guide_big_series', + '三峡游船' => 'yangtze', + '城市article列表' => 'city_article_list', + 'food列表' => 'food_list', + 'FAQ模板' => 'faq_detail' +); + //产品管理板块模板 $config['templates_product'] = array( '空白模板' => 'none', @@ -956,6 +974,16 @@ $config['templates_ah'] = array( '静态页面' => 'static' ); +// 出境游网站模板 +$config['templates_pgr'] = array( + '空白模板' => 'guide_info_detail' + ,'导航模板' => 'culture_info_detail_with_category' +); +// 国际火车网站模板 +$config['templates_ts'] = array( + '空白模板' => 'guide_info_detail' + ,'信息导航模板' => 'train_series_with_category' +); //翰特产品类型,Information控制器的get_products函数有直接调用,在这里增加了信息需要去控制器写相关操作代码 $config['ProductType_HT'] = array( diff --git a/application/controllers/amp.php b/application/controllers/amp.php new file mode 100644 index 00000000..55dd1aef --- /dev/null +++ b/application/controllers/amp.php @@ -0,0 +1,35 @@ +permission->is_admin(); + //$this->output->enable_profiler(TRUE); + $this->load->model('Information_model'); + $this->load->model('InfoMetas_model'); + $this->load->library('Amplib'); + } + + public function index() { + $data = array(); + $this->load->view('bootstrap3/header', $data); + $this->load->view('bootstrap3/footer'); + } + + public function edit($ic_id) { + $this->amplib->edit($ic_id); + } + + public function auto_create($ic_id) { + echo $this->amplib->auto_create($ic_id); + } + + public function edit_save() { + echo $this->amplib->edit_save(); + } + +} diff --git a/application/controllers/cache.php b/application/controllers/cache.php index 1d9a0e20..a92a435f 100644 --- a/application/controllers/cache.php +++ b/application/controllers/cache.php @@ -138,16 +138,16 @@ class Cache extends CI_Controller $mydir = dir($dir); while($f = $mydir->read()) { - if(is_dir("$dir/$f") && $f!="." && $f!=".." && (strpos($dir, '/cn/')==false)) + if(is_dir("$dir/$f") && $f!="." && $f!=".." && (strpos($dir, '/cn/')===false) && (strpos($dir, '/amp/')===false)) { $path[] = "$dir/$f"; $this->tree("$dir/$f", $file, $path, $file_time); } else { - if ($f!='.' && $f!='..' && (strpos($dir, '/cn/')==false) && (strpos($f, '.pdf')===false)) + if ($f!='.' && $f!='..' && (strpos($dir, '/cn/')===false) && (strpos($dir, '/amp/')===false) && (strpos($f, '.pdf')===false)) { - $file_temp = str_ireplace('index.htm###', '', $f.'###'); + $file_temp = str_ireplace('/index.htm###', '', $f.'###'); $file_temp = str_ireplace('###', '', $file_temp); $path_temp = str_ireplace($this->dir, '', $dir); $url_temp = $this->current_domain.$path_temp.'/'.$file_temp; diff --git a/application/controllers/home.php b/application/controllers/home.php new file mode 100644 index 00000000..c351dfc8 --- /dev/null +++ b/application/controllers/home.php @@ -0,0 +1,42 @@ +permission->is_admin(); + //$this->output->enable_profiler(TRUE); + $this->load->model('Area_model'); + $this->load->model('Information_model'); + $this->load->model('InfoContents_model'); + $this->load->model('InfoStructures_model'); + } + + //站点首页 + public function index() + { + $home_id=1; + //查询结构根节点,当为空则建立 + $rootStructure = $this->Information_model->GetRoot('h', $home_id); + if ($rootStructure == FALSE) + { + $this->InfoContents_model->Add('', 'HomePage', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $home_id, 'h', 0, + '',''); + $this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id); + $is_id = $this->InfoStructures_model->insert_id; + } + else + { + $is_id = $rootStructure->is_id; + } + redirect(site_url('information/edit/' . $is_id)); + } + + +} + diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php new file mode 100644 index 00000000..990f7f65 --- /dev/null +++ b/application/controllers/info_amp.php @@ -0,0 +1,309 @@ +permission->is_admin(); + $this->load->model('InfoMetas_model'); + $this->load->model('InfoContents_model'); + $this->load->model('Information_model'); + $this->site_code = $this->config->item('site_code'); + //CORS TEST + header('Access-Control-Allow-Origin:*'); + } + + public function save_amp() + { + $icid = $this->input->get_post('icid'); + $json = $this->input->get_post('json'); + $html = $this->input->get_post('html'); + $css = $this->input->get_post('css'); + $schema = $this->input->get_post('schema'); + $script = $this->input->get_post('script'); + $status = $this->input->get_post('status'); + if ($icid && $json && $html) { + try { + //html + $meta = $this->InfoMetas_model->get($icid, 'AMP_BODY'); + if ($meta === false) { + $this->InfoMetas_model->add($icid, 'AMP_BODY', $html); + } else { + $this->InfoMetas_model->update($icid, 'AMP_BODY', $html); + } + //json + $meta = $this->InfoMetas_model->get($icid, 'AMP_JSON'); + if ($meta === false) { + $this->InfoMetas_model->add($icid, 'AMP_JSON', $json); + } else { + $this->InfoMetas_model->update($icid, 'AMP_JSON', $json); + } + //css + $meta = $this->InfoMetas_model->get($icid, 'AMP_CSS'); + if ($meta === false) { + $this->InfoMetas_model->add($icid, 'AMP_CSS', $css); + } else { + $this->InfoMetas_model->update($icid, 'AMP_CSS', $css); + } + //script + $meta = $this->InfoMetas_model->get($icid, 'AMP_SCRIPT'); + if ($meta === false) { + $this->InfoMetas_model->add($icid, 'AMP_SCRIPT', $script); + } else { + $this->InfoMetas_model->update($icid, 'AMP_SCRIPT', $script); + } + //schema + $meta = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA'); + if ($meta === false) { + $this->InfoMetas_model->add($icid, 'AMP_SCHEMA', $schema); + } else { + $this->InfoMetas_model->update($icid, 'AMP_SCHEMA', $schema); + } + //status + $meta = $this->InfoMetas_model->get($icid, 'AMP_STATUS'); + if ($meta === false) { + $this->InfoMetas_model->add($icid, 'AMP_STATUS', $status); + } else { + $this->InfoMetas_model->update($icid, 'AMP_STATUS', $status); + } + echo json_encode(array( + "succ" => true + )); + } catch(Exception $e) { + echo json_encode(array( + "succ" => false, + "message" => "save_amp() -> ".$e->getMessage() + )); + } + } else { + echo json_encode(array( + "succ" => false, + "message" => "save_amp() -> 参数传递错误。" + )); + } + } + + public function load_amp() + { + $icid = $this->input->get_post('icid'); + if (!$icid) { + echo json_encode(array( + "succ" => false, + "message" => "load_amp() -> 参数传递错误。" + )); + return false; + } + //信息~返回信息 + $ic = $this->InfoContents_model->get_ic_contents2($icid); + if (empty($ic)) { + echo json_encode(array( + "succ" => false, + "message" => "load_amp() -> 无信息" + )); + return false; + } + switch (strtolower($ic->ic_sitecode)) { + case 'vac': + $site = 'https://www.viaje-a-china.com'; + break; + case 'vc': + $site = 'https://www.voyageschine.com'; + break; + case 'jp': + $site = 'https://www.arachina.com'; + break; + case 'ru': + $site = 'https://www.chinahighlights.ru'; + break; + case 'it': + $site = 'https://www.viaggio-in-cina.it'; + break; + case 'cht': + $site = 'https://www.chinahighlights.com'; + break; + case 'gm': + $site = 'https://www.chinarundreisen.com/'; + break; + default: + $site = ''; + break; + } + + $json = $this->InfoMetas_model->get($icid, 'AMP_JSON'); + $status = $this->InfoMetas_model->get($icid, 'AMP_STATUS'); + $schema = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA'); + if ($json) { + echo json_encode(array( + "succ" => true, + "icid" => $icid, + "icurl" => $site.$ic->ic_url, + "json" => $json, + "schema" => $schema, + "status" => $status + )); + } else { + echo json_encode(array( + "succ" => false, + "message" => "load_amp() -> 无数据返回。" + )); + } + } + + public function list_amp() + { + $site = $this->input->get_post('site'); + switch ($site) { + case 'https://www.viaje-a-china.com': + $site_code = 'vac'; + break; + case 'https://www.voyageschine.com': + $site_code = 'vc'; + break; + case 'https://www.arachina.com': + $site_code = 'jp'; + break; + case 'https://www.chinahighlights.ru': + $site_code = 'ru'; + break; + case 'https://www.viaggio-in-cina.it': + $site_code = 'it'; + break; + case 'https://www.chinahighlights.com': + $site_code = 'cht'; + break; + case 'https://www.chinarundreisen.com/': + $site_code = 'gm'; + break; + default: + $site_code = false; + break; + } + if (!$site_code) { + echo json_encode(array( + "succ" => false, + "message" => "list_amp() -> 参数传递错误。" + )); + return false; + } + $rs = $this->InfoMetas_model->list_amp($site_code); + if (!empty($rs)) { + echo json_encode($rs); + } else { + echo json_encode(array( + "succ" => false, + "message" => "load_amp() -> 无数据返回。" + )); + } + } + + public function list_info_children() + { + $site = $this->input->get_post('site'); + switch ($site) { + case 'https://www.viaje-a-china.com': + $site_code = 'vac'; + break; + case 'https://www.voyageschine.com': + $site_code = 'vc'; + break; + case 'https://www.arachina.com': + $site_code = 'jp'; + break; + case 'https://www.chinahighlights.ru': + $site_code = 'ru'; + break; + case 'https://www.viaggio-in-cina.it': + $site_code = 'it'; + break; + case 'https://www.chinahighlights.com': + $site_code = 'cht'; + break; + case 'https://www.chinarundreisen.com/': + $site_code = 'gm'; + break; + default: + $site_code = false; + break; + } + $is_path = $this->input->get_post('is_path'); // '25693,278002094,' + if (!$site_code || !$is_path) { + echo json_encode(array( + 'succ' => false, + 'message' => 'list_info_children() -> 参数传递错误。' + )); + return false; + } + $rs = $this->InfoMetas_model->list_info_by_path_with_meta($is_path, $site_code); + if (!empty($rs)) { + $newrs = array(); + foreach ($rs as $info) { + $show_photo_meta = $this->InfoMetas_model->get($info->ic_id, 'meta_use_list_picture'); + if ($show_photo_meta == 'no') { + $use_photo = ''; + } else { + $use_photo = $this->config->item('site_image_url').$info->ic_photo; + } + if ($info->ic_type === 'c_attraction' || $info->ic_template === 'city_info_attractions_list' || $info->ic_template === 'r_tpl_empty_navi1p') { + $list_info = true; + } else { + $list_info = false; + } + if ($list_info || !empty($info->ic_content) && !empty($info->ic_url) && stripos($info->ic_url, '/test/')===false) { + array_push($newrs, array( + 'is_path' => $info->is_path, + 'ic_url' => $info->ic_url, + 'ic_id' => $info->ic_id, + 'title' => $info->ic_title, + 'photo' => $use_photo, + 'im_id' => $info->im_id + )); + } + } + echo json_encode($newrs); + } else { + echo json_encode(array( + "succ" => false, + "message" => "list_info_children() -> 无数据返回。" + )); + } + } + + public function load_info() + { + $icid = $this->input->get_post('icid'); + if ($icid) { + $ic = $this->InfoContents_model->get_ic_contents2($icid); + if ($ic) { + $show_photo_meta = $this->InfoMetas_model->get($icid, 'meta_use_list_picture'); + if ($show_photo_meta == 'no') { + $use_photo = ''; + } else { + $use_photo = $this->config->item('site_image_url').$ic->ic_photo; + } + echo json_encode(array( + "succ" => true, + "info" => $ic->ic_content ? $ic->ic_content : "
".$ic->ic_seo_description."
", + "title" => $ic->ic_title, + "photo" => $use_photo, + "url" => $ic->ic_url, + "site" => $this->config->item('site_url') + )); + } else { + echo json_encode(array( + "succ" => false, + "message" => "load_info() -> 无数据返回。" + )); + } + } else { + echo json_encode(array( + "succ" => false, + "message" => "load_info() -> 参数传递错误。" + )); + } + } +} diff --git a/application/controllers/info_tags.php b/application/controllers/info_tags.php new file mode 100644 index 00000000..ff90be1e --- /dev/null +++ b/application/controllers/info_tags.php @@ -0,0 +1,144 @@ +permission->is_admin(); + //$this->output->enable_profiler(TRUE); + $this->load->model('Information_model'); + $this->load->model('InfoTags_model'); + } + + /** + * 添加标签 + */ + public function add_tag() + { + $this->InfoTags_model->it_title = $this->input->get_post('title'); + $this->InfoTags_model->it_memo = $this->input->get_post('memo'); + $return = $this->InfoTags_model->add_tag(); + if ($return) + { + echo(json_encode(array( + 'status' => 1, + 'message' => $return + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '添加标签失败' + ))); + } + } + + /** + * 删除标签 + */ + public function remove_tag() + { + $this->InfoTags_model->it_title = $this->input->get_post('title'); + $return = $this->InfoTags_model->remove_tag(); + if ($return == 'success') + { + echo(json_encode(array( + 'status' => 1, + 'message' => '删除标签成功' + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '删除标签失败' + ))); + } + } + + /** + * 展示标签 + */ + public function list_tag($ic_id = '') + { + $ic_id ? $this->InfoTags_model->ic_id = $ic_id : $this->InfoTags_model->ic_id = $this->input->post('ic_id'); + $return = $this->InfoTags_model->list_tag(); + if ($return != 'fail') + { + echo(json_encode(array( + 'status' => 1, + 'data' => $return + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '读出标签失败' + ))); + } + } + + /** + * 添加关联信息+标签 + */ + public function add_tag_to_content() + { + $this->InfoTags_model->ic_id = $this->input->get_post('ic_id'); + $this->InfoTags_model->it_id = $this->input->get_post('it_id'); + $return = $this->InfoTags_model->add_tag_to_content(); + if ($return == 'success') + { + echo(json_encode(array( + 'status' => 1, + 'message' => '关联信息标签成功' + ))); + } + else if ($return == 'exist') + { + echo(json_encode(array( + 'status' => 2, + 'message' => '关联信息标签已存在' + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '关联信息标签失败' + ))); + } + } + + /** + * 移除关联信息+标签 + */ + public function remove_tag_to_content() + { + $this->InfoTags_model->ic_id = $this->input->get_post('ic_id'); + $this->InfoTags_model->it_id = $this->input->get_post('it_id'); + $return = $this->InfoTags_model->remove_tag_to_content(); + if ($return == 'success') + { + echo(json_encode(array( + 'status' => 1, + 'message' => '移除关联信息标签成功' + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '移除关联信息标签失败' + ))); + } + } + +} + diff --git a/application/controllers/information.php b/application/controllers/information.php index 662f3639..4e3fd961 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -18,9 +18,8 @@ class Information extends CI_Controller { $this->load->model('Logs_model'); $this->load->model('InfoMetas_model'); $this->load->model('Infoauthors_model'); - $this->load->model('InfoKeywordsanalytics_model', 'analytics_model'); $this->load->model('InfoSMS_model'); - + $this->load->library('Amplib'); //加载AMP处理类 $this->load->library('Accesscheck'); $this->accesscheck->check_access(); } @@ -183,6 +182,19 @@ class Information extends CI_Controller { if (in_array($this->config->item('site_code'), array('ah'))) { $this->config->set_item('templates', $this->config->item('templates_ah')); } + if (in_array($this->config->item('site_code'), array('pgr'))) { + $this->config->set_item('templates', $this->config->item('templates_pgr')); + } + if (in_array($this->config->item('site_code'), array('ts'))) { + $this->config->set_item('templates', $this->config->item('templates_ts')); + } + if (in_array($this->config->item('site_code'), array('cht'))) { + $this->config->set_item('templates', $this->config->item('templates_cht')); + } + if (in_array($this->config->item('site_code'), array('gm'))) { + $this->config->set_item('templates', $this->config->item('templates_gm')); + } + //信息区域类型 switch ($data['rootInformation']->ic_ht_area_type) { @@ -254,6 +266,26 @@ class Information extends CI_Controller { //所属导航栏目 $data['setting_website_nav'] = $this->InfoMetas_model->get_list(0, 'setting_website_nav_' . strtolower($this->config->item('site_code'))); + $data['my_tags'] = array(); + $data['all_tags'] = array(); + if (is_series_site()) { + //信息标签 + //$this->InfoTags_model->ic_id = null; + //$data['all_tags'] = $this->InfoTags_model->list_tag(); + //$this->InfoTags_model->ic_id = $data['information']->ic_id; + //$data['my_tags'] = $this->InfoTags_model->list_tag(); + //差集 + foreach ($data['all_tags'] as &$it) { + foreach ($data['my_tags'] as $it2) { + if ($it->it_id == $it2->icit_it_id) { + $it = null; + break; + } + } + } + $data['all_tags'] = array_filter($data['all_tags']); + } + $this->load->view('bootstrap3/header', $data); $this->load->view('bootstrap3/information_edit'); $this->load->view('bootstrap3/footer'); @@ -356,26 +388,31 @@ class Information extends CI_Controller { } else { $this->InfoContents_model->Update($information->is_ic_id, $this->input->post('ic_url'), $this->input->post('ic_url_title'), $this->input->post('ic_type'), $this->input->post('ic_title'), $this->input->post('ic_content'), $this->input->post('ic_summary'), $this->input->post('ic_seo_title'), $this->input->post('ic_seo_description'), $this->input->post('ic_seo_keywords'), $this->input->post('ic_show_bread_crumbs'), $this->input->post('ic_status'), $this->input->post('ic_template'), $this->input->post('ic_photo'), $this->input->post('ic_photo_width'), $this->input->post('ic_photo_height'), $this->input->post('ic_recommend_tours'), $this->input->post('ic_recommend_packages'), $this->input->post('ic_ht_area_id'), $this->input->post('ic_ht_area_type'), $this->input->post('ic_ht_product_id'), $this->input->post('ic_ht_product_type'), $this->input->post('ic_author')); - //收录查询,只在发布上线并且url不为空的时候检查 - $embody_url = $this->input->post('ic_url'); - $embody_url = trim($embody_url); - if ($this->input->post('ic_status') == 1 && $embody_url != '') { - $embody = $this->InfoMetas_model->get($information->is_ic_id, 'meta_embody'); - if (empty($embody)) { - $times = date('Y-m-d H:i:s'); - $this->InfoMetas_model->add($information->is_ic_id, 'meta_embody', $times); + //AMP更新和生成 beign + $auto_update_amp = $this->input->get_post('auto_update_amp'); + if (!empty($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) { + $amp_result=$this->amplib->auto_create($information->ic_id); + if (!empty($amp_result)) { + $amp_result = json_decode($amp_result); + if($amp_result->result=='ok'){ + $amp_save_result= $this->amplib->edit_save($information->ic_id,$amp_result->data->amp,'1'); + if(!empty($amp_save_result)){ + $amp_save_result = json_decode($amp_save_result); + if($amp_save_result->name=='no'){ + echo json_encode(array('name' => 'no', 'value' => 'AMP转换语法错误,请重新进入AMP编辑器检查')); + return; + } + } + } } } - + //AMP更新和生成 end //为新闻添加默认发布时间 - //if($information->ic_ht_area_type=='s' || $information->ic_type=='c_article') - //{ $meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate'); if (empty($meta_news_createdate)) { add_meta($information->ic_id, 'meta_news_createdate', date('m/d/Y', time())); } - //} - // if (is_series_site()) { + //如果URL有修改也删除静态文件 if ($this->input->post('ic_url') != $information->ic_url) { $this->update_cache($information->ic_url, true); @@ -390,11 +427,12 @@ class Information extends CI_Controller { $site_code = $this->config->item('site_code'); $ic_url = $this->input->post('ic_url'); $auto_update_cache = $this->input->get_post('auto_update_cache_checkbox'); - if ($site_code == 'gm' && substr($ic_url, 0, 5) == '/faq/') { + + if (strcasecmp($site_code, "gm") == 0 && !empty($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url, true); } else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url); - } else if (strcasecmp($site_code, "cht") != 0) {//非cht站点 + } else if (strcasecmp($site_code, "cht") != 0 && strcasecmp($site_code, "gm") != 0) {//非cht站点并且非GM $update_info_log = $this->update_cache($ic_url); } @@ -467,12 +505,20 @@ class Information extends CI_Controller { switch ($this->config->item('site_code')) { case 'cht': - $url = 'http://192.155.224.195:8080/guide-use.php/travelguide/guide/?static_html_url=' . $url; - if (strpos($url, '/festivals/') !== false || strpos($url, '/faq/') !== false) {//ch的部分控制器不是travelguide,所以不能统一更新和生产缓存文件,只能跳过,统一控制器再回头取消这个限制 - $url = 'http://www.chinahighlights.com/'; + $search_list = $this->Information_model->search_url($url); + $amp_request = FALSE; + foreach ($search_list as $key => $req_url) { + $meta_amp_status = get_meta($req_url->ic_id, 'AMP_STATUS'); + if ($meta_amp_status) { + $amp_request = TRUE; + } + } + if ($amp_request) { + $url = 'http://192.155.250.124:22224/ampreq' . $url; + } else { + $url = 'http://192.155.250.124:22224' . $url; } break; - case 'ah': if ($delete_only === true) { $url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url; @@ -486,8 +532,8 @@ class Information extends CI_Controller { if ($delete_only) { $url = "http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url); } else { - //先删除再生成,部分页面没有在信息平台中 - GET_HTTP("http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url)); + //先删除再生成,部分页面没有在信息平台中 + GET_HTTP("http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url)); $url = "http://144.76.185.44:8029" . $url; } break; @@ -506,11 +552,11 @@ class Information extends CI_Controller { //判断是否是更新信息 // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了 if (!empty($information->ic_content)) { + $url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; + } else { //先尝试删除静态文件。 $try_del = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url; file_get_contents($try_del); - $url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; - } else { $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url; } if (isset($information->ic_type) && $information->ic_type == 'product') { @@ -530,36 +576,19 @@ class Information extends CI_Controller { break; } - //关闭错误提示,防止file_get_contents请求特殊字符的时候会报错或者404、500,特殊字符需要用urlencode编码第一个/后面的url - //error_reporting(NULL); - //ini_set('display_errors', 'Off'); - $content = GET_HTTP($url); if ($content === false) { $data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_cache_failed'), $url)); } else { - //todo:如果请求正常,则判断返回的json是否正常 - //echo json_decode($content); - //CHT网站还需要更新前端服务器缓存 - if ($this->config->item('site_code') == 'cht') { - $url = 'http://www.chinahighlights.com/api/community/updatecache.asp?gurl=http://www.chinahighlights.com' . $original_url . '&other=1&site=info'; - $content = GET_HTTP($url); - if ($content === false) { - $data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_vps_failed'), $url)); - echo json_encode($data); - return false; - } - } - //手动更新的话,接着更新CDN缓存 $msg = $this->lang->line('update_cache_success'); if ($this->input->post('updatecdn') == 1) { $notice = $this->update_cdn(); if ($notice == 200) { - $msg.=$this->lang->line('update_cdn_success'); + $msg .= $this->lang->line('update_cdn_success'); } else { - $msg.=$this->lang->line('update_cdn_failed') . '