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') . '
' . $notice; + $msg .= $this->lang->line('update_cdn_failed') . '
' . $notice; } } $data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url); @@ -636,40 +665,6 @@ class Information extends CI_Controller { $this->load->view('bootstrap/footer'); } - //增加新景点到景点概述下 - //先找到当前城市的景点概述根节点,然后新增加 - //$lsi_sn 翰特景点id - function add_landscape($area_id, $lsi_sn) { - //获取景点概述节点 - $root_landscape = $this->Information_model->get_type_detail('c_attraction', 'c', $area_id); - - if ($root_landscape == FALSE) { - $data[] = array('name' => 'no', 'value' => $this->lang->line('root_landscape_notfound')); - echo json_encode($data); - return false; - } - - //获取景点详细内容 - $Landscape = $this->Landscape_model->get_detail($lsi_sn); - if ($root_landscape == FALSE) { - $data[] = array('name' => 'no', 'value' => $this->lang->line('landscape_notfound')); - echo json_encode($data); - return false; - } - - - //添加空内容 - $this->InfoContents_model->Add($Landscape->LSI2_Name, $Landscape->LSI2_Name, '', $Landscape->LSI2_Name, $Landscape->LSI2_ShortIntro, '', '', '', '', 0, 0, '', '', 0, 0, '', '', $area_id, 'c', $lsi_sn, 't', ''); - if ($this->InfoStructures_model->Add($root_landscape->is_id, $this->InfoContents_model->insert_id)) { - $data[] = array('name' => 'ok', 'value' => site_url('information/edit/' . $this->InfoStructures_model->insert_id)); - } else { - $data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error')); - } - echo json_encode($data); - $this->Logs_model->add($this->InfoStructures_model->insert_id); - return true; - } - //保存自定义配置 function save_meta() { $im_ic_id = $this->input->post('im_ic_id'); diff --git a/application/controllers/keyworlds.php b/application/controllers/keyworlds.php index 1c6706db..472f0b9b 100644 --- a/application/controllers/keyworlds.php +++ b/application/controllers/keyworlds.php @@ -46,7 +46,6 @@ class Keyworlds extends CI_Controller { //查询当前关键词的排名情况 $data['rank_json'] = ''; $data['current_keyworld'] = $this->Keywords_model->get_keyworld_bytreeid($kw_is_id); - //如果是根目录,则展示最新关键词排名变化情况 if ($root_key) { $data['compare_rank'] = $this->Keywords_model->get_compare_rank($data['order']); @@ -95,8 +94,6 @@ class Keyworlds extends CI_Controller { } } } -// print_r($data['wordcount']); -// print_r($rank_json); // 拼接highcharts数据格式 $data['rank_json'] = '['; foreach ($rank_json as &$ra) { @@ -104,15 +101,16 @@ class Keyworlds extends CI_Controller { // 每条线 $data['rank_json'] .='{"name":"' . $ra[$data_time[0]]->kw_keyworlds . '","data":['; // 每个点 + $tmp_rank = "null"; foreach ($ra as $v) { - $kwr_rank = $v->kwr_rank; - if ($v->kwr_rank == '>150') + $tmp_rank = trim($v->kwr_rank)=="" ? $tmp_rank : $v->kwr_rank; + // $kwr_rank = intval(trim($v->kwr_rank))>0 ? $v->kwr_rank : "null"; + $kwr_rank = ($v->kwr_rank==151) ? "null" : $tmp_rank; + // $kwr_rank = trim($kwr_rank)=="" ? "null" : $kwr_rank; + if ($v->kwr_rank == '>150') { $kwr_rank = 100; - if (strtolower($this->config->item('site_code')) == 'gm') { - $data['rank_json'] .=-$kwr_rank . ','; - } else { - $data['rank_json'] .=$kwr_rank . ','; } + $data['rank_json'] .=$kwr_rank . ','; } $data['rank_json'] = substr($data['rank_json'], 0, -1); $data['rank_json'] .=']},'; @@ -120,33 +118,31 @@ class Keyworlds extends CI_Controller { if ($data['wordcount'] == 1) { $data['rank_json'] .='{"name":"' . $ra[$data_time[0]]->kw_keyworlds . '(mobile)","data":['; foreach ($ra as $v) { - $kwr_mobile_rank = $v->kwr_mobile_rank ? $v->kwr_mobile_rank : 'null' ; - if ($v->kwr_mobile_rank == '>150') + $kwr_mobile_rank = (intval($v->kwr_mobile_rank) > 0) ? $v->kwr_mobile_rank : "null" ; + $kwr_mobile_rank = ($v->kwr_mobile_rank==151) ? "null" : $v->kwr_mobile_rank; + $kwr_mobile_rank = trim($kwr_mobile_rank)=="" ? "null" : $kwr_mobile_rank; + if ($v->kwr_mobile_rank == '>150') { $kwr_mobile_rank = 100; - if (strtolower($this->config->item('site_code')) == 'gm') { - $data['rank_json'] .=-$kwr_mobile_rank . ','; - } else { - $data['rank_json'] .=$kwr_mobile_rank . ','; } + $data['rank_json'] .= $kwr_mobile_rank . ','; } $data['rank_json'] = substr($data['rank_json'], 0, -1); $data['rank_json'] .=']},'; } } $data['rank_json'] = substr($data['rank_json'], 0, -1) . ']'; -// print_r($data['rank_json']); $data['data_time'] = json_encode($data_time); $data['rank_info'] = ''; isset($rank_json[$data['current_keyworld']->kw_id]) && $data['rank_info'] = $rank_json[$data['current_keyworld']->kw_id]; + if($data['wordcount'] == 1) { + arsort($data['rank_info']); + } } } else { redirect(site_url("Keyworlds/index")); } - // $data['analytics'] = $this->analytics_model->get_keyword_analytics($data['current_keyworld']->kw_keyworlds, 30); $data['site_code'] = strtolower($this->config->item('site_code')); -// print_r($data['rank_info']); -// print_r($data["rank_json"]); $this->load->view('bootstrap/header', $data); $this->load->view('keyworlds/index'); $this->load->view('bootstrap/footer'); @@ -285,26 +281,34 @@ class Keyworlds extends CI_Controller { $data[] = array('name' => 'rank', 'value' => '查询过于频繁,请等待三分钟!'); echo json_encode($data); return TRUE; - } else if (empty($last_rank[0]->kwr_mobile_rank) && - intval($last_rank[0]->kwr_datetime) > intval($today)) { + } + if ((intval($last_rank[0]->kwr_mobile_rank) == 0 || !isset($last_rank[0]->kwr_mobile_rank)) && + (intval($last_rank[0]->kwr_datetime) >= intval($today)) ) { $client_flag = 'm'; $rank_flag = 'rank_m'; $source_flag = 'source_m'; } + $today_0 = strtotime(date('Ymd000000')); + $today_24 = strtotime(date('Ymd235959')); + $last_rank_today = $this->Keywordsrank_model->get_rank_list($kw_id,1,$today_0,$today_24); + // $last_rank_today = $last_rank; + + $orignal = array(); //获取排名详细情况,排名超过150的停止搜索 for ($i = 1; $i <= 15; $i++) { $j = $i; $rank = $this->$method($client_flag, $keyworlds, $site_url, $j, $site_code); + $orignal[] = $rank['orignal']; // 仅更新一个字段 - if (intval($rank['rank']) == 0) { - $rank['rank'] = $last_rank[0]->kwr_rank; - $rank['source'] = $last_rank[0]->kwr_source; + if ($client_flag === 'm') { + $rank['rank'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_rank : null; + $rank['source'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_source : null; } else { - $rank['rank_m'] = null; - $rank['source_m'] = null; + $rank['rank_m'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_mobile_rank : null; + $rank['source_m'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_mobile_source : null; } - if ($rank[$rank_flag] != 0) { + if (intval($rank[$rank_flag]) != 0) { if ($rank[$rank_flag] > 150) $rank[$rank_flag] = '151'; break; @@ -315,46 +319,73 @@ class Keyworlds extends CI_Controller { break; } } + $data[] = array( + 'name' => 'rank', + 'value' => ($rank['rank'] . " / " . $rank["rank_m"]), + 'real' => $rank_flag . " : " . $rank[$rank_flag] + // ,'lastid' => $last_rank[0]->kwr_id . " / " . $last_rank_todaytmp[0]->kwr_id + // ,'tmp' => intval($last_rank[0]->kwr_datetime) . "-" . intval($today) . $client_flag + // ,'orignal' => $orignal + // ,"site" => $site_url + ); + if ($rank[$rank_flag] < 0) { + echo json_encode($data); + return false; + } //保存排名数据 - if ($rank[$rank_flag] == '151') { //超过151的排名则不记录 - $this->Keywords_model->update_time($kw_id); - } elseif (isset($last_rank[0]->kwr_datetime) and $last_rank[0]->kwr_datetime > strtotime(date('Y-m-d'))) { - if ($rank[$rank_flag] != -1 and $rank[$rank_flag] != -2 and $this->Keywordsrank_model->update_rank($last_rank[0]->kwr_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'])) { - $this->Keywords_model->update_time($kw_id); - } + if ( isset($last_rank_today[0]) && ! empty($last_rank_today[0])) { + $this->Keywordsrank_model->update_rank($last_rank_today[0]->kwr_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']); } else { - if ($rank[$rank_flag] != -1 and $rank[$rank_flag] != -2 and $this->Keywordsrank_model->add_rank($kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines'])) { - $this->Keywords_model->update_time($kw_id); + $add = $this->Keywordsrank_model->add_rank($kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']); + } + // rank 变化 + if ($client_flag === 'PC') { + $this->Keywords_model->update_time($kw_id); + $last_rank_pc = $this->Keywordsrank_model->get_last_pc_rank($kw_id, 2); + if (trim($last_rank_pc[1]->kwr_rank) != "") { + $this->load->model('InfoSMS_model'); + $last_rank_pc = isset($last_rank_pc[1]) ? $last_rank_pc[1]->kwr_rank : $rank['rank']; + $this->InfoSMS_model->readed_for_info($kw_id, 'keywords_rank'); + $this->InfoSMS_model->add('keywords_rank', $kw_id, $rank['rank'], $last_rank_pc, (string) ($rank['rank'] - $last_rank_pc)); } } - $data[] = array('name' => 'rank', 'value' => ($rank['rank'] . " -- " . $rank["rank_m"])); echo json_encode($data); return TRUE; } //自动爬取排名 - public function get_auto_rank($engines = '', $fix_site_code = '') { + public function get_auto_rank($engines = '', $fix_site_code = '', $client='PC') { set_time_limit(60); - $rank = array(); + $rank = array(); + $orignal = array(); + $worldsList = array(); $site_config = $this->config->item('site'); - $engines = trim($engines); + $engines = trim($engines); //取出需要更新排名的关键词 - $worldsList = $this->Keywords_model->get_keyworld_list(1, $engines, $fix_site_code); - //如果没有需要更新的则返回 - if (empty($worldsList)) { - echo 'all done'; - return; - } - $today = strtotime(date('Y-m-d')); - $client_flag = "PC"; - $rank_flag = 'rank'; - $source_flag = 'source'; - if (intval($worldsList[0]->kwr_datetime) >= intval($today) ) { + // 先取时间最久没更新的 + $today = strtotime(date('Y-m-d')); + $client_flag = $client ? $client : "PC"; + $rank_flag = 'rank'; + $source_flag = 'source'; + if ($client_flag == 'PC') { + $worldsList = $this->Keywords_model->get_keyworld_list_old(1, $engines, $fix_site_code); + } + if (empty($worldsList) || $client_flag === 'm') { + $worldsList = $this->Keywords_model->get_keyworld_list(1, $engines, $fix_site_code); + //如果没有需要更新的则返回 + if (empty($worldsList)) { + echo 'all done'; + return; + } $client_flag = "m"; $rank_flag = 'rank_m'; $source_flag = 'source_m'; } - $last_rank = $this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id); + + $today_0 = mktime(0,0,0,date("m"),(date("d")-$this->Keywords_model->catch_day), date("Y")); + $today_24 = strtotime(date('Ymd235959')); + $last_rank_today = $this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id,1,$today_0,$today_24); + // $last_rank_today = $last_rank_pc; //获取排名并保存 foreach ($worldsList as $v) { @@ -368,35 +399,48 @@ class Keyworlds extends CI_Controller { } else if ($engines == 'yandex') {//俄语站的yangdex $rank = $this->get_search_content_by_yandex($client_flag,$v->kw_keyworlds, $site_url, $i - 1); } - if (intval($rank['rank']) == 0) { - $rank['rank'] = $last_rank[0]->kwr_rank; - $rank['source'] = $last_rank[0]->kwr_source; + if ( $rank[$rank_flag] < 0 ) { + break; + } + $orignal[] = $rank['orignal']; + if ($client_flag === 'm') { + $rank['rank'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_rank : null; + $rank['source'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_source : null; } else { - $rank['rank_m'] = null; - $rank['source_m'] = null; + $rank['rank_m'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_mobile_rank : null; + $rank['source_m'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_mobile_source : null; } if ($rank[$rank_flag] != 0) { - if ($rank[$rank_flag] > 150) + if (intval($rank[$rank_flag]) > 150) $rank[$rank_flag] = '151'; break; }elseif ($i == 15) { $rank[$rank_flag] = '151'; + break; } elseif ($rank[$rank_flag] == -2) { break; } } - if ($rank[$rank_flag] == '151') { //超过151的排名则不记录 - $this->Keywords_model->update_time($v->kw_id); - }else if ($rank[$rank_flag] != -1 and $rank[$rank_flag] != -2 and $this->Keywordsrank_model->add_rank($v->kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines'])) { - $this->load->model('InfoSMS_model'); - $last_rank = isset($last_rank[0]) ? $last_rank[0]->kwr_rank : $rank['rank']; - $this->InfoSMS_model->readed_for_info($v->kw_id, 'keywords_rank'); - $this->InfoSMS_model->add('keywords_rank', $v->kw_id, $rank['rank'], $last_rank, (string) ($rank['rank'] - $last_rank)); - if ($engines != 'yandex') - $this->Keywords_model->update_time($v->kw_id); - } - } - var_dump($worldsList[0]->kw_keyworlds, $rank); + if (isset($last_rank_today[0]) && ! empty($last_rank_today[0])) { + $this->Keywordsrank_model->update_rank($last_rank_today[0]->kwr_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']); + } else { + $add = $this->Keywordsrank_model->add_rank($v->kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']); + } + // rank 变化 + if ($client_flag === 'PC') { + $this->Keywords_model->update_time($v->kw_id); + $last_rank_pc = $this->Keywordsrank_model->get_last_pc_rank($v->kw_id, 2); + if (trim($last_rank_pc[1]->kwr_rank) != "") { + $this->load->model('InfoSMS_model'); + $last_rank_pc = isset($last_rank_pc[1]) ? $last_rank_pc[1]->kwr_rank : $rank['rank']; + $this->InfoSMS_model->readed_for_info($v->kw_id, 'keywords_rank'); + $this->InfoSMS_model->add('keywords_rank', $v->kw_id, $rank['rank'], $last_rank_pc, (string) ($rank['rank'] - $last_rank_pc)); + } + } + } + var_dump("rank $client_flag " . $rank[$rank_flag]); + unset($rank['orignal']); + var_dump($worldsList[0]->kw_keyworlds, $rank, $orignal); } //计算关键词在google搜索引擎的排名 @@ -407,6 +451,7 @@ class Keyworlds extends CI_Controller { $rank['rank_m'] = 0; $rank['source_m'] = $site_url; $rank['engines'] = 'google'; + $rank["orignal"] = ''; if ($page > 3) { $rank['rank'] = 151; $rank['rank_m'] = 151; @@ -436,23 +481,26 @@ class Keyworlds extends CI_Controller { //抓取google搜索结果 $url = "https://www.$google_url/search?q=$search_worlds&start=$start&num=50&hl=$language"; - $match_fun = '/

(.*)<\/h3>/smUi'; + $match_fun = '/

(.*)<\/h3>/smUi'; $rank_flag = 'rank'; $source_flag = 'source'; if ($client_flag == 'm') { - $match_fun = '/curl($url,$client_flag); if ($response) { //分析google搜索结果,计算排名 - if (false !== stripos($response, '

302 Moved

')) { + if (false !== stripos($response, '

302 Moved

') || + false !== stripos($response, 'recaptcha') || false !== stripos($response, 'CAPTCHA')) { $rank['rank'] = -2; + $rank["orignal"] = $response; } elseif (false !== stripos($response, $site_url)) { preg_match_all($match_fun, $response, $store); foreach ($store[1] as $k => $v) { $ismatch = stripos($v, $site_url); + $ismatch = $ismatch ? $ismatch : stripos($v, addcslashes(addslashes($site_url), "/")); if (false !== $ismatch) { //计算排名 $rank[$rank_flag] = $start + $k + 1; @@ -465,9 +513,11 @@ class Keyworlds extends CI_Controller { } } } else { + $rank["orignal"] = $response; // log_message('error','google search response not found CH'); } } else { + $rank["orignal"] = $response; $rank[$rank_flag] = -1; } return $rank; @@ -502,7 +552,7 @@ class Keyworlds extends CI_Controller { $rank_flag = 'rank'; $source_flag = 'source'; if ($client_flag == 'm') { - $match_fun = '/
$v) { $start_s = stripos($v, $site_url); + $start_s = $start_s ? $start_s : stripos($v, addcslashes(addslashes($site_url), "/")); if (false !== $start_s) { $rank[$rank_flag] = $startrank + $k + 1; $end_s = stripos($v, '" ', $start_s); @@ -671,4 +722,41 @@ class Keyworlds extends CI_Controller { return $reponse; } + public function testrank($kw_is_id=0, $top=1) + { + $data['current_keyworld'] = $this->Keywords_model->get_keyworld_bytreeid($kw_is_id); + $is_id_string = $data['current_keyworld']->kw_id; + $rank_info = $this->Keywordsrank_model->get_rank_list($is_id_string, $top); + foreach ($rank_info as $key => &$value) { + $value['ddd'] = date('Y-m-d H:i:s', $value->kwr_datetime); + } + var_dump($rank_info); + } + + public function testpc() + { + $last_rank_pc = $this->Keywordsrank_model->get_last_pc_rank('297'); + var_dump($last_rank_pc); + var_dump($last_rank_pc[0]->kwr_rank); + var_dump(trim($last_rank_pc[0]->kwr_rank)); + } + + public function test_next($fix_site_code='', $client_flag = 'PC') + { + if ($client_flag == 'PC') { + $worldsList = $this->Keywords_model->get_keyworld_list_old(1, 'en', $fix_site_code); + } + if (empty($worldsList) || $client_flag === 'm') { + $worldsList = $this->Keywords_model->get_keyworld_list(1, 'en', $fix_site_code); + // 如果没有需要更新的则返回 + if (empty($worldsList)) { + echo 'all done'; + return; + } + $client_flag = "m"; + } + var_dump($client_flag); + var_dump($worldsList); + } + } diff --git a/application/controllers/look_order.php b/application/controllers/look_order.php index 39aabc63..c85e926f 100644 --- a/application/controllers/look_order.php +++ b/application/controllers/look_order.php @@ -34,7 +34,9 @@ class Look_order extends CI_Controller { //显示订单数量,如果大于阈值就显示错误 public function status() { $data = array(); - $data['tour_count'] = $this->Orders_model->tour_count(); + $tour_count = $this->Orders_model->tour_count(); + $biz_count = $this->Orders_model->biz_count(); + $data['tour_count'] = $tour_count + $biz_count; if ($data['tour_count'] >= 550) { $this->output->set_status_header(500); } diff --git a/application/controllers/payment.php b/application/controllers/payment.php index 03d89f0d..cdced964 100644 --- a/application/controllers/payment.php +++ b/application/controllers/payment.php @@ -16,8 +16,7 @@ class Payment extends CI_Controller { $data=array(); if ($this->input->post('price')) { - $data['payurl']=' - load->model('Area_model'); $this->load->model('InfoStructures_model'); $this->load->model('Information_model'); + $this->load->model('InfoMetas_model'); $this->site_code = $this->config->item('site_code'); } @@ -52,6 +53,29 @@ class Tools extends CI_Controller $this->load->view('tools/old', $data); } } + + /** + * + * 公有函数:AMP转化表格。 + * + * 必要参数: + * @param String $site_code + * + */ + public function amp_check() + { + $data['amp'] = $this->input->get_post('amp'); + if (!$data['amp']) $data['amp'] = 'yes'; + //AMP转化列表 + if ($data['amp'] == 'yes') { + $data['info'] = $this->InfoMetas_model->list_amp($this->site_code); + } else { + $data['info'] = $this->InfoMetas_model->list_no_amp($this->site_code); + } + + //视图 + $this->load->view('tools/amp_check', $data); + } /** * 导出CSV文件 diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php index e6ec9bc6..75659070 100644 --- a/application/controllers/welcome.php +++ b/application/controllers/welcome.php @@ -25,6 +25,10 @@ class Welcome extends CI_Controller { $data['lastEditList'] = $this->Information_model->get_last_edit_list(); $data['last_city_list'] = $this->Area_model->get_last_edit_city(); + if ($this->config->item('site_code') == 'pgr') { + $data['countryList'] = $this->Area_model->get_country_list_for_site("'589','645','632','517','31','28','609','630','9','708','709'"); + } + $this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/welcome'); $this->load->view('bootstrap/footer'); @@ -61,29 +65,24 @@ class Welcome extends CI_Controller { $this->load->view('bootstrap/footer'); } - //获取所有信息+产品url - public function create_all_urls() { + //获取所有信息URL,用来批量静态化更新 + public function create_all_urls($view=false) { set_time_limit(0); $this->output->enable_profiler(false); - $this->Information_model->topNum = false; - $data['all_information'] = $this->Information_model->GetList('ic_status,ic_url,ic_sitecode'); - //系列站产品连接 - $site_code = strtoupper($this->config->item('site_code')); - if (!empty($site_code)) { - $this->load->helper('file'); - $path = APPPATH . '/views/product_urls/updateCache' . $site_code . '.txt'; - if (file_exists($path)) { - $data['product_urls'] = read_file($path); - $domain = $this->config->item('site_url'); - $data['product_urls'] = str_replace("\n", '
', $data['product_urls']); - $data['product_urls'] = str_replace($domain, $domain . '/index.php/welcome/update_cache/?static_html_url=', $data['product_urls']); - } + $data['all_information'] = $this->Information_model->GetList('ic_status,ic_id,ic_url,ic_sitecode,is_id'); + if ($view == 'amp') { + $this->load->view('bootstrap3/header', $data); + $this->load->view('bootstrap3/refresh_amp_urls'); + $this->load->view('bootstrap3/footer'); + } else { + $this->load->view('bootstrap/header', $data); + $this->load->view('bootstrap/cache_url', $data); + $this->load->view('bootstrap/footer'); } - $this->load->view('none_urls', $data); } //获取某个信息节点和子节点url - public function create_infomation_urls($is_parent_id) { + public function create_infomation_urls($is_parent_id, $view = false) { $this->output->enable_profiler(FALSE); $structure = $this->InfoStructures_model->Detail($is_parent_id); if (empty($structure)) { @@ -91,9 +90,15 @@ class Welcome extends CI_Controller { return false; } $data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path); - $this->load->view('bootstrap/header', $data); - $this->load->view('bootstrap/cache_url', $data); - $this->load->view('bootstrap/footer'); + if ($view == 'amp') { + $this->load->view('bootstrap3/header', $data); + $this->load->view('bootstrap3/refresh_amp_urls'); + $this->load->view('bootstrap3/footer'); + } else { + $this->load->view('bootstrap/header', $data); + $this->load->view('bootstrap/cache_url', $data); + $this->load->view('bootstrap/footer'); + } } public function get_infomation_urls($is_parent_id) { @@ -114,37 +119,37 @@ class Welcome extends CI_Controller { $last_backup = $this->Logs_model->get_last_backup($info_id); if (empty($last_backup)) { $this->echo_json(array( - 'status' => 'error', - 'logId' => 0, - 'datetime' => 0, - 'username' => 0 - )); + 'status' => 'error', + 'logId' => 0, + 'datetime' => 0, + 'username' => 0 + )); } else { $this->echo_json(array( - 'status' => 'success', - 'logId' => $last_backup->log_id, - 'datetime' => $last_backup->log_datetime, - 'username' => $last_backup->log_ht_username - )); + 'status' => 'success', + 'logId' => $last_backup->log_id, + 'datetime' => $last_backup->log_datetime, + 'username' => $last_backup->log_ht_username + )); } } public function change_static_url($info_id) { $information = $this->Information_model->Detail($info_id); $htm_doc = new DOMDocument(); - $htm_doc->encoding='UTF-8'; + $htm_doc->encoding = 'UTF-8'; libxml_use_internal_errors(true); $htm_doc->strictErrorChecking = false; if (empty($information->ic_content)) { $this->echo_json(array( - 'status' => 'error', - 'infoId' => $info_id, - 'message' => 'info content is empty' - )); + 'status' => 'error', + 'infoId' => $info_id, + 'message' => 'info content is empty' + )); return; } $htm_doc->loadHTML( - mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8')); + mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8')); $htm_doc->normalizeDocument(); $img_list = $htm_doc->getElementsByTagName('img'); foreach ($img_list as $img) { @@ -153,87 +158,166 @@ class Welcome extends CI_Controller { $img->setAttribute('src', $img_src); } - $information->ic_content = $htm_doc->saveHTML(); - $this->InfoContents_model->Update( - $information->ic_id, - $information->ic_url, - $information->ic_url_title, - $information->ic_type, - $information->ic_title, - $information->ic_content, - $information->ic_summary, - $information->ic_seo_title, - $information->ic_seo_description, - $information->ic_seo_keywords, - $information->ic_show_bread_crumbs, - $information->ic_status, - $information->ic_template, - $information->ic_photo, - $information->ic_photo_width, - $information->ic_photo_height, - $information->ic_recommend_tours, - $information->ic_recommend_packages, - $information->ic_ht_area_id, - $information->ic_ht_area_type, - $information->ic_ht_product_id, - $information->ic_ht_product_type, - $information->ic_author); - - $this->echo_json(array( - 'status' => 'ok', - 'infoId' => $info_id, - 'message' => 'success', - 'date' => date('Y-m-d h:i:s') - )); + $anchor_list = $htm_doc->getElementsByTagName('a'); + foreach ($anchor_list as $anchor) { + $a_href = $anchor->getAttribute('href'); + echo 'a.href: ' . $a_href . '
'; + + $match_result = array(); + preg_match('/^http:\/\/www.chinahighlights.com(.*)/', $a_href, $match_result); + $result_count = count($match_result); + if ($result_count == 2) { + $result = '//www.chinahighlights.com' . $match_result[1]; + $anchor->setAttribute('href', $result); + echo $result . '
'; + } + } + + // $information->ic_content = $htm_doc->saveHTML(); + // $this->InfoContents_model->Update( + // $information->ic_id, + // $information->ic_url, + // $information->ic_url_title, + // $information->ic_type, + // $information->ic_title, + // $information->ic_content, + // $information->ic_summary, + // $information->ic_seo_title, + // $information->ic_seo_description, + // $information->ic_seo_keywords, + // $information->ic_show_bread_crumbs, + // $information->ic_status, + // $information->ic_template, + // $information->ic_photo, + // $information->ic_photo_width, + // $information->ic_photo_height, + // $information->ic_recommend_tours, + // $information->ic_recommend_packages, + // $information->ic_ht_area_id, + // $information->ic_ht_area_type, + // $information->ic_ht_product_id, + // $information->ic_ht_product_type, + // $information->ic_author); + // $this->echo_json(array( + // 'status' => 'ok', + // 'infoId' => $info_id, + // 'message' => 'success', + // 'date' => date('Y-m-d h:i:s') + // )); + } + + public function count_redirect_nofollow() { + $include_redirece_info = $this->Information_model->search_all_text('&t=78002', 2000); + echo 'redirect count: ' . count($include_redirece_info) . '
'; + $redirect_nofollow_list = array(); + $htm_doc = new DOMDocument(); + $htm_doc->encoding = 'UTF-8'; + libxml_use_internal_errors(true); + $htm_doc->strictErrorChecking = false; + foreach ($include_redirece_info as $info) { + $htm_doc->loadHTML( + mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8')); + $htm_doc->normalizeDocument(); + $anchor_list = $htm_doc->getElementsByTagName('a'); + foreach ($anchor_list as $anchor) { + $a_href = $anchor->getAttribute('href'); + $a_rel = $anchor->getAttribute('rel'); + + $match_result = array(); + preg_match('/.*&t=78002$/', $a_href, $match_result); + $result_count = count($match_result); + if ($result_count > 0 && $a_rel != 'nofollow') { + echo $info->ic_url . ' | ' . '(' . $info->ic_id . ',' . $info->is_id . ')' . '
'; + echo 'a.href: ' . $a_href . '; rel: ' . $a_rel . '
'; + $redirect_nofollow_list[] = $info; + } + } + } + echo 'nofollow_count: ' . count($redirect_nofollow_list) . '
'; + return $redirect_nofollow_list; + } + + public function transform_redirect_nofollow() { + $redirect_nofollow_list = $this->count_redirect_nofollow(); + $htm_doc = new DOMDocument(); + $htm_doc->encoding = 'UTF-8'; + libxml_use_internal_errors(true); + $htm_doc->strictErrorChecking = false; + + foreach ($redirect_nofollow_list as $info) { + $htm_doc->loadHTML( + mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8')); + $htm_doc->normalizeDocument(); + $anchor_list = $htm_doc->getElementsByTagName('a'); + foreach ($anchor_list as $anchor) { + $a_rel = $anchor->getAttribute('rel'); + $anchor->setAttribute('rel', 'nofollow'); + $this->Logs_model->backup($info->is_id, $info->ic_content); + $info->ic_content = $htm_doc->saveHTML(); + $this->InfoContents_model->Update( + $info->ic_id, $info->ic_url, $info->ic_url_title, $info->ic_type, $info->ic_title, $info->ic_content, $info->ic_summary, $info->ic_seo_title, $info->ic_seo_description, $info->ic_seo_keywords, $info->ic_show_bread_crumbs, $info->ic_status, $info->ic_template, $info->ic_photo, $info->ic_photo_width, $info->ic_photo_height, $info->ic_recommend_tours, $info->ic_recommend_packages, $info->ic_ht_area_id, $info->ic_ht_area_type, $info->ic_ht_product_id, $info->ic_ht_product_type, $info->ic_author); + } + } + + echo 'update_nofollow_count: ' . count($redirect_nofollow_list) . '
'; + } + + public function count_http_of_href() { + $data['all_information'] = $this->Information_model->search_all_text('http://www.chinahighlights.com/', 2000); + echo 'count: ' . count($data['all_information']) . '
'; + var_dump($data['all_information']); + } + + public function transform_href_to_https() { + $http_host = 'http://www.chinahighlights.com/'; + $https_host = 'https://www.chinahighlights.com/'; + $data['all_information'] = $this->Information_model->search_all_text($http_host, 200); + echo 'count: ' . count($data['all_information']) . '
'; + if (empty($data['all_information'])) { + echo 'nothing transform to https'; + } else { + foreach ($data['all_information'] as $item) { + + if (empty($item->ic_url)) { + echo '[' . $item->ic_title . '] [' . $item->ic_url . ']
'; + continue; + } else { + echo $item->ic_url . ' | ' . $item->ic_title . '
'; + } + + $this->Logs_model->backup($item->is_id, $item->ic_content); + $item->ic_content = str_replace($http_host, $https_host, $item->ic_content); + $this->InfoContents_model->Update( + $item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author + ); + } + } } private function echo_json($obj) { $this->output - ->set_content_type('application/json') - ->set_output(json_encode($obj)); + ->set_content_type('application/json') + ->set_output(json_encode($obj)); + } + + //批量替换二级域名,如图片或者data域名 + function replace_hostname($topnum) { + $data = array(); + $find_host = 'http://data.chinarundreisen.com/'; //http://bilder.chinarundreisen.com/ + $new_host = '//data.chinarundreisen.com/'; + $data['all_information'] = $this->Information_model->search_all_text($find_host, $topnum); + if ($data['all_information']) { + foreach ($data['all_information'] as $item) { + echo $item->ic_url . '
'; + $item->ic_content = str_replace($find_host, $new_host, $item->ic_content); + $this->InfoContents_model->Update( + $item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author + ); + } + } else { + echo 'all done'; + } } - - - //批量替换二级域名,如图片或者data域名 - function replace_hostname($topnum){ - $data=array(); - $find_host='http://data.chinarundreisen.com/'; //http://bilder.chinarundreisen.com/ - $new_host='//data.chinarundreisen.com/'; - $data['all_information'] = $this->Information_model->search_all_text($find_host,$topnum); - if($data['all_information']){ - foreach($data['all_information'] as $item){ - echo $item->ic_url.'
'; - $item->ic_content=str_replace($find_host, $new_host,$item->ic_content); - $this->InfoContents_model->Update( - $item->ic_id, - $item->ic_url, - $item->ic_url_title, - $item->ic_type, - $item->ic_title, - $item->ic_content, - $item->ic_summary, - $item->ic_seo_title, - $item->ic_seo_description, - $item->ic_seo_keywords, - $item->ic_show_bread_crumbs, - $item->ic_status, - $item->ic_template, - $item->ic_photo, - $item->ic_photo_width, - $item->ic_photo_height, - $item->ic_recommend_tours, - $item->ic_recommend_packages, - $item->ic_ht_area_id, - $item->ic_ht_area_type, - $item->ic_ht_product_id, - $item->ic_ht_product_type, - $item->ic_author - ); - } - }else{ - echo 'all done'; - } - } private function check_url($subject) { $result = $subject; @@ -257,7 +341,7 @@ class Welcome extends CI_Controller { preg_match($pattern, $subject, $match_result); $result_count = count($match_result); if ($result_count == 2) { - $result = $replace.$match_result[1]; + $result = $replace . $match_result[1]; } return $result; } @@ -278,7 +362,7 @@ class Welcome extends CI_Controller { $parent_path = str_replace('-', ',', $parent_path); $parent_path = trim($parent_path, ','); if ($parent_path != '') - $parent_path.=','; + $parent_path .= ','; $this->load->model('Import_model'); $this->Import_model->set_path($is_id, $parent_path); echo 'ok'; diff --git a/application/controllers/zodiac.php b/application/controllers/zodiac.php new file mode 100644 index 00000000..08b2f319 --- /dev/null +++ b/application/controllers/zodiac.php @@ -0,0 +1,42 @@ +load->model('LunarNewYear_model'); + } + + public function index($z='rat') + { + $this->edit_zodiac(mb_strtolower($z)); + } + + public function edit_zodiac($z='rat') + { + $data['nav_active'] = $data["current_zodiac"] = mb_strtolower($z); + $data["zodiac_fortune"] = $this->LunarNewYear_model->get_zodiac($data["current_zodiac"]); + // 预览编辑的问题 + if (substr($data["zodiac_fortune"]->TheYearFortune, 0, 4) !== 'TheYearFortune = "
" . $data["zodiac_fortune"]->TheYearFortune . "
"; + } + $this->load->view('bootstrap/header', $data); + $this->load->view('bootstrap/zodiac/edit',$data); + } + + public function fortune_save() + { + $this->LunarNewYear_model->LNY_SX = trim($this->input->post("sx")); + $this->LunarNewYear_model->LNY_LuckyNumber = trim($this->input->post("lucky_num")); + $this->LunarNewYear_model->LNY_LuckyColor = trim($this->input->post("lucky_color")); + $this->LunarNewYear_model->LNY_LuckyFlower = trim($this->input->post("lucky_flo")); + $this->LunarNewYear_model->TheYearFortune = trim($this->input->post("theyearfortune")); + $this->LunarNewYear_model->theyearfortune_save(); + $ret = array("name"=>"ok"); + $this->output->set_content_type('application/json')->set_output(json_encode($ret)); + } + +} diff --git a/application/helpers/info_helper.php b/application/helpers/info_helper.php index 99909ace..06cb3f44 100644 --- a/application/helpers/info_helper.php +++ b/application/helpers/info_helper.php @@ -312,6 +312,11 @@ function get_content_by_url($url) { curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 $tmpInfo = curl_exec($curl); // 执行操作 + $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + if($httpCode>=400){//页面状态,如果大于400说明页面打不开 + log_message('error', " curl {$httpCode} {$url} "); + return false; + } $errno = curl_errno($curl); if ($errno !== 0) { return false; diff --git a/application/language/english/form_validation_lang.php b/application/language/english/form_validation_lang.php index 7a8af386..8dfc28cf 100644 --- a/application/language/english/form_validation_lang.php +++ b/application/language/english/form_validation_lang.php @@ -82,17 +82,17 @@ $lang['send_sms_success'] = '发送短消息成功!'; $lang['author_email_new_task_subject'] = 'New Task,%s'; -$lang['author_email_new_task_body'] = 'You have a new task on the China Highlights Content Management System. Please log in at
http://a.cdnch.com/author.php'; -$lang['author_email_new_task_body2'] = 'There is a new task on the China Highlights Content Management System. Click “Accept” before someone else does if you want it! Please log in at a.cdnch.com (if the task is not in the Task Hall, someone else has already taken it).'; +$lang['author_email_new_task_body'] = 'You have a new task on the China Highlights Content Management System. Please log in at http://author.mycht.cn/author.php'; +$lang['author_email_new_task_body2'] = 'There is a new task on the China Highlights Content Management System. Click “Accept” before someone else does if you want it! Please log in at author.mycht.cn (if the task is not in the Task Hall, someone else has already taken it).'; $lang['author_email_review_task_failed_subject'] = 'Revision Required,%s'; -$lang['author_email_review_task_failed_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and requires revision. Please log in at http://a.cdnch.com/author.php'; +$lang['author_email_review_task_failed_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and requires revision. Please log in at http://author.mycht.cn/author.php'; $lang['author_email_review_task_success_subject'] = 'Submission Accepted,%s'; -$lang['author_email_review_task_success_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and accepted. See http://a.cdnch.com/author.php'; +$lang['author_email_review_task_success_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and accepted. See http://author.mycht.cn/author.php'; $lang['author_email_message_subject'] = 'Message,%s'; -$lang['author_email_message_body'] = 'You have a new message on the China Highlights Content Management System. Please log in at http://a.cdnch.com/author.php'; +$lang['author_email_message_body'] = 'You have a new message on the China Highlights Content Management System. Please log in at http://author.mycht.cn/author.php'; //关键词管理 $lang['form_keyworlds_success'] = '关键词编辑成功!'; diff --git a/application/libraries/Amplib.php b/application/libraries/Amplib.php new file mode 100644 index 00000000..5630d27b --- /dev/null +++ b/application/libraries/Amplib.php @@ -0,0 +1,122 @@ +CI = & get_instance(); + $this->CI->load->model('Information_model'); + $this->CI->load->model('InfoMetas_model'); + } + + public function edit($ic_id) { + $data = array(); + $data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id); + if ($data['information'] == FALSE) { + show_404(); + } + $this->CI->load->view('bootstrap3/header', $data); + $this->CI->load->view('amp_editor'); + $this->CI->load->view('bootstrap3/footer'); + } + + public function auto_create($ic_id) { + $data = array(); + $data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id); + if ($data['information'] == FALSE) { + return json_encode(array('result' => 'no', 'data' => '找不到这个页面')); + } + + //144.76.185.44:8029 + //根据站点不同,配置不同参数 + $site_code = strtolower($this->CI->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->CI->config->item('site_url'); + $html_source_url = $this->CI->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); + return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST'); + } + return json_encode(array('result' => 'no', 'data' => '不知道哪里错了,看代码')); + } + + public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false) { + $data = array(); + if ($ic_id === false) { + $ic_id = $this->CI->input->post('ic_id'); + } + if ($textarea_htmlcode === false) { + $textarea_htmlcode = $this->CI->input->post('textarea_htmlcode'); + } + if ($amp_status === false) { + $amp_status = $this->CI->input->post('amp_status'); + } + $data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id); + + if ($data['information'] == FALSE) { + show_404(); + } + + //CH的页面没有canonical内容,在这里帮补上 + $textarea_htmlcode = str_replace('', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode); + + //AMP格式验证 + if ($amp_status !== '0') {//只有发布的时候才需要验证 + //把AMP网页内容到purifycss处理,内置了AMP-Validator + $purifycss_server = 'http://184.172.113.216:33033/'; + if ($this->CI->config->item('site_code' == 'gm')) {//德语站点使用自己的css处理服务器 + $purifycss_server = 'http://158.177.67.52:33033/'; + } + $validator_result = GET_HTTP($purifycss_server, 'amp_source=' . urlencode($textarea_htmlcode), 'POST'); + $validator_result = json_decode($validator_result); + if ($validator_result->status == 'FAIL') { + return json_encode(array('name' => 'no', 'value' => $validator_result->errors)); + } + } + $amp = $this->CI->InfoMetas_model->get($ic_id, 'AMP'); + if ($amp === false) { + $this->CI->InfoMetas_model->add($ic_id, 'AMP', $textarea_htmlcode); + } else { + $this->CI->InfoMetas_model->update($ic_id, 'AMP', $textarea_htmlcode); + } + + $amp_status_value = $this->CI->InfoMetas_model->get($ic_id, 'AMP_STATUS'); + if ($amp_status_value === false) { + $this->CI->InfoMetas_model->add($ic_id, 'AMP_STATUS', $amp_status); + } else { + $this->CI->InfoMetas_model->update($ic_id, 'AMP_STATUS', $amp_status); + } + + return json_encode(array('name' => 'ok', 'value' => $this->CI->lang->line('form_info_success'))); + } + +} diff --git a/application/models/LunarNewYear_model.php b/application/models/LunarNewYear_model.php new file mode 100644 index 00000000..dad0fd5d --- /dev/null +++ b/application/models/LunarNewYear_model.php @@ -0,0 +1,48 @@ +HT = $this->load->database('HT', TRUE); + } + + public function get_zodiac($zodiac = 'rat') + { + $sql = "SELECT TOP 1 LNY_SN , + LNY_SX , + LNY_LuckyNumber , + LNY_LuckyColor , + LNY_LuckyFlower , + TheYearFortune + FROM LunarNewYear + WHERE LOWER(LNY_SX)='$zodiac'"; + $query = $this->HT->query($sql); + return $query->row(); + } + + public function theyearfortune_save() + { + $sql = "UPDATE LunarNewYear + SET LNY_LuckyNumber = ?, + LNY_LuckyColor = ?, + LNY_LuckyFlower = ?, + TheYearFortune = ? + WHERE LOWER(LNY_SX) = ?"; + $query = $this->HT->query($sql, array( + $this->LNY_LuckyNumber, + $this->LNY_LuckyColor, + $this->LNY_LuckyFlower, + $this->TheYearFortune, + $this->LNY_SX + )); + return $query; + } + +} diff --git a/application/models/area_model.php b/application/models/area_model.php index d205a6ce..79d52e69 100644 --- a/application/models/area_model.php +++ b/application/models/area_model.php @@ -37,7 +37,7 @@ class Area_model extends CI_Model return FALSE; } } - + function get_city_list($PRI_SN) { @@ -58,7 +58,7 @@ class Area_model extends CI_Model $query = $this->HT->query($sql, array($this->config->item('site_lgc'), $PRI_SN)); return $query->result(); } - + //获取直辖市和特区列表 function get_municipalities_list() { @@ -142,7 +142,18 @@ class Area_model extends CI_Model . "FROM COuntryInfo ci \n" . " INNER JOIN COuntryInfo2 ci2 ON ci2.COI2_COI_SN = ci.COI_SN \n" . "WHERE ci2.COI2_LGC = ? \n" - . " AND ci.COI_SN in(1,19, 27, 28, 29, 30, 31, 35, 591)"; + . " AND ci.COI_SN in(1, 19, 22, 24, 27, 28, 29, 30, 31, 35, 591)"; + $query = $this->HT->query($sql, array($this->config->item('site_lgc'))); + return $query->result(); + } + function get_country_list_for_site($country_list) + { + $sql = "SELECT ci.COI_SN, \n" + . " ci2.COI2_Country \n" + . "FROM COuntryInfo ci \n" + . " INNER JOIN COuntryInfo2 ci2 ON ci2.COI2_COI_SN = ci.COI_SN \n" + . "WHERE ci2.COI2_LGC = ? \n" + . " AND ci.COI_SN in($country_list)"; $query = $this->HT->query($sql, array($this->config->item('site_lgc'))); return $query->result(); } @@ -169,13 +180,13 @@ class Area_model extends CI_Model case 's'://大洲 break; case 'z'://公民游 - break; + break; default: break; } return false; } - + //获取最后编辑信息的50个城市 function get_last_edit_city() { @@ -194,4 +205,4 @@ class Area_model extends CI_Model return $query->result(); } -} \ No newline at end of file +} diff --git a/application/models/infoContents_model.php b/application/models/infoContents_model.php index 7e6b3e64..5f99c142 100644 --- a/application/models/infoContents_model.php +++ b/application/models/infoContents_model.php @@ -124,6 +124,21 @@ class InfoContents_model extends CI_Model } } + public function get_ic_contents2($ic_id) + { + $sql="SELECT top 1 ic_id, ic_content, ic_title, ic_url, ic_photo, ic_sitecode, ic_seo_description from infoContents where ic_id=?"; + $query=$this->HT->query($sql,array($ic_id)); + if ($query->result()) + { + $row = $query->row(); + return $row; + } + else + { + return FALSE; + } + } + public function get_ic_contents_by_list($ic_id_list) { $ic_id_list=trim($ic_id_list); diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php index 1010b214..69cb2843 100644 --- a/application/models/infoMetas_model.php +++ b/application/models/infoMetas_model.php @@ -33,6 +33,101 @@ class InfoMetas_model extends CI_Model { $query = $this->HT->query($sql, array($im_ic_id, $im_key)); return $query->result(); } + + function get_list_by_key($im_key) { + $sql = " + SELECT im.im_id + ,im.im_ic_id + ,im.im_key + ,im.im_value + FROM infoMetas im + WHERE im.im_ic_id = ? + AND im.im_key = ? + ORDER BY im.im_id ASC + "; + $query = $this->HT->query($sql, array($im_ic_id, $im_key)); + return $query->result(); + } + + //列表所有含AMPmeta的信息。 + public function list_amp($site_code) { + $sql = " + SELECT im.im_id + ,im.im_ic_id + ,c.ic_url + ,c.ic_id + FROM infoMetas im + INNER JOIN infoContents c + ON c.ic_id = im.im_ic_id + LEFT JOIN infoMetas im2 + ON im2.im_ic_id = im.im_ic_id AND im2.im_key = 'AMP_STATUS' + LEFT JOIN infoMetas im3 + ON im3.im_ic_id = im.im_ic_id AND im2.im_key = 'AMP_SCHEMA' + WHERE im.im_key = 'AMP_JSON' + AND c.ic_sitecode = ? + AND c.ic_status = 1 + AND CONVERT(varchar, im2.im_value) = '1' + "; + $query = $this->HT->query($sql, array($site_code)); + return $query->result(); + } + + //列表所有不含AMPmeta的信息。 + public function list_no_amp($site_code) { + $sql = " + SELECT c0.ic_id, c0.ic_url + FROM infoContents c0 + WHERE c0.ic_id not in ( + SELECT c.ic_id + FROM infoMetas im + LEFT JOIN infoContents c + ON c.ic_id = im.im_ic_id + LEFT JOIN infoMetas im2 + ON im2.im_ic_id = im.im_ic_id AND im2.im_key = 'AMP_STATUS' + LEFT JOIN infoMetas im3 + ON im3.im_ic_id = im.im_ic_id AND im2.im_key = 'AMP_SCHEMA' + WHERE im.im_key = 'AMP_JSON' + AND c.ic_sitecode = ? + AND c.ic_status = 1 + AND CONVERT(varchar, im2.im_value) = '1' + ) + AND c0.ic_sitecode = ? + AND c0.ic_status = 1 + AND c0.ic_url <> '' + AND datalength(c0.ic_content) > 0 + AND CHARINDEX('search', c0.ic_url) = 0 + AND CHARINDEX('faq', c0.ic_url) = 0 + AND CHARINDEX('feedback', c0.ic_url) = 0 + AND CHARINDEX('test', c0.ic_url) = 0 + "; + $query = $this->HT->query($sql, array($site_code, $site_code)); + return $query->result(); + } + + //按节点列表信息(含meta数据) + function list_info_by_path_with_meta($is_path, $site_code) { + $sql = "SELECT is1.is_id, \n" + . " is1.is_path, \n" + . " ic.ic_id, \n" + . " ic.ic_url, \n" + . " ic.ic_status, \n" + . " ic.ic_template, \n" + . " ic.ic_sitecode, \n" + . " ic.ic_content, \n" + . " ic.ic_photo, \n" + . " ic.ic_title, \n" + . " ic.ic_type, \n" + . " im.im_id \n" + . " FROM infoStructures is1 \n" + . " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n" + . " AND ic.ic_sitecode = is1.is_sitecode \n" + . " LEFT JOIN infoMetas im ON im.im_ic_id = ic.ic_id AND im.im_key=?" + . " WHERE is1.is_path LIKE '$is_path%' AND is_sitecode = ? AND ic_status = 1" + . " ORDER BY is1.is_level, is1.is_sort, is1.is_path"; + $query = $this->HT->query($sql, array('AMP_JSON', $site_code)); + //print_r($this->HT->queries); + return $query->result(); + } function get($im_ic_id, $im_key) { $sql = "SELECT im.im_value \n" diff --git a/application/models/infoTags_model.php b/application/models/infoTags_model.php new file mode 100644 index 00000000..6f6e2208 --- /dev/null +++ b/application/models/infoTags_model.php @@ -0,0 +1,122 @@ +HT = $this->load->database('HT', TRUE); + } + + /** + * 增加标签 + */ + function add_tag() + { + if ($this->it_title) + { + //查看是否已存在标签 + $sql = "SELECT TOP 1 * from infoTags WHERE it_title = N?"; + $check = $this->HT->query($sql, array($this->it_title)); + + //添加标签 + if ($check->num_rows() === 0) + { + $sql = "INSERT INTO infoTags (it_title, it_memo) VALUES (N?, N?)"; + $query = $this->HT->query($sql, array($this->it_title, $this->it_memo)); + return $this->HT->insert_id(); + } + else + { + $row = $check->row(); + return $row->it_id; + } + + } + return FALSE; + } + + /** + * 删除标签 + */ + function remove_tag() + { + if ($this->it_title) + { + $sql = "DELETE FROM infoTags WHERE it_title = N?"; + $query = $this->HT->query($sql, array($this->it_title)); + return 'success'; + } + return 'fail'; + } + + /** + * 标签列表 + */ + function list_tag() + { + if ($this->ic_id) + { + //展示信息的标签 + $sql = "SELECT * FROM infoContentToTag INNER JOIN infoTags ON icit_it_id = it_id WHERE icit_ic_id = ?"; + $query = $this->HT->query($sql, array($this->ic_id)); + return $query->result(); + } + else + { + //全部展示 + $sql = "SELECT * FROM infoTags ORDER BY it_title ASC, it_date DESC"; + $query = $this->HT->query($sql); + return $query->result(); + } + return 'fail'; + } + + /** + * 添加信息与标签的关联 + */ + function add_tag_to_content() + { + if ($this->ic_id && $this->it_id) + { + //查看是否已存在关联 + $sql = "SELECT TOP 1 * from infoContentToTag WHERE icit_ic_id = ? AND icit_it_id = ?"; + $check = $this->HT->query($sql, array($this->ic_id, $this->it_id)); + + //添加关联 + if ($check->num_rows() === 0) + { + $sql = "INSERT INTO infoContentToTag (icit_ic_id, icit_it_id) VALUES (?, ?)"; + $query = $this->HT->query($sql, array($this->ic_id, $this->it_id)); + } + else + { + return 'exist'; + } + return 'success'; + } + return 'fail'; + } + + /** + * 解除信息与标签的关联 + */ + function remove_tag_to_content() + { + if ($this->ic_id && $this->it_id) + { + $sql = "DELETE FROM infoContentToTag WHERE icit_ic_id = ? and icit_it_id = ?"; + $query = $this->HT->query($sql, array($this->ic_id, $this->it_id)); + return 'success'; + } + return 'fail'; + } + +} diff --git a/application/models/infoTemplate_model.php b/application/models/infoTemplate_model.php new file mode 100644 index 00000000..6f6e2208 --- /dev/null +++ b/application/models/infoTemplate_model.php @@ -0,0 +1,122 @@ +HT = $this->load->database('HT', TRUE); + } + + /** + * 增加标签 + */ + function add_tag() + { + if ($this->it_title) + { + //查看是否已存在标签 + $sql = "SELECT TOP 1 * from infoTags WHERE it_title = N?"; + $check = $this->HT->query($sql, array($this->it_title)); + + //添加标签 + if ($check->num_rows() === 0) + { + $sql = "INSERT INTO infoTags (it_title, it_memo) VALUES (N?, N?)"; + $query = $this->HT->query($sql, array($this->it_title, $this->it_memo)); + return $this->HT->insert_id(); + } + else + { + $row = $check->row(); + return $row->it_id; + } + + } + return FALSE; + } + + /** + * 删除标签 + */ + function remove_tag() + { + if ($this->it_title) + { + $sql = "DELETE FROM infoTags WHERE it_title = N?"; + $query = $this->HT->query($sql, array($this->it_title)); + return 'success'; + } + return 'fail'; + } + + /** + * 标签列表 + */ + function list_tag() + { + if ($this->ic_id) + { + //展示信息的标签 + $sql = "SELECT * FROM infoContentToTag INNER JOIN infoTags ON icit_it_id = it_id WHERE icit_ic_id = ?"; + $query = $this->HT->query($sql, array($this->ic_id)); + return $query->result(); + } + else + { + //全部展示 + $sql = "SELECT * FROM infoTags ORDER BY it_title ASC, it_date DESC"; + $query = $this->HT->query($sql); + return $query->result(); + } + return 'fail'; + } + + /** + * 添加信息与标签的关联 + */ + function add_tag_to_content() + { + if ($this->ic_id && $this->it_id) + { + //查看是否已存在关联 + $sql = "SELECT TOP 1 * from infoContentToTag WHERE icit_ic_id = ? AND icit_it_id = ?"; + $check = $this->HT->query($sql, array($this->ic_id, $this->it_id)); + + //添加关联 + if ($check->num_rows() === 0) + { + $sql = "INSERT INTO infoContentToTag (icit_ic_id, icit_it_id) VALUES (?, ?)"; + $query = $this->HT->query($sql, array($this->ic_id, $this->it_id)); + } + else + { + return 'exist'; + } + return 'success'; + } + return 'fail'; + } + + /** + * 解除信息与标签的关联 + */ + function remove_tag_to_content() + { + if ($this->ic_id && $this->it_id) + { + $sql = "DELETE FROM infoContentToTag WHERE icit_ic_id = ? and icit_it_id = ?"; + $query = $this->HT->query($sql, array($this->ic_id, $this->it_id)); + return 'success'; + } + return 'fail'; + } + +} diff --git a/application/models/infokeywords_model.php b/application/models/infokeywords_model.php index a18dc82d..b6b822ac 100644 --- a/application/models/infokeywords_model.php +++ b/application/models/infokeywords_model.php @@ -2,6 +2,7 @@ class infoKeywords_model extends CI_Model { + public $catch_day = 2; function __construct() { parent::__construct(); @@ -12,7 +13,7 @@ class infoKeywords_model extends CI_Model public function get_structure_list(){ $sql = "SELECT is1.is_id AS id, is1.is_parent_id AS pId, - kw_keyworlds+'('+isnull((select top 1 kwr_rank from infoKeywordsrank where kwr_kw_id=kw_id order by kwr_id desc),'#')+')' as name, + kw_keyworlds+'('+isnull((select top 1 ISNULL(kwr_rank, kwr_mobile_rank) AS kwr_rank from infoKeywordsrank where kwr_kw_id=kw_id order by kwr_id desc),'#')+')' as name, kw_status AS status, kw_id FROM infoKeywords @@ -64,11 +65,14 @@ class infoKeywords_model extends CI_Model } //获取关键词列表用于抓取排名 - public function get_keyworld_list($top=1,$engines='',$site_code=false) + public function get_keyworld_list_old($top = 1, $engines='',$site_code=false) { - $today = strtotime(date('Y-m-d')); + $today = mktime(0,0,0,date("m"),(date("d")-$this->catch_day), date("Y")); + //只查某个站点,原因是个事业部服务器分开,只需要查询本事业部站点即可 $map = " "; - if ($engines=='yandex') { + if(!empty($site_code)){ + $map.=" AND kw_sitecode in ('$site_code') "; + }else if ($engines=='yandex') { $map=" AND kw_sitecode='ru' "; }elseif ($engines=='baidu') { $map.=" AND kw_sitecode='wt' "; @@ -77,9 +81,36 @@ class infoKeywords_model extends CI_Model }elseif ($engines=='eu') { $map.=" AND kw_sitecode in ('gm','vc','vac','ru','it','jp') "; } + $today0 = mktime(0,0,0,date("m"),(date("d")-2), date("Y")); + $sql = "SELECT TOP 1 kw_id, + kw_keyworlds, + kw_is_id, + kw_sitecode, + kw_datetime, + kw_status + FROM infoKeywords + WHERE kw_status=1 AND kw_datetime<($today0) $map + ORDER BY kw_datetime asc"; + + $query = $this->HT->query($sql); + $result = $query->result(); + return $result; + } + public function get_keyworld_list($top=1,$engines='',$site_code=false) + { + $today0 = mktime(0,0,0,date("m"),(date("d")-$this->catch_day), date("Y")); + $map = " "; //只查某个站点,原因是个事业部服务器分开,只需要查询本事业部站点即可 if(!empty($site_code)){ $map.=" AND kw_sitecode in ('$site_code') "; + }else if ($engines=='yandex') { + $map=" AND kw_sitecode='ru' "; + }elseif ($engines=='baidu') { + $map.=" AND kw_sitecode='wt' "; + }elseif ($engines=='en') { + $map.=" AND kw_sitecode in ('cht','ct','sht','tbt','yz','gl','mbj','dct','mct','bht','ah') "; + }elseif ($engines=='eu') { + $map.=" AND kw_sitecode in ('gm','vc','vac','ru','it','jp') "; } $sql = "SELECT TOP $top kw_id, kw_keyworlds, @@ -92,11 +123,14 @@ class infoKeywords_model extends CI_Model kwr_mobile_rank, kwr_id FROM infoKeywords INNER JOIN infoKeywordsrank ON kwr_kw_id=kw_id - AND kwr_id = ( SELECT MAX(kwr_id) FROM infoKeywordsrank WHERE kwr_kw_id=kw_id ) - AND (kwr_datetime<'$today' - OR kwr_mobile_rank IS NULL) - WHERE kw_status=1 $map - ORDER BY newid()"; + AND kwr_id = ( SELECT top 1 kwr_id FROM infoKeywordsrank WHERE kwr_kw_id=kw_id order by kwr_id desc ) + WHERE kw_status=1 $map + AND ( + (kw_datetime>$today0 and kwr_mobile_rank IS NULL) + or + (kw_datetime<$today0) + ) + ORDER BY kw_datetime ASC "; $query = $this->HT->query($sql); //print_r($this->HT->queries); $result = $query->result(); diff --git a/application/models/infokeywordsrank_model.php b/application/models/infokeywordsrank_model.php index 6629f407..7c4e31c2 100644 --- a/application/models/infokeywordsrank_model.php +++ b/application/models/infokeywordsrank_model.php @@ -58,7 +58,25 @@ class infoKeywordsrank_model extends CI_Model kw_keyworlds FROM infoKeywordsrank LEFT JOIN infoKeywords ON kw_id=kwr_kw_id WHERE kwr_kw_id in ($kw_id_string) $map - ORDER BY kwr_datetime DESC"; + ORDER BY kwr_id DESC"; + $query = $this->HT->query($sql); + return $query->result(); + } + public function get_last_pc_rank($kw_id_string, $top=1) + { + $sql = "SELECT top $top kwr_id, + kwr_kw_id, + kwr_rank, + kwr_mobile_rank, + kwr_source, + kwr_mobile_source, + kwr_engines, + kwr_datetime + FROM infoKeywordsrank + WHERE 1=1 + and kwr_kw_id in ($kw_id_string) + and kwr_rank > 0 + ORDER BY kwr_id DESC "; $query = $this->HT->query($sql); return $query->result(); } diff --git a/application/models/information_model.php b/application/models/information_model.php index c5b991a0..aa164191 100644 --- a/application/models/information_model.php +++ b/application/models/information_model.php @@ -74,14 +74,14 @@ class Information_model extends CI_Model { } //根据根节点路径获取子节点列表 - function get_list_by_path($path, $level = false) { + function get_list_by_path($path, $level = false, $site_code = false) { $this->init(); if ($level !== false) { $this->level = " AND is1.is_level= '$level' "; } $this->path = " AND is1.is_path LIKE '$path%' "; $this->orderBy = ' ORDER BY is1.is_level ASC, is1.is_sort ASC,is1.is_path ASC '; - return $this->GetList(); + return $this->GetList('', $site_code); } //根据路径获取某一级别节点详细页 @@ -129,7 +129,7 @@ class Information_model extends CI_Model { return $this->GetList(); } - function GetList($filed = "") { + function GetList($filed = "", $site_code = "") { $this->topNum ? $sql = "SELECT TOP " . $this->topNum : $sql = "SELECT "; if (empty($filed)) { $sql .= " is1.is_id, \n" @@ -168,6 +168,8 @@ class Information_model extends CI_Model { } else { $sql.=" $filed "; } + //添加查询AMP发布状态 + $sql.=",isnull((select top 1 CONVERT(varchar, im_value) from infoMetas where im_ic_id=ic_id and im_key='AMP_STATUS'),0) as amp_status "; $sql.="FROM infoStructures is1 \n" . " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n" . " AND ic.ic_sitecode = is1.is_sitecode \n" @@ -187,7 +189,7 @@ class Information_model extends CI_Model { $this->orderBy ? $sql.=$this->orderBy : false; - $query = $this->HT->query($sql, array($this->config->item('site_code'))); + $query = $this->HT->query($sql, array($site_code ? $site_code : $this->config->item('site_code'))); //print_r($this->HT->queries); if ($this->topNum === 1) { if ($query->num_rows() > 0) { diff --git a/application/models/orders_model.php b/application/models/orders_model.php index a374cc16..7d28d0a7 100644 --- a/application/models/orders_model.php +++ b/application/models/orders_model.php @@ -59,6 +59,24 @@ class Orders_model extends CI_Model { } } + //获取当天商务订单 + function biz_count() { + $date_start = date('Y-m-d', time() - 86400);//减一天 + $date_end = date('Y-m-d', time() + 86400);//加一天 + $sql = " + SELECT COUNT(1) AS CLI_COUNT + FROM BIZ_ConfirmLineInfo bcli + WHERE bcli.COLI_ApplyDate BETWEEN '$date_start 00:00:00' AND '$date_end 23:59:59' + "; + $query = $this->HT->query($sql); + if ($query->num_rows() > 0) { + $row = $query->row(); + return $row->CLI_COUNT; + } else { + return FALSE; + } + } + //获取当天商务订单 function get_biz_info($sitecode) { $sql = "SELECT bcli.COLI_ID, n" diff --git a/application/third_party/advertise/controllers/index.php b/application/third_party/advertise/controllers/index.php index fba012ea..581fed60 100644 --- a/application/third_party/advertise/controllers/index.php +++ b/application/third_party/advertise/controllers/index.php @@ -6,7 +6,7 @@ if (!defined('BASEPATH')) class Index extends CI_Controller { - public function __construct() + public function __construct() { parent::__construct(); $this->permission->is_admin(); @@ -55,6 +55,7 @@ class Index extends CI_Controller $data['advertise']=$this->advertise_model->get_advertise_treeid($data['ad_is_id']); $data['webpage_list']=$this->advertise_model->get_advertise_page($data['ad_is_id']); $data['click_rate']=$this->advertise_model->get_click_rate($data['advertise']->ad_id); + $data['advertise']->ad_content = str_replace("url=//","url=https://",$data['advertise']->ad_content); $this->load->view('bootstrap3/header', $data); $this->load->view('advertise'); $this->load->view('bootstrap3/footer'); @@ -167,4 +168,4 @@ class Index extends CI_Controller echo $result; } -} \ No newline at end of file +} diff --git a/application/third_party/htmlcompressor/controllers/index.php b/application/third_party/htmlcompressor/controllers/index.php index c530f0ac..999907c2 100644 --- a/application/third_party/htmlcompressor/controllers/index.php +++ b/application/third_party/htmlcompressor/controllers/index.php @@ -1,146 +1,330 @@ -load->library('simple_html_dom_lib'); - } - - public function index() { - $this->load->view('welcome'); - } - - public function optimize() { - $htmlsource = $this->input->post('htmlsource'); - $websitehost = $this->input->post('websitehost'); - if (empty($htmlsource) || empty($websitehost)) { - $this->output->set_status_header(500); - echo 'error:htmlsource or websitehost is empty!'; - log_message('error', "htmlsource or websitehost is empty! " . $websitehost); - return false; - } - //域名后面不能有/ - if (substr($websitehost, -1, 1) == '/') { - $websitehost = substr($websitehost, 0, -1); - } - - $html_object = str_get_html($htmlsource); - if (!empty($html_object)) { - -//提取和下载所有CSS样式,包括链接文件和页面样式 - $link_css_array = array(); - $css_content = ''; - foreach ($html_object->find('link') as $link_css) { - if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) { - $link_css_array[] = $link_css->href; - $link_css->outertext = ''; //删除链接 - } - } - //print_r($link_css_array); - foreach ($link_css_array as $item) { - $get_http_temp = GET_HTTP($this->format_url($item, $websitehost)); - if ($get_http_temp == false) { - $this->output->set_status_header(404); - echo 'CSS文件下载错误'; - log_message('error', "optimize CSS文件下载错误! " . $item); - return FALSE; - } - $css_content.=$get_http_temp; - } - foreach ($html_object->find('style') as $style_css) { - if ($style_css->type == "text/css") { - $css_content .= $style_css->innertext; - } - } - // echo $css_content; - // echo $html_object;die(); - // -//提取和下载所有JS脚本,包括链接文件和页面脚本 - $link_js_array = array(); - $js_inline_content = ''; - $js_jquery_content = ''; - foreach ($html_object->find('script') as $link_script) { - if (!empty($link_script->src)) { - if(empty($link_script->defer)){ //没有defer标记的才处理,否则让js延后加载 - $link_js_array[] = $link_script->src; - $link_script->outertext = ''; //删除链接,移动到页底 - } - } else { - //网页内的js不需要提取 - //$js_content.= $link_script->innertext;//js的内容 - // $js_content.= $link_script;//js的内容,包含'; - - $js_content = $js_scr_content . $js_jquery_content; - //延迟加载js,需要把返回的js代码保存到一个文件中,然后替换占位符,以便加载js文件 - $lastload_js.=''; - $lastload_js.=$js_inline_content; - - $html_object = str_replace('', $lastload_js . '', $html_object); - } - echo json_encode(array('result' => 'ok', 'data' => array('html_object' => $html_object, 'js_content' => $js_content))); - } - -//格式化url,保证请求的URL有域名,//更换为对应的域名路径 - function format_url($url, $host = '') { - if (substr($url, 0, 8) == 'https://' || substr($url, 0, 7) == 'http://') { - return urldecode($url); - } - - if (substr($url, 0, 2) == '//') { //https或http - return urldecode(str_replace('//', 'http://', $url)); - } - - return urldecode($host . $url); - } - -} +load->library('simple_html_dom_lib'); + } + + public function index() + { + $this->load->view('welcome'); + } + + public function optimize() + { + $htmlsource = $this->input->post('htmlsource'); + $websitehost = $this->input->post('websitehost'); + $template_name = $this->input->post('template_name'); + $create_amp = $this->input->post('create_amp'); + $debug = $this->input->post('debug'); + if (empty($htmlsource) || empty($websitehost)) { + $this->output->set_status_header(500); + echo 'error:htmlsource or websitehost is empty!'; + log_message('error', "htmlsource or websitehost is empty! " . $websitehost); + return false; + } + //域名后面不能有/ + if (substr($websitehost, -1, 1) == '/') { + $websitehost = substr($websitehost, 0, -1); + } + + $html_object = str_get_html($htmlsource); + if (!empty($html_object)) { + +//提取和下载所有CSS样式,包括链接文件和页面样式 + $link_css_array = array(); + $css_content = ''; + foreach ($html_object->find('link') as $link_css) { + if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) { + $link_css_array[] = $link_css->href; + $link_css->outertext = ''; //删除链接 + } + } + //print_r($link_css_array); + foreach ($link_css_array as $item) { + $get_http_temp = GET_HTTP($this->format_url($item, $websitehost)); + if ($get_http_temp == false) { + $this->output->set_status_header(404); + echo 'CSS文件下载错误'; + log_message('error', "optimize CSS文件下载错误! " . $item); + return FALSE; + } + $css_content .= $get_http_temp; + } + foreach ($html_object->find('style') as $style_css) { + if ($style_css->type == "text/css") { + $css_content .= $style_css->innertext; + } + } + // echo $css_content; + // echo $html_object;die(); + // +//提取和下载所有JS脚本,包括链接文件和页面脚本 + $link_js_array = array(); + $js_inline_content = ''; + $js_jquery_content = ''; + foreach ($html_object->find('script') as $link_script) { + if (!empty($link_script->src)) { + if (empty($link_script->defer) && empty($link_script->async)) { //没有defer标记的才处理,否则让js延后加载 + $link_js_array[] = $link_script->src; + $link_script->outertext = ''; //删除链接,移动到页底 + } + } else { + //网页内的js不需要提取 + //$js_content.= $link_script->innertext;//js的内容 + // $js_content.= $link_script;//js的内容,包含'; + + $js_content = $js_scr_content . $js_jquery_content; + //延迟加载js,需要把返回的js代码保存到一个文件中,然后替换占位符,以便加载js文件 + $lastload_js .= ''; + $lastload_js .= $js_inline_content; + + $html_object = str_replace('', $lastload_js . '', $html_object); + } + + //只返回AMP代码 + if (!empty($create_amp)) { + $amp = $this->create_amp($html_object, $template_name, $websitehost,$debug); + echo json_encode(array('result' => 'ok', 'data' => array('amp' => $amp))); + return; + } + echo json_encode(array('result' => 'ok', 'data' => array('html_object' => $html_object, 'js_content' => $js_content))); + + } + +//格式化url,保证请求的URL有域名,//更换为对应的域名路径 + function format_url($url, $host = '') + { + if (substr($url, 0, 8) == 'https://' || substr($url, 0, 7) == 'http://') { + $url = str_replace('http://', 'https://', $url);//http要改为https + return urldecode($url); + } + + if (substr($url, 0, 2) == '//') { //https或http + return urldecode(str_replace('//', 'https://', $url)); + } + + return urldecode($host . $url); + } + + + +//生成AMP版本 用移动端版本生成 + /* + 1.加载站点AMP模板,模板只有导航、头部、底部 + 2.删除全部js引用和内链代码 + 3.删除全部css引用,内联css放入 + + + + + + + + +
+
+ + +
+ + + + +
+ + + +
+
+
+ + + +
+ + +
+ + + + + +
+@AMP-GOOGLE-ANALYTICS@ + + + diff --git a/application/third_party/htmlcompressor/views/amp-template/cht.php b/application/third_party/htmlcompressor/views/amp-template/cht.php new file mode 100644 index 00000000..f29c6144 --- /dev/null +++ b/application/third_party/htmlcompressor/views/amp-template/cht.php @@ -0,0 +1,133 @@ + + + + +<!--@TITLE@--> + + + + + + + + + + + + + + + +
+
+ + China Highlights ® + CUSTOMIZE +
+
+ + + +
+
+
+ + + + +
+ + + + +
+ Start planning your tailor-made China tour … + Create My Trip +
+ + + + + + + + + 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..0ad306ef --- /dev/null +++ b/application/third_party/htmlcompressor/views/amp-template/gm.php @@ -0,0 +1,109 @@ + + + + + <!--@TITLE@--> + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + +
+
+ Anfragen
+
+ + + +
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + +
+
+
+ + + + + +
+ + +
+ + + + + +
+ + + + \ No newline at end of file diff --git a/application/third_party/htmlcompressor/views/welcome.php b/application/third_party/htmlcompressor/views/welcome.php index e18468fd..2c57e7e0 100644 --- a/application/third_party/htmlcompressor/views/welcome.php +++ b/application/third_party/htmlcompressor/views/welcome.php @@ -14,7 +14,23 @@

页面样式精简



- + + +

+ + + +

+
diff --git a/application/third_party/order/controllers/confirm.php b/application/third_party/order/controllers/confirm.php index 4dda6cd4..1b9ae2fc 100644 --- a/application/third_party/order/controllers/confirm.php +++ b/application/third_party/order/controllers/confirm.php @@ -57,6 +57,11 @@ class Confirm extends CI_Controller { $COLI_SN = $this->input->post('COLI_SN'); $visitor_link = $this->input->post('visitor_link'); $COLI_ID = $this->input->post('COLI_ID'); + //航班信息 + $MEI_ArrivalFlightNo = $this->input->post('MEI_ArrivalFlightNo'); + $MEI_ArrivalTime = $this->input->post('MEI_ArrivalTime'); + $MEI_DepartureFlightNo = $this->input->post('MEI_DepartureFlightNo'); + $MEI_DepartureTime = $this->input->post('MEI_DepartureTime'); //已经确认过 @@ -85,34 +90,21 @@ class Confirm extends CI_Controller { $MEI_LastName = $name; - if ($this->input->post('arrive_flight')) { - $CUL_Memo = 'Arrival China Flight No : ' - . $this->input->post('arrive_flight') - . ' & Arrival time : ' - . $this->input->post('arrive_time') - . ' & Departure China Flight no : ' - . $this->input->post('departure_flight') - . ' & Departure time : ' - . $this->input->post('depart_time'); - } else { - $CUL_Memo = ''; - } - $CUL_Memo .= $this->input->post('insurance_information'); + $CUL_Memo = $this->input->post('insurance_information'); $MEI_Memo = $this->input->post('special_request') . ' ' . $CUL_Memo; - //$birthday[$key] = date('Y-m-d H:i:s', strtotime($birthday[$key])); $birthday_tmp = date('Y-m-d H:i:s', strtotime($birthday[$key])); - //$expiration_date[$key] = date('Y-m-d H:i:s', strtotime($expiration_date[$key])); $expiration_date_tmp = date('Y-m-d H:i:s', strtotime($expiration_date[$key])); - $MEI_SN = $this->Order_model->add_customer_info($gender[$key], $nationality[$key], $MEI_FirstName, $MEI_LastName, $passport[$key], $expiration_date_tmp, $birthday_tmp, $MEI_Memo, $MEI_Street, '', $contact_phone, 0, $COLI_SN, $visitor_link); + $MEI_SN = $this->Order_model->add_customer_info($gender[$key], $nationality[$key], $MEI_FirstName, $MEI_LastName, $passport[$key], $expiration_date_tmp, $birthday_tmp, $MEI_Memo, $MEI_Street, '', $contact_phone, 0, $COLI_SN, $visitor_link,$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime); } } if ($MEI_SN && $this->input->post('emergency_person_name') != '') { $add_emergency_res = $this->Order_model->add_customer_info( '', '', $this->input->post('emergency_person_name'), '', '', '', '', $this->input->post('emergency_relationship'), '', $this->input->post('emergency_email'), $this->input->post('emergency_telephone'), 1, $COLI_SN, $visitor_link + ,$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime ); } diff --git a/application/third_party/order/models/order_model.php b/application/third_party/order/models/order_model.php index be036f56..9ba407c6 100644 --- a/application/third_party/order/models/order_model.php +++ b/application/third_party/order/models/order_model.php @@ -43,7 +43,7 @@ class Order_model extends CI_Model { } //添加客人信息 - public function add_customer_info($MEI_Gender,$MEI_Nationality,$MEI_FirstName,$MEI_LastName,$MEI_PassportNo,$MEI_PassportValidDate,$MEI_Birthday,$MEI_Memo,$MEI_Street,$MEI_MailList='',$MEI_Phone='',$CUL_IsEmergency=0,$CUL_COLI_SN='',$visitor_link='') + public function add_customer_info($MEI_Gender,$MEI_Nationality,$MEI_FirstName,$MEI_LastName,$MEI_PassportNo,$MEI_PassportValidDate,$MEI_Birthday,$MEI_Memo,$MEI_Street,$MEI_MailList='',$MEI_Phone='',$CUL_IsEmergency=0,$CUL_COLI_SN='',$visitor_link='',$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime) { $createdate=date('Y-m-d H:i:s'); $sql="INSERT INTO MEmberInfoTmpCheck @@ -69,9 +69,13 @@ class Order_model extends CI_Model { visitor_link, CreateDate, CUL_IsLinkMan, - copyState - ) VALUES (?,?,?,?,?,?,?,?,?,?,?,102001,0,0,1,1,?,?,?,?,0,0) "; - $this->HT->query($sql, array($MEI_Gender,$MEI_Nationality,$MEI_FirstName,$MEI_LastName,$MEI_PassportNo,$MEI_PassportValidDate,$MEI_Birthday,$MEI_Memo,$MEI_Street,$MEI_MailList,$MEI_Phone,$CUL_IsEmergency,$CUL_COLI_SN,$visitor_link,$createdate)); + copyState, + MEI_ArrivalFlightNo, + MEI_ArrivalTime, + MEI_DepartureFlightNo, + MEI_DepartureTime + ) VALUES (?,?,?,?,?,?,?,?,?,?,?,102001,0,0,1,1,?,?,?,?,0,0,?,?,?,?) "; + $this->HT->query($sql, array($MEI_Gender,$MEI_Nationality,$MEI_FirstName,$MEI_LastName,$MEI_PassportNo,$MEI_PassportValidDate,$MEI_Birthday,$MEI_Memo,$MEI_Street,$MEI_MailList,$MEI_Phone,$CUL_IsEmergency,$CUL_COLI_SN,$visitor_link,$createdate,$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime)); $insertid = $this->HT->last_id('MEmberInfoTmpCheck');//$this->HT->insert_id(); return $insertid; } diff --git a/application/third_party/order/views/confirm_order.php b/application/third_party/order/views/confirm_order.php index 21d43269..a916af4c 100644 --- a/application/third_party/order/views/confirm_order.php +++ b/application/third_party/order/views/confirm_order.php @@ -7,14 +7,15 @@ China Highlights! Please complete and submit the information. - + - + + @@ -69,7 +70,10 @@
-

Passenger Information (we need passport info for all the group members)

+

Passenger Information (we need passport info for all the group members)
+ Please ensure the details you provide are correct, as stated in your passport. We use this information to book all your hotels and transportation. If the name you provide are incorrect, you would not be able to board your flight or trains in China, and therefore reissuing of tickets would be at your expense! +

+