diff --git a/.gitignore b/.gitignore index e4e0264d..6572b37a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea +.phpintel .svn/* */logs/log* /web.config @@ -7,4 +8,5 @@ */cache/* */statement_files/* */paypal_activities/* -/author/document/* \ No newline at end of file +/author/document/* +/application/libraries/composer diff --git a/application/config/config.php b/application/config/config.php index a6ad6f16..82fb443e 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -572,7 +572,8 @@ $config['templates_i'] = array( '[城市]C景点列表模板' => 'city_info_attractions_list', '[城市]C景点详细模板' => 'city_attractions', '[专题]T0空白' => 'r_tpl_empty', - '[专题]T0空白(带框架)' => 'r_empty2', + '[专题]T0空白(HTML构建工具)' => 'r_empty_container', + '[专题]T0空白(H1+面包屑)' => 'r_empty2', '----------二级目录----------' => '------2------', '[专题]T2首页' => 'r_t2_index', '[专题]T2详细' => 'r_t2_detail', @@ -662,21 +663,22 @@ $config['check_access'] = TRUE; $config['access_super_manage'] = array('ycc', 'lmr'); //编辑器预览样式路径 -$config['css_source_cht'] = ''; +$config['css_source_cht'] = ''; -$config['css_source_gm'] = ''; +$config['css_source_gm'] = ''; -$config['css_source_vc'] = ''; -$config['css_source_vac'] = ''; -$config['css_source_ru'] = ''; -$config['css_source_it'] = ''; -$config['css_source_jp'] = ''; +$config['css_source_vc'] = ''; +$config['css_source_vac'] = ''; +$config['css_source_ru'] = ''; +$config['css_source_it'] = ''; +$config['css_source_jp'] = ''; -$config['css_source_sht'] = ''; -$config['css_source_gl'] = ''; -$config['css_source_tbt'] = ''; -$config['css_source_mbj'] = ''; -$config['css_source_yz'] = ''; +$config['css_source_sht'] = ''; +$config['css_source_gl'] = ''; +$config['css_source_tbt'] = ''; +$config['css_source_mbj'] = ''; +$config['css_source_yz'] = ''; +$config['css_source_ah'] = ''; @@ -866,12 +868,45 @@ $config['InfoType_citizen'] = array( '产品' => 'product' ); +//ct站点用到了 +$config['InfoType_ct'] = array( + '不设置' => 'none', + '首页' => 'root', + '简介' => 'c_overview', + '关于' => 'c_about', + '食物' => 'c_food', + '食物详细' => 'c_food_detail', + '餐饮' => 'c_restaurant', + '餐饮详细' => 'c_restaurant_detail', + '历史' => 'c_history', + 'Facts信息' => 'c_facts', + '旅游' => 'c_travel', + '交通' => 'c_transport', + '交通详细' => 'c_transport_detail', + '地图' => 'c_map', + '地图详细' => 'c_map_detail', + '天气' => 'c_weather', + '天气详细' => 'c_weather_detail', + '购物' => 'c_shopping', + '夜生活' => 'c_nightlife', + '旅游建议' => 'c_tips', + '景点概述' => 'c_attraction', + '景点详细' => 'c_attraction_detail', + '推荐做的' => 'c_toptodo', + '城市article' => 'c_article', + '产品' => 'c_product', + '产品详细' => 'c_product_detail', + '游记' => 'story', + '一地线路详细' => 'c_single_circuit', + '一日游线路详细' => 'c_day_tour' +); + //可选模板 $config['templates'] = array( '通用内容模板' => 'guide_info_detail', '城市-列表模板' => 'city_info_list', '城市-首页模板' => 'city_info_index', - '城市-首页模板(GM)' => 'city_info_index_new', + '城市-首页模板(GM)' => 'city_info_index_new', '城市-首页模板[简]' => 'city_info_s_index', '城市-景点列表模板' => 'city_info_attractions_list', '城市-景点列表模板[简]' => 'city_info_s_attractions_list', @@ -910,19 +945,11 @@ $config['templates'] = array( //德语信息模板 $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", + '城市-首页模板(GM)' => 'city_info_index', '文化模板 [单页式]' => 'culture_info_detail_one_page', '文化模板 [导航式]' => 'culture_info_detail_with_category', '信息专题模板' => 'guide_top_series', + '列表式' => 'guide_info_list', '空白模板'=>'none' ); @@ -963,6 +990,7 @@ $config['templates_product'] = array( //产品管理板块模板(国际站使用) $config['templates_product_i'] = array( + '空白模板(HTML构建工具)' => 'r_empty_container', '空白模板(新)' => 'r_tpl_empty_2017', '空白模板(旧)' => 'r_tpl_empty', ); @@ -1047,9 +1075,6 @@ $config['media_image_url_org'] = 'http://photo.chtcdn.com:3581/upload'; $config['media_image_url_remote'] = 'http://photo.chtcdn.com/upload'; $config['media_image_url_remote2'] = 'http://116.251.217.48:3581/upload'; -//编辑器预览样式路径 -$config['css_source_cht'] = ''; -$config['css_source_ah'] = ''; /* End of file config.php */ /* Location: ./application/config/config.php */ diff --git a/application/controllers/CT_AMP_Loader.php b/application/controllers/CT_AMP_Loader.php new file mode 100644 index 00000000..27ba257b --- /dev/null +++ b/application/controllers/CT_AMP_Loader.php @@ -0,0 +1,59 @@ +load->model('information_model'); + $this->load->model('InfoMetas_model'); + //$this->load->library('Tags_analysis'); + } + + // http://localhost:8002/guide-use.php/amp_loader/test/?info_url=/yangtzecruise/ + /** + * 加载已经发布的页面 + */ + public function load() { + $info_url = $this->input->get_post('info_url'); + $webcode = $this->input->get_post('webcode'); + if(!isset($webcode) ) { + $webcode="ct"; + } + // $info_url="/yangtzecruise/"; + // $webcode="cht"; + + $information_detail = $this->information_model->ct_get_by_url($info_url, $webcode); + $ic_id = $information_detail->ic_id; + $meta_amp_status = $this->InfoMetas_model->get($ic_id, 'AMP_STATUS'); + if ($meta_amp_status) { + $meta_amp_html = $this->InfoMetas_model->get($ic_id, 'AMP'); + //$include_price_html = $this->tags_analysis->replace_price_tag($meta_amp_html); + echo $meta_amp_html; + } else { + header('HTTP/1.1 404 Not Found'); + header("status: 404 Not Found"); + show_404(); + exit; + } + } + + // http://localhost:8002/guide-use.php/amp_loader/test/?info_url=/yangtzecruise/ + /** + * 测试保存的页面 + */ + public function test() { + // $info_url = $this->input->get_post('info_url'); + $info_url = "/yangtzecruise/"; + $information_detail = $this->information_model->ct_get_by_url($info_url, "cht"); + if (empty($information_detail)) { + echo $info_url.'没有信息类型'; + } + $ic_id = $information_detail->ic_id; + $meta_amp_html = $this->InfoMetas_model->get($ic_id, 'AMP'); + //$include_price_html = $this->tags_analysis->replace_price_tag($meta_amp_html); + echo $meta_amp_html; + } +} diff --git a/application/controllers/amp.php b/application/controllers/amp.php index 55dd1aef..e7e5c374 100644 --- a/application/controllers/amp.php +++ b/application/controllers/amp.php @@ -21,15 +21,15 @@ class Amp extends CI_Controller { } public function edit($ic_id) { - $this->amplib->edit($ic_id); + $this->amplib->edit($ic_id); } public function auto_create($ic_id) { - echo $this->amplib->auto_create($ic_id); + echo $this->amplib->auto_create($ic_id); } public function edit_save() { - echo $this->amplib->edit_save(); + echo $this->amplib->edit_save(); } } diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index 990f7f65..99ac7662 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -14,8 +14,10 @@ class Info_amp extends CI_Controller $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:*'); + //CORS + header('Access-Control-Allow-Origin:*'); + header('Access-Control-Allow-Methods:GET,PUT,POST,DELETE,OPTIONS'); + header('Access-Control-Allow-Headers:Content-Type,Authorization,Content-Length,X-Requested-With,Accept,x-csrf-token,origin'); } public function save_amp() @@ -23,50 +25,73 @@ class Info_amp extends CI_Controller $icid = $this->input->get_post('icid'); $json = $this->input->get_post('json'); $html = $this->input->get_post('html'); + $pc_html = $this->input->get_post('pc_html'); + $pc_css = $this->input->get_post('pc_css'); $css = $this->input->get_post('css'); $schema = $this->input->get_post('schema'); $script = $this->input->get_post('script'); $status = $this->input->get_post('status'); + + //如果源信息的内容为空,则插入内容。 + $info = $this->InfoContents_model->get_ic_contents2($icid); + if ($info && empty($info->ic_content)) { + $this->InfoContents_model->force_update($icid, ''.$pc_html); + } + if ($icid && $json && $html) { try { //html $meta = $this->InfoMetas_model->get($icid, 'AMP_BODY'); - if ($meta === false) { + if ($meta === FALSE) { $this->InfoMetas_model->add($icid, 'AMP_BODY', $html); } else { $this->InfoMetas_model->update($icid, 'AMP_BODY', $html); } + //pc_html + $meta = $this->InfoMetas_model->get($icid, 'AMP_BODY_PC'); + if ($meta === FALSE) { + $this->InfoMetas_model->add($icid, 'AMP_BODY_PC', $pc_html); + } else { + $this->InfoMetas_model->update($icid, 'AMP_BODY_PC', $pc_html); + } + //pc_css + $meta = $this->InfoMetas_model->get($icid, 'AMP_CSS_PC'); + if ($meta === FALSE) { + $this->InfoMetas_model->add($icid, 'AMP_CSS_PC', $pc_css); + } else { + $this->InfoMetas_model->update($icid, 'AMP_CSS_PC', $pc_css); + } //json $meta = $this->InfoMetas_model->get($icid, 'AMP_JSON'); - if ($meta === false) { + 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) { + 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) { + 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) { + 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) { + if ($meta === FALSE) { $this->InfoMetas_model->add($icid, 'AMP_STATUS', $status); } else { $this->InfoMetas_model->update($icid, 'AMP_STATUS', $status); @@ -306,4 +331,181 @@ class Info_amp extends CI_Controller )); } } + + public function handel_png_source() { + //ini_set('memory_limit', '50M'); + $png_base64 = $this->input->post('png_base64'); + //$png_base64 = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg=='; + $file = md5($png_base64).'.jpg'; + $path = realpath('../cht-system/views/information/word_img').'/'.$file; + $png_base64 = str_replace('data:image/png;base64,', '', $png_base64); + $png_base64 = str_replace('data:image/jpg;base64,', '', $png_base64); + $png_base64 = base64_decode($png_base64); + $im = imagecreatefromstring($png_base64); + //保存图像 + imagejpeg($im, $path); + //释放内存 + imagedestroy($im); + $size = getimagesize($path); + if($png_base64 && $size) { + echo(json_encode(array( + 'status' => 'success', + 'path' => '/information-view/information/word_img/'.$file, + 'width' => $size[0], + 'height' => $size[1] + ))); + } else { + echo(json_encode(array( + 'status' => 'error' + ))); + } + } + + public function handel_image_source() { + @ini_set('memory_limit', '256M'); + $file = $_FILES['file']; + if (!$file) { + echo(json_encode(array( + 'status' => 'error', + 'msg' => "图片上传失败。" + ))); + return; + } + $usr = $this->input->post('usr'); + $icid = $this->input->post('icid'); + //转移文件 + $md5_file = md5($usr.$icid.$file['name']); + //ext + $ext = mb_strtolower(strrchr($file["name"],'.')); + if ($ext != '.jpg') { + echo(json_encode(array( + 'status' => 'error', + 'msg' => '只能接收(.jpg)图片。', + 'filename' => $file["name"] + ))); + return; + } + $md5_name = $md5_file.$ext; + //临时docx文件 + $image_path = realpath('../cht-system/views/information/word_img').'/'.basename($md5_name); + $html = 'to use mammoth'; + if (move_uploaded_file($file['tmp_name'], $image_path)) { + //图片处理 + $im = imagecreatefromjpeg($image_path); + imagejpeg($im, $image_path); + imagedestroy($im); + $size = getimagesize($image_path); + if($size) { + echo(json_encode(array( + 'status' => 'success', + 'path' => '/information-view/information/word_img/'.$md5_name, + 'width' => $size[0], + 'height' => $size[1] + ))); + } else { + echo(json_encode(array( + 'status' => 'error' + ))); + } + } else { + echo(json_encode(array( + 'status' => 'error', + 'msg' => "图片文件解析失败。" + ))); + } + } + + public function handel_word_source() { + @ini_set('memory_limit', '256M'); + $file = $_FILES['file']; + if (!$file) { + echo(json_encode(array( + 'status' => 'error', + 'msg' => "文件上传失败。" + ))); + return; + } + $usr = $this->input->post('usr'); + $icid = $this->input->post('icid'); + //转移文件 + $md5_file = md5($usr.$icid.$file['name']); + //ext + $ext = mb_strtolower(strrchr($file["name"],'.')); + if ($ext != '.docx') { + echo(json_encode(array( + 'status' => 'error', + 'msg' => '只能接收word(.docx)文档。' + ))); + return; + } + $md5_name = $md5_file.$ext; + //临时docx文件 + $docx_path = realpath('../cht-system/views/information/word_source').'/'.basename($md5_name); + $html = 'to use mammoth'; + if (move_uploaded_file($file['tmp_name'], $docx_path)) { + $docx_dir = realpath('../cht-system/views/information/word_source'); + //图片及html目录 + $img_dir = $docx_dir.'/'.$md5_file; + is_dir($img_dir) || mkdir($img_dir, 0777); + //临时html文件 + $docx_parh = $img_dir.'/'.$md5_name; + $html_parh = str_ireplace('.docx', '.html', $docx_parh); + //运行docx转化插件 + if ($_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '202.103.68.62') { + $yarnbin = 'C:\Users\cht77\AppData\Local\Yarn\bin\mammoth '; + $test_host = '//202.103.68.62:9096'; + } else { + $yarnbin = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth '; + $test_host = ''; + } + $command = $yarnbin.$docx_path.' --output-dir='.$img_dir. ' 2>&1'; + //$command = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth -h 2>&1'; + exec($command, $rs, $st); + //图片处理 + $scan_img = scandir($img_dir); + $tmp = ''; + foreach($scan_img as $f) { + $tmp_ext = mb_strtolower(strrchr($f, '.')); + if ($tmp_ext == '.jpeg') { + $tmp_img = $img_dir.'/'.$f; + $tmp_jpg = str_ireplace('.jpeg', '.jpg', $tmp_img); + $im = imagecreatefromjpeg($tmp_img); + imagejpeg($im, $tmp_jpg); + imagedestroy($im); + //删除临时图片 + @unlink($tmp_img); + //$tmp .= $f . ' # '; + } + } + //html处理 + if (file_exists($html_parh)) { + $html = file_get_contents($html_parh); + } else { + echo(json_encode(array( + 'status' => 'error', + 'html' => $command.' # '.$html_parh, + 'rs' => print_r($rs, true).' # '.$st + ))); + return; + } + $html = preg_replace('/src="([\d]+).jpeg"/i', 'src="'.$test_host.'/information-view/information/word_source/'.$md5_file.'/$1.jpg"', $html); + //删除临时html + @unlink($html_parh); + //删除docx文档 + @unlink($docx_path); + if ($html) { + echo(json_encode(array( + 'status' => 'success', + 'path' => $docx_path, + 'html' => $html + ))); + } + } else { + echo(json_encode(array( + 'status' => 'error', + 'msg' => "word文件解析失败。" + ))); + } + } + } diff --git a/application/controllers/information.php b/application/controllers/information.php index 4e3fd961..d3d18193 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -1,703 +1,725 @@ -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'); - $this->load->model('Landscape_model'); - $this->load->model('Operator_model'); - $this->load->model('Logs_model'); - $this->load->model('InfoMetas_model'); - $this->load->model('Infoauthors_model'); - $this->load->model('InfoSMS_model'); - $this->load->library('Amplib'); //加载AMP处理类 - $this->load->library('Accesscheck'); - $this->accesscheck->check_access(); - } - - public function index() { - echo '信息首页'; - } - - public function add($is_parent_id) { - //添加空内容. - $this->InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', ''); - $infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id); - if (!empty($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) { - $is_id = $this->InfoStructures_model->insert_id; - $InfoStructures = $this->InfoStructures_model->Detail($is_id); - $InfoStructures->is_id = $is_id; - $data[] = array('name' => 'ok', 'value' => $InfoStructures); - $this->Logs_model->add($this->InfoStructures_model->insert_id); - } else { - $data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error')); - } - echo json_encode($data); - return TRUE; - } - - //移动结构顺序 - public function move() { - //网站会提交一个同级节点id列表字符串,按照这个去排序 - $parent_id = $this->input->post('pid'); - $idsStr = $this->input->post('ids'); - $idsArray = explode(',', $idsStr); - foreach ($idsArray as $key => $value) { - if ($value) { - //设置排序 - $this->InfoStructures_model->set_sort($value, $key); - //设置path - $this->InfoStructures_model->set_path($parent_id, $value); - } - } - $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move')); - echo json_encode($data); - $this->Logs_model->move($idsStr); - return TRUE; - } - - //把文章移动到任意板块文章下 - //is_id 信息结构ID,is_parent_id即将转移到的信息结构id - public function move_by_is_id() { - $data = array(); - $is_id = $this->input->post('is_id'); - $is_parent_id = $this->input->post('is_parent_id'); - if ($is_id == $is_parent_id || empty($is_id) || empty($is_parent_id)) { - return false; - } - //即将移动到文章结构信息 - $Structure = $this->InfoStructures_model->Detail($is_id); - //目标文章结构信息 - $Structure_parent = $this->InfoStructures_model->Detail($is_parent_id); - //只能移动到本站点下 - if ($Structure->is_sitecode == $Structure_parent->is_sitecode) { - //不能搬迁到自己的子节点下 - if (strpos(',' . $Structure_parent->is_path, ',' . $is_id . ',') == false) { - $this->InfoStructures_model->set_path($is_parent_id, $is_id); - } - //信息的区域类型和id也要修改 todo - } - $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move')); - echo json_encode($data); - $this->Logs_model->move($is_id); - return TRUE; - } - - public function delete($is_id) { - //查询结构信息 - $Structure = $this->InfoStructures_model->Detail($is_id); - if ($Structure == FALSE) { - $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound')); - echo json_encode($data); - return false; - } - if ($this->InfoStructures_model->HasChild($Structure->is_id)) { - $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_haschild')); - echo json_encode($data); - return false; - } else { - $info_detail = $this->Information_model->Detail($is_id); - $this->Logs_model->delete($is_id, $info_detail->ic_content); - if (!empty($info_detail->ic_summary)) { - $this->Logs_model->backup_summary($is_id, $info_detail->ic_summary); - } - $this->InfoStructures_model->Delete($Structure->is_id); - $this->InfoContents_model->Delete($Structure->is_ic_id); - //如果是已经发布的页面,删除静态文件 - if ($info_detail->ic_status == 1) { - $this->update_cache($info_detail->ic_url, true); - } - //删除成功后返回一个上级链接给用户 - $drumpurl = site_url('information/edit/' . $Structure->is_parent_id); - if ($Structure->is_parent_id == 0) - $drumpurl = site_url('/'); - $data[] = array('name' => 'ok', 'value' => $drumpurl); - echo json_encode($data); - return true; - } - } - - public function edit($is_id) { - header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); - header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); - set_time_limit(30); - //$this->output->enable_profiler(true); - //查询结构信息 - $Structure = $this->InfoStructures_model->Detail($is_id); - if ($Structure == FALSE) { - show_404(); - } - //查询结构根节点 - $rootStructure = $this->InfoStructures_model->GetParent($Structure->is_path, 1); - //没有根节点就从它本身开始查询 - if ($rootStructure == false) { - $rootStructure_ID = $Structure->is_id; - } else { - $rootStructure_ID = $rootStructure->is_id; - } - - //查询结构列表信息 - //$data['informationList'] = $this->Information_model->StructureList($rootStructure_ID); - $data['informationList'] = $this->accesscheck->get_info_structure($rootStructure_ID); - if (!$data['informationList']) { - redirect(site_url('Login/refuse')); - } - $data['is_writeable'] = $this->accesscheck->get_edit_type($Structure->is_path); - - //增加一项,属于这个区域,但是结构数据层次不准确的也要列出来 - //todo: - //信息内容 - $data['information'] = $this->Information_model->Detail($is_id); - - //检查该信息是否已收录 - $data['embody'] = 1; - if (isset($data['information']->ic_id)) { - $embody = $this->InfoMetas_model->get($data['information']->ic_id, 'meta_embody'); - if ($embody && $embody != '1') { - $data['embody'] = 0; - } - //设置该信息所有未读消息为已读 - $this->InfoSMS_model->readed_for_info($data['information']->ic_id); - } - - //主节点信息 - $data['rootInformation'] = $this->Information_model->Detail($rootStructure_ID); - //获取未绑定的景点,只有城市有,无视其它区域类型 - $data['unlink_landscape_list'] = array(); - - //可选的展示模板 - if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) { - $this->config->set_item('templates', $this->config->item('templates_i')); - } - - 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) { - case 'c': //城市 - $data['infoTypeList'] = $this->config->item('InfoType_city'); - $data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id); - break; - case 'p'://省份 - $data['infoTypeList'] = $this->config->item('InfoType_province'); - break; - case 'n'://国家 - $data['infoTypeList'] = $this->config->item('InfoType_country'); - break; - case 't'://特殊区域 - $data['infoTypeList'] = $this->config->item('InfoType_special'); - break; - case 'e'://大洲 - $data['infoTypeList'] = array(); - break; - case 'z'://公民游 - $data['infoTypeList'] = $this->config->item('InfoType_citizen'); - break; - case 'v'://视频 - $data['infoTypeList'] = $this->config->item('InfoType_video'); - break; - case 'f'://节庆 - $data['infoTypeList'] = $this->config->item('InfoType_festival'); - break; - case 'pd'://产品管理 - $data['infoTypeList'] = $this->config->item('InfoType_product'); - //LMR 2016-7-14 - if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) { - $this->config->set_item('templates', $this->config->item('templates_product_i')); - } else { - $this->config->set_item('templates', $this->config->item('templates_product')); - } - break; - default: - $data['infoTypeList'] = array(); - break; - } - - - - $data['templateList'] = $this->config->item('templates'); - //翰特产品类型 - $data['productTypeList'] = $this->config->item('ProductType_HT'); - //获取绑定的产品名称 - switch ($data['information']->ic_ht_product_type) { - case 't': - $data['product_title'] = $this->Landscape_model->get_landscape_title($data['information']->ic_ht_product_id); - break; - default: - $data['product_title'] = ''; - break; - } - //获取最后更新者信息 - $data['last_edit_info'] = $this->Logs_model->get_last_edit($is_id); - - //编辑列表 - $sites = $this->config->item('site'); - $data['editor_list'] = $this->Operator_model->get_site_user($this->config->item('site_code')); - //获取作者列表 - $data['author_list'] = $this->Infoauthors_model->get_site_user($this->config->item('site_code')); - - //获取备份信息记录 - $data['content_backup_list'] = $this->Logs_model->get_backup_list($is_id); - - //所属导航栏目 - $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'); - } - - /** - public function redirect($jumpUrl){ - - header('HTTP/1.1 301 Moved Permanently'); - - header($jumpUrl);// 301 跳转到设置的 url - - exit(); - - } */ - public function test_proxy($url = false) { - $curl = curl_init(); - //curl_setopt($curl,CURLOPT_URL, "http://graph.facebook.com/?id=http://www.chinahighlights.com"); - //curl_setopt($curl,CURLOPT_URL, 'http://graph.facebook.com/?id=http://www.mybeijingchina.com/beijing-attractions/beihai-park/'); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_HEADER, 0); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1); - curl_setopt($curl, CURLOPT_PROXY, "120.24.227.23:33333"); - $request = curl_exec($curl); - curl_close($curl); - return $request; - //echo $request; - } - - // 分享数 lzq - public function statistical_sharing() { - - //$info_ic = $this->Information_model->get_ic_url_by_code('mbj'); - $info_ic = $this->Information_model->get_ic_url(); - $ic_id = $info_ic->ic_id; - $ic_url = $info_ic->ic_url; - $ic_sitecode = $info_ic->ic_sitecode; - $site = $this->config->item('site'); - - if (!empty($ic_url)) { - - $result = $this->Information_model->update_ic_date_by_code($ic_id); - //var_dump($site['mbj']['site_url']); - //$wz_url = 'http://graph.facebook.com/?id='.$site['mbj']['site_url'].$ic_url; - $complete_url = 'http://graph.facebook.com/?id=' . $site[$ic_sitecode]['site_url'] . $ic_url; - //echo $wz_url; - $api_return = $this->test_proxy($complete_url); - $api_return = json_decode($api_return); - if (empty($api_return->shares)) { - var_dump($api_return); - $shares = 0; - } else { - var_dump($api_return); - $shares = $api_return->shares; - } - - //echo $asd->shares; - $result2 = $this->Information_model->insert_url_to_csi($info_ic->ic_url, $ic_id, $info_ic->ic_sitecode, $shares); - } - - //$sstt = $this->config->item('site'); - //foreach($infolist as $k=>$v){ - // $aabb[] = $v->ic_sitecode; - //} - //$url_count = $this->Information_model->get_count_by_code('mbj'); - //$surl = site_url('/information/fengxiangshu'); - //redirect($surl,'refresh',301); - - $this->load->view('bootstrap3/header'); - $this->load->view('bootstrap3/statistical_sharing'); - } - - public function edit_save() { - header('Cache-Control: no-cache'); - $information = $this->Information_model->Detail($this->input->post('is_id')); - if ($information === false) { - $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound')); - echo json_encode($data); - return false; - } - - $this->form_validation->set_rules('ic_url_title', 'lang:ic_url_title', 'required'); - $this->form_validation->set_rules('ic_title', 'lang:ic_title', 'required'); - $this->form_validation->set_rules('ic_author', 'lang:ic_author', 'required'); - $this->form_validation->set_rules('ic_url', 'lang:ic_url', 'callback_ic_url_check'); - //这里比较特别,检测两次ic_url,ci会冲掉第一个ic_url的规则,所以需要在下面也加上callback_ic_url_check - $this->form_validation->set_rules('ic_url', 'lang:ic_url_format', 'callback_ic_url_check|callback_ic_url_format'); - - if ($this->input->post('ignore_seo_check') === false) { - $this->form_validation->set_rules('ic_seo_title', 'lang:ic_seo_title', 'required'); - $this->form_validation->set_rules('ic_seo_description', 'lang:ic_seo_description', 'required|max_length[250]'); - } - if ($this->form_validation->run() == FALSE) { - $data = array(); - foreach ($this->form_validation->_error_array as $key => $value) { - $data[] = array('name' => $key, 'value' => $value); - } - echo json_encode($data); - } 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')); - - //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 - //为新闻添加默认发布时间 - $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())); - } - - //如果URL有修改也删除静态文件 - if ($this->input->post('ic_url') != $information->ic_url) { - $this->update_cache($information->ic_url, true); - } - - //如果信息不发布则删除静态文件 - if ($this->input->post('ic_status') == '0') { - $this->update_cache($this->input->post('ic_url'), true); - } - - //德语站FAQ版块需要删除原来的文件才能更新静态 - $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 (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 && strcasecmp($site_code, "gm") != 0) {//非cht站点并且非GM - $update_info_log = $this->update_cache($ic_url); - } - - if (empty($update_info_log) || count($update_info_log) == 0 || !isset($update_info_log[0]['url'])) { - $update_info_log = 'not found update info log'; - } - - $data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'), 'update_info_log' => $update_info_log); - $this->Logs_model->backup($information->is_id, $this->input->post('ic_content')); - $this->Logs_model->backup_summary($information->is_id, $this->input->post('ic_summary')); - - //作者个人页面更新 - if ($this->config->item('site_code') == 'cht') { - $author_pages = array( - 'zzy' => 'http://www.chinahighlights.com/author/ruru-zhou/', - 'Gavin' => 'http://www.chinahighlights.com/author/gavin-van-hinsbergh/', - 'WBL' => 'http://www.chinahighlights.com/author/annie-wu/', - 'PKL' => 'http://www.chinahighlights.com/author/kelly/', - '210000017' => 'http://www.chinahighlights.com/author/lynne-buddin/', - '202000027' => 'http://www.chinahighlights.com/author/margaux/', - '202000019' => 'http://www.chinahighlights.com/author/anusuya-mitra/', - '210000018' => 'http://www.chinahighlights.com/author/connie/', - '210000016' => 'http://www.chinahighlights.com/author/ben/', - '200000008' => 'http://www.chinahighlights.com/author/pete-marchetto/', - '210000019' => 'http://www.chinahighlights.com/author/oscar/', - '210000021' => 'http://www.chinahighlights.com/author/matthew/', - '200000013' => 'http://www.chinahighlights.com/author/kit-onslow-smith/', - '202000018' => 'http://www.chinahighlights.com/author/klaus-capra/', - '202000017' => 'http://www.chinahighlights.com/author/christy-campbell/' - ); - $key = $this->input->post('ic_author'); - if (isset($author_pages[$key])) { - $this->update_cache($author_pages[$key]); - } - } - - echo json_encode($data); - } - } - - //URL不重复检查 - function ic_url_check() { - if ($this->input->post('ignore_url_check')) { - return true; - } - - $url = $this->input->post('ic_url'); - if ($url === '') { - return true; - } - $is_id = $this->input->post('is_id'); - return $this->Information_model->URLcheck($is_id, $url); - } - - //URL格式检查,不能包含大小写、空格等特殊字符 - function ic_url_format($url) { - if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) { - return false; - } - return true; - } - - //更新静态文件 - //不用参数提交的原因是可能url带有特殊字符,CI会报错 - public function update_cache($static_html_url = false, $delete_only = false) { - $url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url'); - $url = str_replace($this->config->item('site_url'), '', $url); - $original_url = $url; //原始链接 - $delete_only = !empty($delete_only) ? $delete_only : $this->input->get_post('delete_only'); - - switch ($this->config->item('site_code')) { - case 'cht': - $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; - } else {// static_html_optimize=comeon 启用静态化压缩和js、css延迟加载 - $url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon'; - } - break; - - case 'gm': - GET_HTTP("http://148.251.35.42:3300/create-cache/?url=" . urlencode($url)); //请求nodejs静态化更新页面,删除缓存,因为部分页面没有进入信息平台 - 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)); - $url = "http://144.76.185.44:8029" . $url; - } - break; - - case 'vac'://国际站 - case 'vc': - case 'it': - case 'ru': - case 'jp': - if ($delete_only) { - //只删除操作,在url修改和不发布信息的时候使用 - $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url; - } else { - $information = $this->Information_model->Detail($url); - $tmp = $url; - //判断是否是更新信息 - // 产品页面不能生成静态页面,比如/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/welcome/update_cache/?static_html_url=' . $url; - } - if (isset($information->ic_type) && $information->ic_type == 'product') { - $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp; - } - } - break; - - case 'ct'://子站点使用 - case 'sht': - case 'gl': - case 'mbj': - case 'yz': - $url = $this->config->item('site_url') . $url . '@cache@refresh'; - break; - default:return false; - break; - } - - $content = GET_HTTP($url); - if ($content === false) { - $data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_cache_failed'), $url)); - } else { - //手动更新的话,接着更新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'); - } else { - $msg .= $this->lang->line('update_cdn_failed') . '
' . $notice; - } - } - $data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url); - } - //如果是外部调用就返回结果,内部就不返回了 - if ($this->input->post('cache_url')) { - echo json_encode($data); - } - return $data; - } - - //更新CDN缓存 - public function update_cdn($static_html_url = false) { - $flag = false; //false:不更新,true:更新 - $update_site = array('jp', 'ru'); //需要更新CDN的站点 - //需要更新的url - $url = $static_html_url; - if (empty($url)) - $url = $this->input->post('cache_url'); - - //如果传递进来的url是带有域名,则对域名进行判断 - $tempu = parse_url($url); - if (isset($tempu['host'])) { - $url = isset($tempu['path']) ? $tempu['path'] : '/'; - $pad = $tempu['host']; - $flag = true; - } - //如果传递进来的url没有域名,则使用当前站点的信息进行判断 - else { - $url = str_replace($this->config->item('site_url'), '', $url); - $pad = str_replace('http://', '', $this->config->item('site_url')); - if (in_array($this->config->item('site_code'), $update_site)) - $flag = TRUE; - } - - //默认更新成功,如果不成功,则返回错误提示信息 - $notice = 200; - if ($flag) { - $result = GET_HTTP('https://openapi.us.cdnetworks.com/purge/rest/doPurge?user=ycc@chinahighlights.com&pass=cXi2UbsTrw9Urv@&pad=' . $pad . '&type=item&path=' . $url . '&output=json'); - $result = json_decode($result, true); - if ($result['resultCode'] != 200) - $notice = $result['notice'] . $result['details']; - } - return $notice; - } - - //获取产品信息,提供给用户选择进行绑定 - function get_products() { - $HT_productType = $this->input->post('product_type'); - $HT_productName = $this->input->post('product_name'); - //产品类型 - switch ($HT_productType) { - case 't': - $data['productList'] = $this->Landscape_model->search_list($HT_productName); - break; - default: - $data['productList'] = array(); - break; - } - $data['product_type'] = $HT_productType; - $product_list_page = $this->load->view('bootstrap/information_select_product', $data, true); - $data = array(); - $data[] = array('name' => 'ok', 'value' => $product_list_page); - echo json_encode($data); - return true; - } - - //显示备份的内容 - function backup_content($log_id) { - $data['log_info'] = $this->Logs_model->read($log_id); - $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id); - $this->load->view('bootstrap/header', $data); - $this->load->view('bootstrap/information_backup_content'); - $this->load->view('bootstrap/footer'); - } - - //保存自定义配置 - function save_meta() { - $im_ic_id = $this->input->post('im_ic_id'); - $im_key = $this->input->post('im_key'); - $im_value = $this->input->post('im_value'); - if ($im_ic_id && $im_key && $im_value !== false) { - $meta = $this->InfoMetas_model->get($im_ic_id, $im_key); - if ($meta === false) { - $this->InfoMetas_model->add($im_ic_id, $im_key, $im_value); - } else { - $this->InfoMetas_model->update($im_ic_id, $im_key, $im_value); - } - $data[] = array('name' => 'ok', 'value' => $this->lang->line('media_save_success')); - } else { - $data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error')); - } - echo json_encode($data); - return true; - } - - //保存自定义配置 - function delete_meta() { - $im_ic_id = $this->input->post('im_ic_id'); - $im_key = $this->input->post('im_key'); - if ($im_ic_id && $im_key) { - - $this->InfoMetas_model->delete($im_ic_id, $im_key); - $data[] = array('name' => 'ok', 'value' => $this->lang->line('media_delete_success')); - } else { - $data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error')); - } - echo json_encode($data); - return true; - } - -} +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'); + $this->load->model('Landscape_model'); + $this->load->model('Operator_model'); + $this->load->model('Logs_model'); + $this->load->model('InfoMetas_model'); + $this->load->model('Infoauthors_model'); + $this->load->model('InfoSMS_model'); + $this->load->library('Amplib'); //加载AMP处理类 + } + + public function index() { + echo '信息首页'; + } + + public function add($is_parent_id) { + //添加空内容. + $this->InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', ''); + $infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id); + if (!empty($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) { + $is_id = $this->InfoStructures_model->insert_id; + $InfoStructures = $this->InfoStructures_model->Detail($is_id); + $InfoStructures->is_id = $is_id; + $data[] = array('name' => 'ok', 'value' => $InfoStructures); + $this->Logs_model->add($this->InfoStructures_model->insert_id); + } else { + $data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error')); + } + echo json_encode($data); + return TRUE; + } + + //移动结构顺序 + public function move() { + //网站会提交一个同级节点id列表字符串,按照这个去排序 + $parent_id = $this->input->post('pid'); + $idsStr = $this->input->post('ids'); + $idsArray = explode(',', $idsStr); + foreach ($idsArray as $key => $value) { + if ($value) { + //设置排序 + $this->InfoStructures_model->set_sort($value, $key); + //设置path + $this->InfoStructures_model->set_path($parent_id, $value); + } + } + $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move')); + echo json_encode($data); + $this->Logs_model->move($idsStr); + return TRUE; + } + + //把文章移动到任意板块文章下 + //is_id 信息结构ID,is_parent_id即将转移到的信息结构id + public function move_by_is_id() { + $data = array(); + $is_id = $this->input->post('is_id'); + $is_parent_id = $this->input->post('is_parent_id'); + if ($is_id == $is_parent_id || empty($is_id) || empty($is_parent_id)) { + return false; + } + //即将移动到文章结构信息 + $Structure = $this->InfoStructures_model->Detail($is_id); + //目标文章结构信息 + $Structure_parent = $this->InfoStructures_model->Detail($is_parent_id); + //只能移动到本站点下 + if ($Structure->is_sitecode == $Structure_parent->is_sitecode) { + //不能搬迁到自己的子节点下 + if (strpos(',' . $Structure_parent->is_path, ',' . $is_id . ',') == false) { + $this->InfoStructures_model->set_path($is_parent_id, $is_id); + } + //信息的区域类型和id也要修改 todo + } + $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move')); + echo json_encode($data); + $this->Logs_model->move($is_id); + return TRUE; + } + + public function delete($is_id) { + //查询结构信息 + $Structure = $this->InfoStructures_model->Detail($is_id); + if ($Structure == FALSE) { + $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound')); + echo json_encode($data); + return false; + } + if ($this->InfoStructures_model->HasChild($Structure->is_id)) { + $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_haschild')); + echo json_encode($data); + return false; + } else { + $info_detail = $this->Information_model->Detail($is_id); + $this->Logs_model->delete($is_id, $info_detail->ic_content); + if (!empty($info_detail->ic_summary)) { + $this->Logs_model->backup_summary($is_id, $info_detail->ic_summary); + } + $this->InfoStructures_model->Delete($Structure->is_id); + $this->InfoContents_model->Delete($Structure->is_ic_id); + //如果是已经发布的页面,删除静态文件 + if ($info_detail->ic_status == 1) { + $this->update_cache($info_detail->ic_url, true); + } + //删除成功后返回一个上级链接给用户 + $drumpurl = site_url('information/edit/' . $Structure->is_parent_id); + if ($Structure->is_parent_id == 0) + $drumpurl = site_url('/'); + $data[] = array('name' => 'ok', 'value' => $drumpurl); + echo json_encode($data); + return true; + } + } + + public function edit($is_id) { + set_time_limit(30); + //$this->output->enable_profiler(true); + //查询结构信息 + $Structure = $this->InfoStructures_model->Detail($is_id); + if ($Structure == FALSE) { + show_404(); + } + //查询结构根节点 + $rootStructure = $this->InfoStructures_model->GetParent($Structure->is_path, 1); + //没有根节点就从它本身开始查询 + if ($rootStructure == false) { + $rootStructure_ID = $Structure->is_id; + } else { + $rootStructure_ID = $rootStructure->is_id; + } + + //查询结构列表信息 + $data['informationList'] = $this->Information_model->StructureList($rootStructure_ID); + + //增加一项,属于这个区域,但是结构数据层次不准确的也要列出来 + //todo: + //信息内容 + $data['information'] = $this->Information_model->Detail($is_id); + + //检查该信息是否已收录 + $data['embody'] = 1; + if (isset($data['information']->ic_id)) { + $embody = $this->InfoMetas_model->get($data['information']->ic_id, 'meta_embody'); + if ($embody && $embody != '1') { + $data['embody'] = 0; + } + //设置该信息所有未读消息为已读 + $this->InfoSMS_model->readed_for_info($data['information']->ic_id); + } + + //主节点信息 + $data['rootInformation'] = $this->Information_model->Detail($rootStructure_ID); + //获取未绑定的景点,只有城市有,无视其它区域类型 + $data['unlink_landscape_list'] = array(); + + //可选的展示模板 + if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) { + $this->config->set_item('templates', $this->config->item('templates_i')); + } + + 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')); + } + + + + if ($Structure->is_sitecode=='ct'){ + $data['infoTypeList'] = $this->config->item('InfoType_ct'); + }else { + + switch ($data['rootInformation']->ic_ht_area_type) { + case 'c': //城市 + $data['infoTypeList'] = $this->config->item('InfoType_city'); + $data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id); + break; + case 'p'://省份 + $data['infoTypeList'] = $this->config->item('InfoType_province'); + break; + case 'n'://国家 + $data['infoTypeList'] = $this->config->item('InfoType_country'); + break; + case 't'://特殊区域 + $data['infoTypeList'] = $this->config->item('InfoType_special'); + break; + case 'e'://大洲 + $data['infoTypeList'] = array(); + break; + case 'z'://公民游 + $data['infoTypeList'] = $this->config->item('InfoType_citizen'); + break; + case 'v'://视频 + $data['infoTypeList'] = $this->config->item('InfoType_video'); + break; + case 'f'://节庆 + $data['infoTypeList'] = $this->config->item('InfoType_festival'); + break; + case 'pd'://产品管理 + $data['infoTypeList'] = $this->config->item('InfoType_product'); + //LMR 2016-7-14 + if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) { + $this->config->set_item('templates', $this->config->item('templates_product_i')); + } else { + $this->config->set_item('templates', $this->config->item('templates_product')); + } + break; + default: + $data['infoTypeList'] = array('不设置' => 'none'); + break; + } + } + + + + $data['templateList'] = $this->config->item('templates'); + //翰特产品类型 + $data['productTypeList'] = $this->config->item('ProductType_HT'); + //获取绑定的产品名称 + switch ($data['information']->ic_ht_product_type) { + case 't': + $data['product_title'] = $this->Landscape_model->get_landscape_title($data['information']->ic_ht_product_id); + break; + default: + $data['product_title'] = ''; + break; + } + //获取最后更新者信息 + $data['last_edit_info'] = $this->Logs_model->get_last_edit($is_id); + + //编辑列表 + $sites = $this->config->item('site'); + $data['editor_list'] = $this->Operator_model->get_site_user($this->config->item('site_code')); + //获取作者列表 + $data['author_list'] = $this->Infoauthors_model->get_site_user($this->config->item('site_code')); + + //获取备份信息记录 + $data['content_backup_list'] = $this->Logs_model->get_backup_list($is_id); + + //所属导航栏目 + $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'); + } + + /** + public function redirect($jumpUrl){ + + header('HTTP/1.1 301 Moved Permanently'); + + header($jumpUrl);// 301 跳转到设置的 url + + exit(); + + } */ + public function test_proxy($url = false) { + $curl = curl_init(); + //curl_setopt($curl,CURLOPT_URL, "http://graph.facebook.com/?id=http://www.chinahighlights.com"); + //curl_setopt($curl,CURLOPT_URL, 'http://graph.facebook.com/?id=http://www.mybeijingchina.com/beijing-attractions/beihai-park/'); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_HEADER, 0); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1); + curl_setopt($curl, CURLOPT_PROXY, "120.24.227.23:33333"); + $request = curl_exec($curl); + curl_close($curl); + return $request; + //echo $request; + } + + // 分享数 lzq + public function statistical_sharing() { + + //$info_ic = $this->Information_model->get_ic_url_by_code('mbj'); + $info_ic = $this->Information_model->get_ic_url(); + $ic_id = $info_ic->ic_id; + $ic_url = $info_ic->ic_url; + $ic_sitecode = $info_ic->ic_sitecode; + $site = $this->config->item('site'); + + if (!empty($ic_url)) { + + $result = $this->Information_model->update_ic_date_by_code($ic_id); + //var_dump($site['mbj']['site_url']); + //$wz_url = 'http://graph.facebook.com/?id='.$site['mbj']['site_url'].$ic_url; + $complete_url = 'http://graph.facebook.com/?id=' . $site[$ic_sitecode]['site_url'] . $ic_url; + //echo $wz_url; + $api_return = $this->test_proxy($complete_url); + $api_return = json_decode($api_return); + if (empty($api_return->shares)) { + var_dump($api_return); + $shares = 0; + } else { + var_dump($api_return); + $shares = $api_return->shares; + } + + //echo $asd->shares; + $result2 = $this->Information_model->insert_url_to_csi($info_ic->ic_url, $ic_id, $info_ic->ic_sitecode, $shares); + } + + //$sstt = $this->config->item('site'); + //foreach($infolist as $k=>$v){ + // $aabb[] = $v->ic_sitecode; + //} + //$url_count = $this->Information_model->get_count_by_code('mbj'); + //$surl = site_url('/information/fengxiangshu'); + //redirect($surl,'refresh',301); + + $this->load->view('bootstrap3/header'); + $this->load->view('bootstrap3/statistical_sharing'); + } + + public function edit_save() { + header('Cache-Control: no-cache'); + $information = $this->Information_model->Detail($this->input->post('is_id')); + if ($information === false) { + $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound')); + echo json_encode($data); + return false; + } + + $this->form_validation->set_rules('ic_url_title', 'lang:ic_url_title', 'required'); + $this->form_validation->set_rules('ic_title', 'lang:ic_title', 'required'); + $this->form_validation->set_rules('ic_author', 'lang:ic_author', 'required'); + $this->form_validation->set_rules('ic_url', 'lang:ic_url', 'callback_ic_url_check'); + //这里比较特别,检测两次ic_url,ci会冲掉第一个ic_url的规则,所以需要在下面也加上callback_ic_url_check + $this->form_validation->set_rules('ic_url', 'lang:ic_url_format', 'callback_ic_url_check|callback_ic_url_format'); + + if ($this->input->post('ignore_seo_check') === false) { + $this->form_validation->set_rules('ic_seo_title', 'lang:ic_seo_title', 'required'); + $this->form_validation->set_rules('ic_seo_description', 'lang:ic_seo_description', 'required|max_length[250]'); + } + if ($this->form_validation->run() == FALSE) { + $data = array(); + foreach ($this->form_validation->_error_array as $key => $value) { + $data[] = array('name' => $key, 'value' => $value); + } + echo json_encode($data); + } 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')); + + //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 + //为新闻添加默认发布时间 + $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())); + } + + //如果URL有修改也删除静态文件 + if ($this->input->post('ic_url') != $information->ic_url) { + $this->update_cache($information->ic_url, true); + } + + //如果信息不发布则删除静态文件 + if ($this->input->post('ic_status') == '0') { + $this->update_cache($this->input->post('ic_url'), true); + } + + //德语站FAQ版块需要删除原来的文件才能更新静态 + $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 (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 && strcasecmp($site_code, "gm") != 0) {//非cht站点并且非GM + $update_info_log = $this->update_cache($ic_url); + } + + if (empty($update_info_log) || count($update_info_log) == 0 || !isset($update_info_log[0]['url'])) { + $update_info_log = 'not found update info log'; + } + + $data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'), 'update_info_log' => $update_info_log); + $this->Logs_model->backup($information->is_id, $this->input->post('ic_content')); + $this->Logs_model->backup_summary($information->is_id, $this->input->post('ic_summary')); + + //作者个人页面更新 + if ($this->config->item('site_code') == 'cht') { + $author_pages = array( + 'zzy' => 'http://www.chinahighlights.com/author/ruru-zhou/', + 'Gavin' => 'http://www.chinahighlights.com/author/gavin-van-hinsbergh/', + 'WBL' => 'http://www.chinahighlights.com/author/annie-wu/', + 'PKL' => 'http://www.chinahighlights.com/author/kelly/', + '210000017' => 'http://www.chinahighlights.com/author/lynne-buddin/', + '202000027' => 'http://www.chinahighlights.com/author/margaux/', + '202000019' => 'http://www.chinahighlights.com/author/anusuya-mitra/', + '210000018' => 'http://www.chinahighlights.com/author/connie/', + '210000016' => 'http://www.chinahighlights.com/author/ben/', + '200000008' => 'http://www.chinahighlights.com/author/pete-marchetto/', + '210000019' => 'http://www.chinahighlights.com/author/oscar/', + '210000021' => 'http://www.chinahighlights.com/author/matthew/', + '200000013' => 'http://www.chinahighlights.com/author/kit-onslow-smith/', + '202000018' => 'http://www.chinahighlights.com/author/klaus-capra/', + '202000017' => 'http://www.chinahighlights.com/author/christy-campbell/' + ); + $key = $this->input->post('ic_author'); + if (isset($author_pages[$key])) { + $this->update_cache($author_pages[$key]); + } + } + + echo json_encode($data); + } + } + + //URL不重复检查 + function ic_url_check() { + if ($this->input->post('ignore_url_check')) { + return true; + } + + $url = $this->input->post('ic_url'); + if ($url === '') { + return true; + } + $is_id = $this->input->post('is_id'); + return $this->Information_model->URLcheck($is_id, $url); + } + + //URL格式检查,不能包含大小写、空格等特殊字符 + function ic_url_format($url) { + if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) { + return false; + } + return true; + } + + //更新静态文件 + //不用参数提交的原因是可能url带有特殊字符,CI会报错 + public function update_cache($static_html_url = false, $delete_only = false) { + $url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url'); + $url = str_replace($this->config->item('site_url'), '', $url); + $original_url = $url; //原始链接 + $delete_only = !empty($delete_only) ? $delete_only : $this->input->get_post('delete_only'); + + switch ($this->config->item('site_code')) { + case 'cht': + $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; + } else {// static_html_optimize=comeon 启用静态化压缩和js、css延迟加载 + $url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon'; + } + break; + + case 'gm': + //GET_HTTP("http://148.251.35.42:3300/create-cache/?url=" . urlencode($url)); //请求nodejs静态化更新页面,删除缓存,因为部分页面没有进入信息平台 + 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)); + $url = "http://144.76.185.44:8029" . $url; + } + break; + + case 'vac'://国际站 + case 'vc': + case 'it': + case 'ru': + case 'jp': + if ($delete_only) { + //只删除操作,在url修改和不发布信息的时候使用 + $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url; + } else { + $information = $this->Information_model->Detail($url); + $tmp = $url; + //判断是否是更新信息 + // 产品页面不能生成静态页面,比如/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/welcome/update_cache/?static_html_url=' . $url; + } + if (isset($information->ic_type) && $information->ic_type == 'product') { + $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp; + } + //int return direct + $cache_url = $this->input->post('cache_url'); + if ($url && !$cache_url) { + /* + ignore_user_abort(true); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_TIMEOUT, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容 + curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD + curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); + curl_setopt($ch, CURLOPT_NOBODY, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_exec($ch); + curl_close($ch); + */ + $data['async_update'] = $url; + $data[] = array('name' => 'ok', 'value' => '信息保存成功,请在8秒后检查更新页面。', 'url' => $url); + //如果是外部调用就返回结果,内部就不返回了 + if ($cache_url) { + echo json_encode($data); + } + return $data; + } + } + break; + + case 'ct'://子站点使用 + case 'sht': + case 'gl': + case 'mbj': + case 'yz': + $url = $this->config->item('site_url') . $url . '@cache@refresh'; + break; + default:return false; + break; + } + + $content = GET_HTTP($url); + if ($content === false) { + $data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_cache_failed'), $url)); + } else { + //手动更新的话,接着更新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'); + } else { + $msg .= $this->lang->line('update_cdn_failed') . '
' . $notice; + } + } + $data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url); + } + //如果是外部调用就返回结果,内部就不返回了 + if ($this->input->post('cache_url')) { + echo json_encode($data); + } + return $data; + } + + //更新CDN缓存 + public function update_cdn($static_html_url = false) { + $flag = false; //false:不更新,true:更新 + $update_site = array('jp', 'ru'); //需要更新CDN的站点 + //需要更新的url + $url = $static_html_url; + if (empty($url)) + $url = $this->input->post('cache_url'); + + //如果传递进来的url是带有域名,则对域名进行判断 + $tempu = parse_url($url); + if (isset($tempu['host'])) { + $url = isset($tempu['path']) ? $tempu['path'] : '/'; + $pad = $tempu['host']; + $flag = true; + } + //如果传递进来的url没有域名,则使用当前站点的信息进行判断 + else { + $url = str_replace($this->config->item('site_url'), '', $url); + $pad = str_replace('http://', '', $this->config->item('site_url')); + if (in_array($this->config->item('site_code'), $update_site)) + $flag = TRUE; + } + + //默认更新成功,如果不成功,则返回错误提示信息 + $notice = 200; + if ($flag) { + $result = GET_HTTP('https://openapi.us.cdnetworks.com/purge/rest/doPurge?user=ycc@chinahighlights.com&pass=cXi2UbsTrw9Urv@&pad=' . $pad . '&type=item&path=' . $url . '&output=json'); + $result = json_decode($result, true); + if ($result['resultCode'] != 200) + $notice = $result['notice'] . $result['details']; + } + return $notice; + } + + //获取产品信息,提供给用户选择进行绑定 + function get_products() { + $HT_productType = $this->input->post('product_type'); + $HT_productName = $this->input->post('product_name'); + //产品类型 + switch ($HT_productType) { + case 't': + $data['productList'] = $this->Landscape_model->search_list($HT_productName); + break; + default: + $data['productList'] = array(); + break; + } + $data['product_type'] = $HT_productType; + $product_list_page = $this->load->view('bootstrap/information_select_product', $data, true); + $data = array(); + $data[] = array('name' => 'ok', 'value' => $product_list_page); + echo json_encode($data); + return true; + } + + //显示备份的内容 + function backup_content($log_id) { + $data['log_info'] = $this->Logs_model->read($log_id); + $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id); + $this->load->view('bootstrap/header', $data); + $this->load->view('bootstrap/information_backup_content'); + $this->load->view('bootstrap/footer'); + } + + //保存自定义配置 + function save_meta() { + $im_ic_id = $this->input->post('im_ic_id'); + $im_key = $this->input->post('im_key'); + $im_value = $this->input->post('im_value'); + if ($im_ic_id && $im_key && $im_value !== false) { + $meta = $this->InfoMetas_model->get($im_ic_id, $im_key); + if ($meta === false) { + $this->InfoMetas_model->add($im_ic_id, $im_key, $im_value); + } else { + $this->InfoMetas_model->update($im_ic_id, $im_key, $im_value); + } + $data[] = array('name' => 'ok', 'value' => $this->lang->line('media_save_success')); + } else { + $data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error')); + } + echo json_encode($data); + return true; + } + + //保存自定义配置 + function delete_meta() { + $im_ic_id = $this->input->post('im_ic_id'); + $im_key = $this->input->post('im_key'); + if ($im_ic_id && $im_key) { + + $this->InfoMetas_model->delete($im_ic_id, $im_key); + $data[] = array('name' => 'ok', 'value' => $this->lang->line('media_delete_success')); + } else { + $data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error')); + } + echo json_encode($data); + return true; + } + +} diff --git a/application/controllers/keyworlds.php b/application/controllers/keyworlds.php index 472f0b9b..ae82e562 100644 --- a/application/controllers/keyworlds.php +++ b/application/controllers/keyworlds.php @@ -15,9 +15,6 @@ class Keyworlds extends CI_Controller { } public function index($kw_is_id = '') { - $this->load->library('Accesscheck'); - $this->accesscheck->check_access(); - $this->permission->is_admin(); //查询结构列表信息 $data['keyworldsList'] = $this->Keywords_model->get_structure_list(); diff --git a/application/controllers/login.php b/application/controllers/login.php index 9f6c418f..4c0d5011 100644 --- a/application/controllers/login.php +++ b/application/controllers/login.php @@ -61,10 +61,6 @@ class Login extends CI_Controller { $admin_info = $this->session->userdata('session_admin'); if ($this->accesscheck->check_access($site_code)) { $this->session->set_userdata('session_site', $site_item); - $this->session->unset_userdata('access_module'); - $this->session->unset_userdata('access_read_list'); - $this->session->unset_userdata('access_write_list'); - $this->session->unset_userdata('access_sitecode'); } } //跳转到指定页面。 diff --git a/application/controllers/province.php b/application/controllers/province.php index 9b982144..00051438 100644 --- a/application/controllers/province.php +++ b/application/controllers/province.php @@ -19,8 +19,6 @@ class Province extends CI_Controller public function index($province_id=0) { - $this->load->library('Accesscheck'); - $this->accesscheck->check_access(); //查询不到省份信息则显示错误 $data['province'] = $this->Area_model->get_province($province_id); if ($data['province'] == FALSE) diff --git a/application/controllers/seo.php b/application/controllers/seo.php index 74ac123b..ab0a152f 100644 --- a/application/controllers/seo.php +++ b/application/controllers/seo.php @@ -14,8 +14,6 @@ class Seo extends CI_Controller { $this->load->model('InfoContents_model'); $this->load->model('InfoStructures_model'); $this->load->model('InfoSEOs_model'); - $this->load->library('Accesscheck'); - $this->accesscheck->check_access(); } public function index() { diff --git a/application/libraries/Accesscheck.php b/application/libraries/Accesscheck.php index bb0a3fc0..8f9faebf 100644 --- a/application/libraries/Accesscheck.php +++ b/application/libraries/Accesscheck.php @@ -18,16 +18,9 @@ class Accesscheck extends CI_Controller return true; } - if ($this->session->userdata('access_module') === false){ - $this->init_accessdata(); - } + $this->session->set_userdata('access_sitecode', $this->Access_model->get_user_site_list($userdata['OPI_Code'])); //用户拥有权限de站点、模块&需要权限认证的模块 - $access_module = $this->session->userdata('access_module'); - $user_controller = $access_module['user_controller']; - $user_action = $access_module['user_action']; - $iaa_controller_list = $access_module['iaa_controller_list']; - $iaa_action_list = $access_module['iaa_action_list']; - $user_site_list = $this->session->userdata('access_sitecode'); + $user_site_list = $this->session->userdata('access_sitecode'); //检测用户是否能访问当前站点,如果不能,则跳转到该用户有权限的站点 if($site_code=='')$site_code=$this->config->item('site_code'); @@ -35,86 +28,9 @@ class Accesscheck extends CI_Controller header('Location: '.$_SERVER['HTTP_REFERER']); exit(); } - - //判断当前操作是否需要认证 - $flag=true; - if ($module!='') { - $module_array=explode('/', trim($module)); - $this->router->class= $module_array[0]; - $this->router->method= $module_array[1]; - } - //判断当前模块是否需要认证 - if (in_array($this->router->class, $iaa_controller_list)) { - //如果需要认证,判断是否有权限操作当前模块 - if (in_array($this->router->class,$user_controller)) { - //判断是否能编辑不同省份信息 - /*if($this->router->class=='province'){ - $province=str_replace('/province/', '', $this->uri->uri_string()); - $province=trim($province); - if (!isset($user_action[$this->router->class]) || !in_array($province, $user_action[$this->router->class])) { - $flag = false;//没有权限查看当前省份! - } - } - //判断当前方法是否需要认证 - else*/ - if (isset($iaa_action_list[$this->router->class]) && in_array($this->router->method, $iaa_action_list[$this->router->class])) { - //如果当前方法需要认证,则判断是否有权限 - if (!isset($user_action[$this->router->class]) || !in_array($this->router->method, $user_action[$this->router->class])) { - $flag = false;//没有权限执行当前方法! - } - } - }else { - $flag = false;//没有权限执行当前控制器模块! - } - } - if ($module =='' && !$flag) { - redirect(site_url('Login/refuse')); - exit(); - } - return $flag; + return true; } - public function init_accessdata(){ - $userdata=$this->session->userdata('session_admin'); - //根据usercode获取用户角色、可读、可写列表 - $user_access=$this->Access_model->get_user_access($userdata['OPI_Code'],$this->config->item('site_code')); - //根据角色字符串获取用户有权限的操作 - $user_node=$this->Access_model->get_node_list($user_access->iao_role.'0'); - //把用户拥有的所有角色id组装成一个数组集合 - $node_str=''; - foreach ($user_node as $node) { - $node_str.=$node->ian_iaa_id; - } - $node_array=explode(',', substr($node_str, 0,-1)); - - //用户拥有权限de站点、模块&需要权限认证的模块 - $user_controller = array(); - $user_action = array(); - $iaa_controller_list = array(); - $iaa_action_list = array(); - - //所有需要认证的模块、方法 - $action_list=$this->Access_model->get_action_list(); - foreach ($action_list as $a) { - - //用户拥有的权限模块、方法 - if (in_array($a->iaa_id, $node_array) && $a->iaa_controller!='') { - $user_controller[] = $a->iaa_controller; - $user_action[$a->iaa_controller][] = $a->iaa_action; - } - //需要认证的控制器和方法 - if(!empty($a->iaa_controller))$iaa_controller_list[]=$a->iaa_controller; - if(!empty($a->iaa_action))$iaa_action_list[$a->iaa_controller][]=$a->iaa_action; - } - $access_module['user_controller'] = $user_controller; - $access_module['user_action'] = $user_action; - $access_module['iaa_controller_list'] = $iaa_controller_list; - $access_module['iaa_action_list'] = $iaa_action_list; - $this->session->set_userdata('access_read_list', $user_access->iao_read); - $this->session->set_userdata('access_write_list', $user_access->iao_write); - $this->session->set_userdata('access_sitecode', $this->Access_model->get_user_site_list($userdata['OPI_Code'])); - $this->session->set_userdata('access_module', $access_module); - } //获取角色等级(角色树形结构的等级) public function get_role_level($site_code='',$author=''){ diff --git a/application/libraries/Amplib.php b/application/libraries/Amplib.php index 5630d27b..59239abf 100644 --- a/application/libraries/Amplib.php +++ b/application/libraries/Amplib.php @@ -14,6 +14,7 @@ class Amplib { $this->CI = & get_instance(); $this->CI->load->model('Information_model'); $this->CI->load->model('InfoMetas_model'); + $this->CI->load->model('Logs_model'); } public function edit($ic_id) { @@ -59,12 +60,16 @@ class Amplib { $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'); + //德语站点走另外一个控制器,其他站点还是走原来的流程 + if($site_code == 'gm'){ + return GET_HTTP(site_url('/apps/htmlcompressor/index_gm/choose_way'), $post_data, 'POST'); + }else{ + return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST'); + } } return json_encode(array('result' => 'no', 'data' => '不知道哪里错了,看代码')); } @@ -89,6 +94,9 @@ class Amplib { //CH的页面没有canonical内容,在这里帮补上 $textarea_htmlcode = str_replace('', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode); + //备份修改的代码 + $this->CI->Logs_model->write('backup_amp', $ic_id, $textarea_htmlcode); + //AMP格式验证 if ($amp_status !== '0') {//只有发布的时候才需要验证 //把AMP网页内容到purifycss处理,内置了AMP-Validator diff --git a/application/libraries/MY_Composer.php b/application/libraries/MY_Composer.php new file mode 100644 index 00000000..6cad19e7 --- /dev/null +++ b/application/libraries/MY_Composer.php @@ -0,0 +1,15 @@ +. +// +// ---------------------------------------------------------------------------- +// +// Description : PHP class to read DOCX file into HTML format +// +// Author: Ricardo Pinto +// +// (c) Copyright: +// Ricardo Pinto +//============================================================+ + +class WordPHP +{ + private $debug = false; + private $file; + private $rels_xml; + private $doc_xml; + private $doc_media = array(); + private $last = 'none'; + private $encoding = 'UTF-8'; + private $tmpDir = 'tmp'; + //图片目录和前缀 + public $img_dir = ''; + public $img_prex = ''; + + /** + * CONSTRUCTOR + * + * @param Boolean $debug Debug mode or not + * @return void + */ + public function __construct($debug_=null, $encoding=null) + { + if($debug_ != null) { + $this->debug = $debug_; + } + if ($encoding != null) { + $this->encoding = $encoding; + } + $this->tmpDir = dirname(__FILE__); + } + + /** + * Sets the tmp directory where images will be stored + * + * @param string $tmp The location + * @return void + */ + private function setTmpDir($tmp) + { + $this->tmpDir = $tmp; + } + + /** + * READS The Document and Relationships into separated XML files + * + * @param var $object The class variable to set as DOMDocument + * @param var $xml The xml file + * @param string $encoding The encoding to be used + * @return void + */ + private function setXmlParts(&$object, $xml, $encoding) + { + $object = new DOMDocument(); + $object->encoding = $encoding; + $object->preserveWhiteSpace = false; + $object->formatOutput = true; + $object->loadXML($xml); + $object->saveXML(); + } + + /** + * READS The Document and Relationships into separated XML files + * + * @param String $filename The filename + * @return void + */ + private function readZipPart($filename) + { + $zip = new ZipArchive(); + $_xml = 'word/document.xml'; + $_xml_rels = 'word/_rels/document.xml.rels'; + + if (true === $zip->open($filename)) { + if (($index = $zip->locateName($_xml)) !== false) { + $xml = $zip->getFromIndex($index); + } + //Get the relationships + if (($index = $zip->locateName($_xml_rels)) !== false) { + $xml_rels = $zip->getFromIndex($index); + } + // load all images if they exist + for ($i=0; $i<$zip->numFiles;$i++) { + $zip_element = $zip->statIndex($i); + if(preg_match("([^\s]+(\.(?i)(jpg|jpeg|png|gif|bmp))$)",$zip_element['name'])) { + $this->doc_media[$zip_element['name']] = $zip_element['name']; + } + } + $zip->close(); + } else die('non zip file'); + + $enc = mb_detect_encoding($xml); + $this->setXmlParts($this->doc_xml, $xml, $enc); + $this->setXmlParts($this->rels_xml, $xml_rels, $enc); + + if($this->debug) { + echo ""; + echo ""; + } + } + + /** + * CHECKS THE FONT FORMATTING OF A GIVEN ELEMENT + * Currently checks and formats: bold, italic, underline, background color and font family + * + * @param XML $xml The XML node + * @return String HTML formatted code + */ + private function checkFormating(&$xml) + { + $node = trim($xml->readOuterXML()); + $t = ''; + // add
tags + if (mb_strstr($node,'XML($node); + $img = null; + + while ($reader->read()) { + if($reader->name == "w:b") { + $f .= "font-weight: bold,"; + } + if($reader->name == "w:i") { + $f .= "text-decoration: underline,"; + } + if($reader->name == "w:color") { + $f .="color: #".$reader->getAttribute("w:val").","; + } + if($reader->name == "w:rFont") { + $f .="font-family: #".$reader->getAttribute("w:ascii").","; + } + if($reader->name == "w:shd" && $reader->getAttribute("w:val") != "clear" && $reader->getAttribute("w:fill") != "000000") { + $f .="background-color: #".$reader->getAttribute("w:fill").","; + } + $temp_rx = $reader->readInnerXml(); + if($reader->name == 'w:drawing' && !empty($temp_rx)) { + $r = $this->checkImageFormating($reader); + $img = $r !== null ? "" : null; + } + } + + $f = rtrim($f, ','); + $f .= "'>"; + $t .= ($img !== null ? $img : htmlentities($xml->expand()->textContent)); + + return $f.$t.""; + } + + /** + * CHECKS THE ELEMENT FOR UL ELEMENTS + * Currently under development + * + * @param XML $xml The XML node + * @return String HTML formatted code + */ + private function getListFormating(&$xml) + { + $node = trim($xml->readOuterXML()); + + $reader = new XMLReader(); + $reader->XML($node); + $ret=""; + $close = ""; + while ($reader->read()){ + if($reader->name == "w:numPr" && $reader->nodeType == XMLReader::ELEMENT ) { + + } + if($reader->name == "w:numId" && $reader->hasAttributes) { + switch($reader->getAttribute("w:val")) { + case 1: + $ret['open'] = "
  1. "; + $ret['close'] = "
"; + break; + case 2: + $ret['open'] = ""; + break; + } + + } + } + return $ret; + } + + /** + * CHECKS IF THERE IS AN IMAGE PRESENT + * Currently under development + * + * @param XML $xml The XML node + * @return String The location of the image + */ + private function checkImageFormating(&$xml) + { + $content = trim($xml->readInnerXml()); + + if (!empty($content)) { + + $relId; + $notfound = true; + $reader = new XMLReader(); + $reader->XML($content); + + while ($reader->read() && $notfound) { + if ($reader->name == "a:blip") { + $relId = $reader->getAttribute("r:embed"); + $notfound = false; + } + } + + // image id found, get the image location + if (!$notfound && $relId) { + $reader = new XMLReader(); + $reader->XML($this->rels_xml->saveXML()); + + while ($reader->read()) { + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name=='Relationship') { + if($reader->getAttribute("Id") == $relId) { + $link = "word/".$reader->getAttribute('Target'); + break; + } + } + } + + $zip = new ZipArchive(); + $im = null; + if (true === $zip->open($this->file)) { + $im = $this->createImage($zip->getFromName($link), $relId, $link); + } + $zip->close(); + return $im; + } + } + + return null; + } + + /** + * Creates an image in the filesystem + * + * @param objetc $image The image object + * @param string $relId The image relationship Id + * @param string $name The image name + * @return Array With HTML open and closing tag definition + */ + private function createImage($image, $relId, $name) + { + $arr = explode('.', $name); + $l = count($arr); + $ext = mb_strtolower($arr[$l-1]); + + $im = imagecreatefromstring($image); + if (empty($this->img_dir)) { + $fname = $this->tmpDir.'/tmp/'.$relId.'.'.$ext; + } else { + $ext = str_ireplace('jpeg', 'jpg', $ext); + $fname = $this->img_dir.'/'.$this->img_prex.'_'.mb_strtolower($relId).'.'.$ext; + } + + + switch ($ext) { + case 'png': + imagepng($im, $fname); + break; + case 'bmp': + imagebmp($im, $fname); + break; + case 'gif': + imagegif($im, $fname); + break; + case 'jpeg': + case 'jpg': + imagejpeg($im, $fname); + break; + default: + return null; + } + + return $fname; + } + + /** + * CHECKS IF ELEMENT IS AN HYPERLINK + * + * @param XML $xml The XML node + * @return Array With HTML open and closing tag definition + */ + private function getHyperlink(&$xml) + { + $ret = array('open'=>''); + $link =''; + if($xml->hasAttributes) { + $attribute = ""; + while($xml->moveToNextAttribute()) { + if($xml->name == "r:id") + $attribute = $xml->value; + } + + if($attribute != "") { + $reader = new XMLReader(); + $reader->XML($this->rels_xml->saveXML()); + + while ($reader->read()) { + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name=='Relationship') { + if($reader->getAttribute("Id") == $attribute) { + $link = $reader->getAttribute('Target'); + break; + } + } + } + } + } + + if($link != "") { + $ret['open'] = ""; + $ret['close'] = ""; + } + + return $ret; + } + + + /** + * PROCESS TABLE CONTENT + * + * @param XML $xml The XML node + * @return THe HTML code of the table + */ + private function checkTableFormating(&$xml) + { + $table = ""; + + while ($xml->read()) { + if ($xml->nodeType == XMLREADER::ELEMENT && $xml->name === 'w:tr') { //table row + $tc = $ts = ""; + + + $tr = new XMLReader; + $tr->xml(trim($xml->readOuterXML())); + + while ($tr->read()) { + if ($tr->nodeType == XMLREADER::ELEMENT && $tr->name === 'w:tcPr') { //table element properties + $ts = $this->processTableStyle(trim($tr->readOuterXML())); + } + if ($tr->nodeType == XMLREADER::ELEMENT && $tr->name === 'w:tc') { //table column + $tc .= $this->processTableRow(trim($tr->readOuterXML())); + } + } + $table .= ''.$tc.''; + } + } + + $table .= "
"; + return $table; + } + + /** + * PROCESS THE TABLE ROW STYLE + * + * @param string $content The XML node content + * @return THe HTML code of the table + */ + private function processTableStyle($content) + { + /*border-collapse:collapse; + border-bottom:4px dashed #0000FF; + border-top:6px double #FF0000; + border-left:5px solid #00FF00; + border-right:5px solid #666666;*/ + + $tc = new XMLReader; + $tc->xml($content); + $style = "border-collapse:collapse;"; + + while ($tc->read()) { + if ($tc->name === "w:tcBorders") { + $tc2 = new SimpleXMLElement($tc->readOuterXML()); + + foreach ($tc2->children('w',true) as $ch) { + if (in_array($ch->getName(), array('left','top','botom','right'))) { + $line = $this->convertLine($ch['val']); + $style .= " border-".$ch->getName().":".$ch['sz']."px $line #".$ch['color'].";"; + } + } + + $tc->next(); + } + } + return $style; + } + + private function convertLine($in) + { + if (in_array($in, array('dotted'))) + return "dashed"; + + if (in_array($in, array('dotDash','dotdotDash','dotted','dashDotStroked','dashed','dashSmallGap'))) + return "dashed"; + + if (in_array($in, array('double','triple','threeDEmboss','threeDEngrave','thick'))) + return "double"; + + if (in_array($in, array('nil','none'))) + return "none"; + + return "solid"; + } + + /** + * PROCESS THE TABLE ROW + * + * @param string $content The XML node content + * @return THe HTML code of the table + */ + private function processTableRow($content) + { + $tc = new XMLReader; + $tc->xml($content); + $ct = ""; + + while ($tc->read()) { + if ($tc->name === "w:r") { + $ct .= "".$this->checkFormating($tc).""; + $tc->next(); + } + } + return $ct; + } + + /** + * READS THE GIVEN DOCX FILE INTO HTML FORMAT + * + * @param String $filename The DOCX file name + * @return String With HTML code + */ + public function readDocument($filename) + { + $this->file = $filename; + $this->readZipPart($filename); + $reader = new XMLReader(); + $reader->XML($this->doc_xml->saveXML()); + + $text = ''; $list_format=""; + + $formatting['header'] = 0; + // loop through docx xml dom + while ($reader->read()) { + // look for new paragraphs + $paragraph = new XMLReader; + $p = $reader->readOuterXML(); + //return $p; + + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name === 'w:p') { + // set up new instance of XMLReader for parsing paragraph independantly + $paragraph->xml($p); + + preg_match('/ 0) ? '' : '

'; + + // loop through paragraph dom + while ($paragraph->read()) { + // look for elements + if ($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:r') { + if($list_format == "") + $text .= $this->checkFormating($paragraph); + else { + $text .= $list_format['open']; + $text .= $this->checkFormating($paragraph); + $text .= $list_format['close']; + } + $list_format =""; + $paragraph->next(); + } + else if($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:pPr') { //lists + $list_format = $this->getListFormating($paragraph); + $paragraph->next(); + } + else if($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:drawing') { //images + $text .= $this->checkImageFormating($paragraph); + $paragraph->next(); + } + else if ($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:hyperlink') { + $hyperlink = $this->getHyperlink($paragraph); + $text .= $hyperlink['open']; + $text .= $this->checkFormating($paragraph); + $text .= $hyperlink['close']; + $paragraph->next(); + } + } + $text .= ($formatting['header'] > 0) ? '' : '

'; + } + else if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name === 'w:tbl') { //tables + $paragraph->xml($p); + $text .= $this->checkTableFormating($paragraph); + $reader->next(); + } + } + $reader->close(); + if($this->debug) { + echo "
"; + echo mb_convert_encoding($text, $this->encoding); + echo "
"; + } + return mb_convert_encoding($text, $this->encoding); + } +} \ No newline at end of file diff --git a/application/models/infoContents_model.php b/application/models/infoContents_model.php index 5f99c142..676d76db 100644 --- a/application/models/infoContents_model.php +++ b/application/models/infoContents_model.php @@ -85,6 +85,14 @@ class InfoContents_model extends CI_Model return $query; } + //删除信息 + function force_update($ic_id, $ic_content) + { + $sql = "UPDATE infoContents SET ic_content = N? WHERE ic_id = ?"; + $query = $this->HT->query($sql, array($ic_content, $ic_id)); + return $query; + } + //删除信息 function Delete($ic_id) { diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php index 69cb2843..08264246 100644 --- a/application/models/infoMetas_model.php +++ b/application/models/infoMetas_model.php @@ -16,7 +16,7 @@ class InfoMetas_model extends CI_Model { . " ( \n" . " ?, ?, N? \n" . " )"; - return $this->HT->query($sql, array($im_ic_id, $im_key, $im_value)); + return $this->HT->query($sql, array($im_ic_id, $im_key, (string)$im_value)); } function get_list($im_ic_id, $im_key) { @@ -56,6 +56,7 @@ class InfoMetas_model extends CI_Model { ,im.im_ic_id ,c.ic_url ,c.ic_id + ,empty_tpl = case when c.ic_template in ('r_tpl_empty', 'r_empty_container', 'r_empty2', 'r_tpl_empty_2017', 'tpl_empty', 'tpl_empty_h1', 'tpl_empty_navi_h1') then 'yes' else 'no' end FROM infoMetas im INNER JOIN infoContents c ON c.ic_id = im.im_ic_id @@ -176,7 +177,7 @@ class InfoMetas_model extends CI_Model { . "SET im_value = N? \n" . "WHERE im_ic_id = ? \n" . " AND im_key = ?"; - return $this->HT->query($sql, array($im_value, $im_ic_id, $im_key)); + return $this->HT->query($sql, array((string)$im_value, $im_ic_id, $im_key)); } function delete($im_ic_id, $im_key) { diff --git a/application/models/information_model.php b/application/models/information_model.php index aa164191..b1b78052 100644 --- a/application/models/information_model.php +++ b/application/models/information_model.php @@ -164,6 +164,8 @@ class Information_model extends CI_Model { . " ic.ic_ht_area_type, \n" . " ic.ic_ht_product_id, \n" . " ic.ic_ht_product_type, \n" + . " ic.SRMS_SIC_Code, \n" + . " ic.SRMS_SIIT_Code, \n" . " ic.ic_author \n"; } else { $sql.=" $filed "; @@ -359,4 +361,54 @@ class Information_model extends CI_Model { return $query->result(); } + + //ct + function ct_get_by_url($ic_url,$webcode) + { + $this->ic_url_is_id=" AND ic.ic_url = N".$this->HT->escape($ic_url); + $sql = "SELECT is1.is_id, \n" + . " is1.is_parent_id, \n" + . " is1.is_path, \n" + . " is1.is_level, \n" + . " is1.is_sort, \n" + . " is1.is_sitecode, \n" + . " is1.is_datetime, \n" + . " is1.is_ic_id, \n" + . " ic.ic_id, \n" + . " ic.ic_url, \n" + . " ic.ic_url_title, \n" + . " ic.ic_type, \n" + . " ic.ic_title, \n" + . " ic.ic_content, \n" + . " ic.ic_summary, \n" + . " ic.ic_seo_title, \n" + . " ic.ic_seo_description, \n" + . " ic.ic_seo_keywords, \n" + . " ic.ic_show_bread_crumbs, \n" + . " ic.ic_status, \n" + . " ic.ic_template, \n" + . " ic.ic_photo, \n" + . " ic.ic_photo_width, \n" + . " ic.ic_photo_height, \n" + . " ic.ic_sitecode, \n" + . " ic.ic_recommend_tours, \n" + . " ic.ic_recommend_packages, \n" + . " ic.ic_datetime, \n" + . " ic.ic_ht_area_id, \n" + . " ic.ic_ht_area_type, \n" + . " ic.ic_ht_product_id, \n" + . " ic.ic_ht_product_type, \n" + . " ic.ic_author \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" + . " WHERE is1.is_sitecode = ? "; + $sql .= $this->ic_url_is_id; + $query = $this->HT->query($sql, $webcode); + // print_r($this->HT->queries); + + return $query->row(); + } + + } diff --git a/application/third_party/ctrip/controllers/ctrip_train.php b/application/third_party/ctrip/controllers/ctrip_train.php new file mode 100644 index 00000000..7f818f37 --- /dev/null +++ b/application/third_party/ctrip/controllers/ctrip_train.php @@ -0,0 +1,301 @@ +load->helper('ctrip'); + $this->load->model("ctrip_model"); + date_default_timezone_set('PRC'); + + } + + public function index(){ + exit('hello ctrip'); + } + + //查询车次余票 + public function search(){ + //接收参数 + $date = $this->input->get_post('date'); + $from = $this->input->get_post('from'); + $to = $this->input->get_post('to'); + $TrainNo = $this->input->get_post('TrainNo'); + + if(!$date || !$from || !$to){ + header("HTTP/1.1 404 Not Found"); + exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}'); + }else{ + $isCache = false; + $iseven = false; + $cachedata = false; + $now_time = time(); + $differ = (strtotime($date) - $now_time) / 86400; + if($differ > 29){ + $date = date('Y-m-d',strtotime('+7day')); + $iseven = true; + } + + //转换三字码为中文 + $FromName = $this->ctrip_model->ReplaceCodeToName($from); + $ToName = $this->ctrip_model->ReplaceCodeToName($to); + + + if(!$FromName || !$ToName){ + header("HTTP/1.1 404 Not Found"); + exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}'); + }else{ + $from = $FromName->station_name; + $to = $ToName->station_name; + } + + //生成请求链接 + $TimeStamp = time(); + $Sign = md5($TimeStamp.DATAKEY); + + $url = JSONRETURN.'SearchS2S/?From='.urlencode($from).'&To='.urlencode($to).'&DepartDate='.$date.'&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign; + + $api_start_time = microtime(true); + + //获取数据 + $ResponseJson = post_ctrip($url,'','GET'); + + $api_end_time = microtime(true); + + $ResponseData = json_decode($ResponseJson); + $api_responsive_time = $api_end_time - $api_start_time; + //print_r($ResponseData);die(); + + if(empty($ResponseData->Trains)){ + log_message('error','ctrip_trian|status:trains is empty |相应时间:'.$api_responsive_time); + }else{ + log_message('error','ctrip_trian|status:'.$ResponseData->ResponseStatus->Ack.'|相应时间:'.$api_responsive_time); + } + + //定义返回的json + $ReturnData = new stdClass(); + $ReturnData->httpstatus = 200; + $ReturnData->data = new stdClass(); + $ReturnData->data->seven = $iseven; + $ReturnData->data->cache = $isCache; + $ReturnData->data->result = array(); + $ReturnData->data->map = new stdClass(); + $obj = array(); + $i = 0; + $PriceStr = ''; + //数据解析 + if(!empty($ResponseData->Trains)){ + foreach ($ResponseData->Trains as $TrainInfo){ + $obj[$TrainInfo->FromTelcode] = $TrainInfo->FromStationName; + $obj[$TrainInfo->ToTelcode] = $TrainInfo->ToStationName; + $SeaType = ''; + $gjrwNum = $rwNum = $rzNum = $tdzNum = $wzNum = $yzNum = $edzNum = $ydzNum = $swzNum = $ywNum = $dwNum = null; + foreach($TrainInfo->Seats as $Seats){ + if($Seats->SeatName == '高级软卧下'){ + $gjrwXiaPrice = $Seats->Price * 10; + $SeaType .= '"6":"'.$gjrwXiaPrice.'","A6":"¥'.$Seats->Price.'",'; + $gjrwNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '软卧下'){ + $rwPrice = $Seats->Price * 10; + $SeaType .= '"4":"'.$rwPrice.'","A4":"¥'.$Seats->Price.'",'; + $rwNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '软座'){ + $rzPrice = $Seats->Price * 10; + $SeaType .= '"2":"'.$rzPrice.'","A2":"¥'.$Seats->Price.'",'; + $rzNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '特等座'){ + $SeaType .= '"P":"¥'.$Seats->Price.'",'; + $tdzNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '无座'){ + $SeaType .= '"WZ":"¥'.$Seats->Price.'",'; + $wzNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '硬座'){ + $yzPrice = $Seats->Price * 10; + $SeaType .= '"1":"'.$yzPrice.'","A1":"¥'.$Seats->Price.'",'; + $yzNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '二等座'){ + $SeaType .= '"O":"¥'.$Seats->Price.'",'; + $edzNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '一等座'){ + $SeaType .= '"M":"¥'.$Seats->Price.'",'; + $ydzNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '商务座'){ + $swzPrice = $Seats->Price * 10; + $SeaType .= '"9":"'.$swzPrice.'","A9":"¥'.$Seats->Price.'",'; + $swzNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '硬卧下'){ + $ywPrice = $Seats->Price * 10; + $SeaType .= '"3":"'.$ywPrice.'","A3":"¥'.$Seats->Price.'",'; + $ywNum = $Seats->TicketLeft; + } + + if($Seats->SeatName == '动卧下'){ + $SeaType .= '"F":"¥'.$Seats->Price.'",'; + $dwNum = $Seats->TicketLeft; + } + + $PriceStr = $SeaType.'"train_no":'.'"'.$TrainInfo->TrainNo.'"'; + } + + //对返回的数据进行容错处理 + $gjrwNum = isset($gjrwNum) ? ticket_exchange($gjrwNum,$iseven) : ''; + $rwNum = isset($rwNum) ? ticket_exchange($rwNum,$iseven) : ''; + $rzNum = isset($rzNum) ? ticket_exchange($rzNum,$iseven) : ''; + $tdzNum = isset($tdzNum) ? ticket_exchange($tdzNum,$iseven) : ''; + $wzNum = isset($wzNum) ? ticket_exchange($wzNum,$iseven) : ''; + $ywNum = isset($ywNum) ? ticket_exchange($ywNum,$iseven) : ''; + $yzNum = isset($yzNum) ? ticket_exchange($yzNum,$iseven) : ''; + $edzNum = isset($edzNum) ? ticket_exchange($edzNum,$iseven) : ''; + $ydzNum = isset($ydzNum) ? ticket_exchange($ydzNum,$iseven) : ''; + $swzNum = isset($swzNum) ? ticket_exchange($swzNum,$iseven) : ''; + $dwNum = isset($dwNum) ? ticket_exchange($dwNum,$iseven) : ''; + $runMin = $TrainInfo->DurationMinutes % 60; + $runHour = ($TrainInfo->DurationMinutes - $runMin) / 60; + + $ReturnData->data->result[$i] = '|预定|'.$TrainInfo->Train12306No.'|'.$TrainInfo->TrainNo.'|'.$TrainInfo->FromStationName.'|'.$TrainInfo->ToStationName.'|'.$TrainInfo->FromTelcode.'|'.$TrainInfo->ToTelcode.'|'.$TrainInfo->StartTime.'|'.$TrainInfo->ArriveTime.'|'.$runHour.':'.$runMin.'|'.$TrainInfo->CanWebBuy.'||'.date('Ymd',strtotime($date)).'||||||||'.$gjrwNum.'||'.$rwNum.'|'.$rzNum.'|'.$tdzNum.'|'.$wzNum.'||'.$ywNum.'|'.$yzNum.'|'.$edzNum.'|'.$ydzNum.'|'.$swzNum.'|'.$dwNum.'||'; + + $data = '{"validateMessagesShowId":"_validatorMessage","status":true,"httpstatus":200,"data":{'.$PriceStr.'},"messages":[],"validateMessages":{}}'; + $ReturnData->data->price[$i] = $data; + $i++; + } + } + //print_r($ResponseData); + $ReturnData->data->map = (object)$obj; + print_r(json_encode($ReturnData)); + } + } + + //查询经停站 + public function getstopstation(){ + //接收参数 + $DepartDate = $this->input->get_post('DepartDate'); + $TrainNo = $this->input->get_post('TrainNo'); + + if(!$DepartDate || !$TrainNo){ + exit('传参错误!'); + }else{ + //生成请求链接 + $TimeStamp = time(); + $Sign = md5($TimeStamp.DATAKEY); + + $url = JSONRETURN.'GetStopStations/?DepartDate='.$DepartDate.'&TrainNo='.$TrainNo.'&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign; + + $ResponseJson = post_ctrip($url,'','GET'); + $ResponseData = json_decode($ResponseJson); + + //构造12306格式 + $ReturnData = array(); + $ReturnData['validateMessagesShowId'] = '_validatorMessage'; + $ReturnData['status'] = true; + $ReturnData['httpstatus'] = 200; + $ReturnData['data'] = array(); + $i = 0; + $Last_num = count($ResponseData->StopStations); + foreach($ResponseData->StopStations as $items){ + if($i == 0){ + $ReturnData['data']['data'][$i]['start_station_name'] = $items->StationName; + $ReturnData['data']['data'][$i]['station_train_code'] = $TrainNo; + $ReturnData['data']['data'][$i]['end_station_name'] = $ResponseData->StopStations[$Last_num-1]->StationName; + } + $ReturnData['data']['data'][$i]['arrive_time'] = $items->ArrivalTime; + $ReturnData['data']['data'][$i]['station_name'] = $items->StationName; + $ReturnData['data']['data'][$i]['start_time'] = $items->StartTime; + $ReturnData['data']['data'][$i]['stopover_time'] = $items->StopMinutes; + $ReturnData['data']['data'][$i]['station_no'] = $items->StationNo; + $ReturnData['data']['data'][$i]['isEnabled'] = true; + $i++; + } + $ReturnData['messages'] = array(); + $ReturnData['validateMessages'] = new stdClass(); + print_r(json_encode($ReturnData)); + } + } + + //获取所有站点信息 + public function getallstation(){ + //生成请求参数 + $TimeStamp = time(); + $Sign = md5($TimeStamp.DATAKEY); + + $url = JSONRETURN.'/GetAllStations/?&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign; + + $ResponseJson = post_ctrip($url,'','GET'); + + $ResponseData = json_decode($ResponseJson); + + $data = array(); + foreach ($ResponseData->Stations as $items){ + $data['StationName'] = isset($items->StationName) ? checkNull($items->StationName) : ''; + $data['PinYin'] = isset($items->PinYin) ? checkNull($items->PinYin) : ''; + $data['Telecode'] = isset($items->Telecode) ? checkNull($items->Telecode) : ''; + $data['Address'] = isset($items->Address) ? checkNull($items->Address) : ''; + $data['Geography'] = isset($items->Geography) ? checkNull($items->Geography) : ''; + $this->ctrip_model->AddOrUpdate($data); + } + } + + //查询中转方案 + public function gettraintrainsfer(){ + $FromCode = $this->input->get_post('FromCode'); + $ToCode = $this->input->get_post('ToCode'); + $DepartDate = $this->input->get_post('DepartDate'); + + if(!$FromCode || !$ToCode || !$DepartDate){ + exit('传参错误!'); + }else{ + $TimeStamp = time(); + $Sign = md5($TimeStamp.DATAKEY); + + $FromName = $this->ctrip_model->ReplaceCodeToName($FromCode); + $ToName = $this->ctrip_model->ReplaceCodeToName($ToCode); + + $From = $FromName->station_name; + $To = $ToName->station_name; + + $url = JSONRETURN.'GetTrainTransfer?User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign.'&From='.urlencode($From).'&To='.urlencode($To).'&DepartDate='.$DepartDate; + + + $ResponseJson = post_ctrip($url,'','GET'); + //$ResponseData = json_decode($ResponseJson); + print_r($ResponseJson); + } + } +} \ No newline at end of file diff --git a/application/third_party/ctrip/helpers/ctrip_helper.php b/application/third_party/ctrip/helpers/ctrip_helper.php new file mode 100644 index 00000000..b84711e4 --- /dev/null +++ b/application/third_party/ctrip/helpers/ctrip_helper.php @@ -0,0 +1,81 @@ += 99){ + return '有'; + }else{ + return $num; + } + } + } + } + + //发送请求函数 + function post_ctrip($url, $data = '', $method = 'GET') { + $user_agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"; + if(isset($_SERVER['HTTP_USER_AGENT'])) { + $user_agent = $_SERVER['HTTP_USER_AGENT']; + } + $curl = curl_init(); // 启动一个CURL会话 + curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 + curl_setopt($curl, CURLOPT_USERAGENT, $user_agent); // 模拟用户使用的浏览器 + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 + curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer + if ($method == 'POST' && !empty($data)) { + curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包 + curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); + } + curl_setopt($curl, CURLOPT_TIMEOUT, 40); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_TIMEOUT_MS, 40000); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 + $tmpInfo = curl_exec($curl); // 执行操作 + $errno = curl_errno($curl); + if ($errno !== 0) { + log_message('error', 'ctripost'.$errno.curl_error($curl)); + } + curl_close($curl); //关闭CURL会话 + return $tmpInfo; //返回数据 + } + +?> \ No newline at end of file diff --git a/application/third_party/ctrip/models/ctrip_model.php b/application/third_party/ctrip/models/ctrip_model.php new file mode 100644 index 00000000..fac981e4 --- /dev/null +++ b/application/third_party/ctrip/models/ctrip_model.php @@ -0,0 +1,68 @@ +INFO = $this->load->database('INFO', TRUE); + } + + //» + public function AddOrUpdate($data){ + $sql = "IF NOT EXISTS( + SELECT 1 + FROM train_stations + WHERE + station_telecode = '{$data['Telecode']}' + ) BEGIN + INSERT INTO train_stations + ( + station_name, + station_telecode, + station_geography, + station_pinyin, + station_address + ) + VALUES + ( + '{$data['StationName']}','{$data['Telecode']}','{$data['Geography']}','{$data['PinYin']}','{$data['Address']}' + ) + END + ELSE + BEGIN + UPDATE train_stations + SET station_name = '{$data['StationName']}', + station_geography = '{$data['Geography']}', + station_pinyin = '{$data['PinYin']}', + station_address = '{$data['Address']}' + WHERE + station_telecode = '{$data['Telecode']}' + END + "; + $query = $this->INFO->query($sql); + return $query; + } + + //ȡĻϢ + //ȡ7ǰݾͲκݣҽɾ + public function get_train_cache($tpc_from_station,$tpc_to_station){ + $sql = "SELECT + * + FROM + TrainPriceCache + WHERE + tpc_from_station = '$tpc_from_station' + AND + tpc_to_station = '$tpc_to_station'"; + $query = $this->INFO->query($sql); + return $query->row(); + } + + //ȡվ + public function ReplaceCodeToName($code){ + $sql = "SELECT station_name from train_stations where station_telecode = '{$code}'"; + $query = $this->INFO->query($sql); + return $query->row(); + } + +} +?> \ 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 999907c2..3b3cabda 100644 --- a/application/third_party/htmlcompressor/controllers/index.php +++ b/application/third_party/htmlcompressor/controllers/index.php @@ -80,6 +80,10 @@ class Index extends CI_Controller //$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; + + $this->html_object = str_replace('', $lastload_js . '', $this->html_object); + echo json_encode(array('result' => 'ok', 'data' => array('html_object' => $this->html_object, 'js_content' => $js_content))); + } + + //生成AMP版本 用移动端版本生成 + /* + 1.加载站点AMP模板,模板只有导航、头部、底部 + 2.删除全部js引用和内链代码 + 3.删除全部css引用,内联css放入 @@ -18,6 +19,7 @@ .fa-google-plus::before{content:"\f0d5"}.ampstart-headerbar{background-color:#fff;color:#000;z-index:999;box-shadow:0 0 5px 2px rgba(0,0,0,.1)}.ampstart-headerbar+:not(amp-sidebar),.ampstart-headerbar-nav .ampstart-nav-item{padding:0 1rem;background:transparent;opacity:.8}.ampstart-headerbar-nav{line-height:3.5rem}.ampstart-nav-item:active,.ampstart-nav-item:focus,.ampstart-nav-item:hover{opacity:1}.ampstart-navbar-trigger:focus{outline:0}.ampstart-nav a,.ampstart-navbar-trigger,.ampstart-sidebar-faq a{cursor:pointer;text-decoration:none}.ampstart-nav .ampstart-label{color:inherit;padding-left:0}.ampstart-navbar-trigger{line-height:3.5rem;font-size:2.2rem}.ampstart-headerbar-nav{-webkit-box-flex:1;-ms-flex:1;flex:1}.ampstart-nav-search{-webkit-box-flex:.5;-ms-flex-positive:.5;flex-grow:.5}.ampstart-headerbar .ampstart-nav-search:active,.ampstart-headerbar .ampstart-nav-search:focus,.ampstart-headerbar .ampstart-nav-search:hover{box-shadow:none}.ampstart-nav-dropdown{min-width:200px}.ampstart-nav-dropdown amp-accordion header{background-color:#fff;border:0}.ampstart-nav-dropdown amp-accordion ul{background-color:#fff}.ampstart-nav-dropdown .ampstart-dropdown-item,.ampstart-nav-dropdown .ampstart-dropdown>section>header{background-color:#fff;color:#000}.ampstart-nav-dropdown .ampstart-dropdown-item{color:#f88}.ampstart-sidebar{background-color:#555;color:#000;min-width:300px;width:300px}.ampstart-sidebar .ampstart-icon{fill:#f88}.ampstart-sidebar-header{line-height:3.5rem;min-height:3.5rem}.ampstart-sidebar .ampstart-dropdown-item,.ampstart-sidebar .ampstart-dropdown header,.ampstart-sidebar .ampstart-faq-item,.ampstart-sidebar .ampstart-nav-item,.ampstart-sidebar .ampstart-social-follow{margin:0 0 2rem}.ampstart-sidebar .ampstart-nav-dropdown{margin:0}.ampstart-sidebar .ampstart-navbar-trigger{line-height:inherit;text-align:right;margin-right:15px;color:#999}.ampstart-navbar-trigger svg{pointer-events:none;margin:15px 0 0 15px;color:#fff}.ampstart-headerbar{color:#f88;padding-right:1rem;background-color:#fff;height:3.5rem;box-shadow:none;border-bottom:1px solid #f3f3f3}.ampstart-headerbar .ampstart-navbar-trigger{color:#222;font-size:1.38rem;padding-right:0}.ampstart-navbar-trigger:focus{outline:5px auto -webkit-focus-ring-color}.ampstart-sidebar-nav-image{width:120px}.ampstart-icon,.ampstart-sidebar .ampstart-icon{fill:#222}.ampstart-sidebar-header{position:relative;z-index:1}.ampstart-nav{margin-bottom:2rem}.ampstart-nav-item{color:#222;border-bottom:1px solid #777;list-style:none;padding-bottom:8px}.ampstart-sidebar .ampstart-nav-item{margin-bottom:1rem;padding-left:30px}.ampstart-nav-link{font-size:16px;font-weight:400;line-height:normal;display:inline-block;margin-bottom:5px;position:relative;color:#fff;padding-bottom:3px}.ampstart-nav-link .fa{position:absolute;right:20px;top:3px}.amp-mode-mouse .ampstart-nav-link:after{left:0;position:absolute;-webkit-transform:scaleX(0);transform:scaleX(0);-webkit-transform-origin:left center;transform-origin:left center;-webkit-transition:-webkit-transform .3s cubic-bezier(.19,1,.22,1);transition:-webkit-transform .3s cubic-bezier(.19,1,.22,1);transition:transform .3s cubic-bezier(.19,1,.22,1);transition:transform .3s cubic-bezier(.19,1,.22,1),-webkit-transform .3s cubic-bezier(.19,1,.22,1);width:100%;bottom:0;height:2px;content:"";display:block}.ampstart-dropdown-items{padding-left:0}.ampstart-dropdown-items li{font-size:14px;text-transform:capitalize;line-height:35px;border-bottom:1px solid #777;margin-right:30px;padding-left:20px;padding-bottom:5px;list-style:none}.ampstart-dropdown-items li a{color:#fff}.ampstart-dropdown-items li:last-child{border-bottom:0}.ampstart-social-follow{-webkit-box-pack:initial;-ms-flex-pack:initial;justify-content:initial;display:inline-block}.ampstart-social-follow li{display:inline-block;margin-right:0}.footerLink{display:block;padding:20px 0 0;text-align:center}.footerLink a{margin:0 10px}.copyright{display:block;padding:20px 0;text-align:center}.socialLink{text-align:center;display:block;margin-top:50px}.socialLink a{text-decoration:none}.socialLink .fa{font-size:150%;margin:0 20px;color:#fff}.logo{text-align:center}.amphtml-accordion-header{background:0;border:0;margin-bottom:0}.clearfix{clear:both}.amp-tailor { display: block; margin:50px 15px 10px; background:#f1f1f1; padding:15px 15px 20px; font-size:18px; border-radius:4px; text-align:center;}.amp-tailor span { display: block; margin:15px auto 0; width:70%; text-align:center; background:#a31022; border-radius:4px;}.amp-tailor span a { text-decoration: none; color:#fff; padding:5px 10px; display: block; font-size:18px;}.amp-tailor span .fa { font-size:130%; margin-left:10px;} /*@CUSTOM-CSS@*/ #contentHead{padding-top: 8px;} +.sharebar-sticker { display: block; position:fixed; bottom:0; left:0; width:100%;} @@ -60,13 +62,13 @@
@@ -119,7 +121,7 @@ @@ -129,5 +131,6 @@ +
diff --git a/application/third_party/htmlcompressor/views/amp-template/ct.php b/application/third_party/htmlcompressor/views/amp-template/ct.php new file mode 100644 index 00000000..338379ef --- /dev/null +++ b/application/third_party/htmlcompressor/views/amp-template/ct.php @@ -0,0 +1,218 @@ + + + + +<!--@TITLE@--> + + + + + + + + + + + + + + +
+
China Travel ® CUSTOMIZE
+
+ + +
+
+
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/application/third_party/htmlcompressor/views/amp-template/gm.php b/application/third_party/htmlcompressor/views/amp-template/gm.php index 0ad306ef..63ca3a47 100644 --- a/application/third_party/htmlcompressor/views/amp-template/gm.php +++ b/application/third_party/htmlcompressor/views/amp-template/gm.php @@ -15,95 +15,31 @@ - - - -
-
- - -
- - - -
-
- Anfragen
-
- - - -
-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • - -
-
-
- - - - - -
- - + + +
- +@AMP-COMMON-HEADER@ + - +@AMP-COMMON-FOOTER@ +
- \ No newline at end of file diff --git a/application/third_party/order/controllers/confirm.php b/application/third_party/order/controllers/confirm.php index 1b9ae2fc..e8c3e11b 100644 --- a/application/third_party/order/controllers/confirm.php +++ b/application/third_party/order/controllers/confirm.php @@ -30,14 +30,14 @@ class Confirm extends CI_Controller { } } } else { - $this->load->view($site_code.'/link_tips', $data); + $this->load->view($site_code.'/link_tips', $data); return false; } $visitor_link_arr = $this->Order_model->get_visitor_link($COLI_SN); foreach ($visitor_link_arr as $l) { if ($visitor_link == $l->visitor_link) { - $this->load->view($site_code.'/link_tips', $data); + $this->load->view($site_code.'/link_tips', $data); return false; } } @@ -66,6 +66,7 @@ class Confirm extends CI_Controller { //已经确认过 $had_save = $this->Order_model->get_visitor_link($COLI_SN, $visitor_link); + if (!empty($had_save)) { echo json_encode(array('status' => 'ok')); return; @@ -79,7 +80,7 @@ class Confirm extends CI_Controller { } elseif ($this->input->post('address_street')) { $MEI_Street = $this->input->post('address_street') . ',' . $this->input->post('address_city') . ',' . $this->input->post('address_state') . ',' . $this->input->post('address_country'); } else { - $MEI_Street = ''; + $MEI_Street = $this->input->post('street').','.$this->input->post('city').','.$this->input->post('country'); } $data['MEI_Street'] = $MEI_Street; if (isset($given_name[$key]) && $given_name[$key] != 'None') { @@ -125,7 +126,7 @@ class Confirm extends CI_Controller { echo json_encode(array('status' => 'no')); } } - + //只有ch有review功能 function review() { $data = array(); diff --git a/application/third_party/order/views/confirm_order.php b/application/third_party/order/views/confirm_order.php index a916af4c..05a815f3 100644 --- a/application/third_party/order/views/confirm_order.php +++ b/application/third_party/order/views/confirm_order.php @@ -731,7 +731,7 @@ }); - $("#btn-add-personinfo-box").click(); + // $("#btn-add-personinfo-box").click(); //日期初始化 diff --git a/application/third_party/order/views/gm/confirm_order.php b/application/third_party/order/views/gm/confirm_order.php index 1a973471..b3f26321 100644 --- a/application/third_party/order/views/gm/confirm_order.php +++ b/application/third_party/order/views/gm/confirm_order.php @@ -6,532 +6,404 @@ China Reisen und China Rundreisen individuell | Chinarundreisen.com - - - + + + + + - - - - - - -
- -
- -
-
-
- -
-

Vielen Dank für die Buchung bei Chinarundreisen!

-

Bitte füllen Sie das folgende Formular aus und schicken es zurück.

-
-
-
-
-
- -
-

Kunden informationen

-

Bitte prüfen Sie, ob Ihr Name richtig geschrieben ist (vollständiger Name wie im Reisepass) . Da wir die Folgekosten durch ein wegen falschem Namen stornierten Hotel oder Flugticket nicht tragen, ist die richtige Schreibweise Ihres Namens und Ihrer alle Daten unbedingt wichtig.

-
- -
-
- -
-
- -
-
- -
-
- -
- -
- -
-
- -
- -
-
-
- - -
-
-
-
-
- -
-
/
-
- -
-
-
-
-
-
- -
-
- -
-
- -
- -
- -
-
- -
-
- - - -
-
- - - - -
-
- -
- -
- - Mitreisende hinzufügen - -
-
- -
-
- - Kontakttelefon: - -
-
- -
-
- -
-
-
-
- COLI_CustomerType!=44003){ ?> -
-
- - Anschrift: - - - -
-
- - -
-
-
- -
-
-
- -
-

Fluginformationen

-
- -
-
- - -
- -
- -
- -
-
- -
- - -
- -
- -
- -
-
- -
- -
-
-
- -
-
-
- -
-

- Besondere Anforderungen -

-
- -
-
-
- -
-
-
-
- -
-
-
- COLI_CustomerType!=44003){ ?> -
-
-
- -
-

- Kontaktinformationen für Notfälle - (im Falle eines Notfalls während Ihrer Chinareise) -

-
- -
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
-
-
-
- - -
- - - - - -
- -
-
Danke! Mit besten Grüßen, OPI_FirstName; ?>
-
- -
- -
-
- - - - + + //提交信息 + $("#form-confirm-info").submit(function(event){ + event.preventDefault(); + var $btn = $("#btn-add-userinfo").button('loading'); + + var url=$(this).attr('action'); + var data=$(this).serialize(); + $.ajax({ + type: "post", + url: url, + dataType: "json", + data: data, + success: function(json_data) { + if (json_data.status == 'ok') { + location.href='/secureinfoconfirm/confirm/index/0/0/0/gm'; + } else { + $btn.button('reset'); + $('#myModal').modal('show'); + } + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + $btn.button('reset'); + alert(errorThrown); + } + }); + }); +}) \ No newline at end of file diff --git a/application/third_party/order/views/gm/confirm_order_back.php b/application/third_party/order/views/gm/confirm_order_back.php new file mode 100644 index 00000000..31578924 --- /dev/null +++ b/application/third_party/order/views/gm/confirm_order_back.php @@ -0,0 +1,538 @@ + + + + + + + China Reisen und China Rundreisen individuell | Chinarundreisen.com + + + + + + + + + + + + + + +
+ +
+ +
+
+
+ +
+

Vielen Dank für die Buchung bei Chinarundreisen!

+

Bitte füllen Sie das folgende Formular aus und schicken es zurück.

+
+
+
+
+
+ +
+

Kunden informationen

+

Bitte prüfen Sie, ob Ihr Name richtig geschrieben ist (vollständiger Name wie im Reisepass) . Da wir die Folgekosten durch ein wegen falschem Namen stornierten Hotel oder Flugticket nicht tragen, ist die richtige Schreibweise Ihres Namens und Ihrer alle Daten unbedingt wichtig.

+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+ + +
+
+
+
+
+ +
+
/
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ + + +
+
+ + + + +
+
+ +
+ +
+ + Mitreisende hinzufügen + +
+
+ +
+
+ + Kontakttelefon: + +
+
+ +
+
+ +
+
+
+
+ COLI_CustomerType!=44003){ ?> +
+
+ + Anschrift: + + + +
+
+ + +
+
+
+ +
+
+
+ +
+

Fluginformationen

+
+ +
+
+ + +
+ +
+ +
+ +
+
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+
+
+ +
+
+
+ +
+

+ Besondere Anforderungen +

+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ COLI_CustomerType!=44003){ ?> +
+
+
+ +
+

+ Kontaktinformationen für Notfälle + (im Falle eines Notfalls während Ihrer Chinareise) +

+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+
+ + +
+ + + + + +
+ +
+
Danke! Mit besten Grüßen, OPI_FirstName; ?>
+
+ +
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/application/third_party/order/views/mailtext.php b/application/third_party/order/views/mailtext.php index fc6b27eb..2a1a8114 100644 --- a/application/third_party/order/views/mailtext.php +++ b/application/third_party/order/views/mailtext.php @@ -25,7 +25,6 @@

Contact Information

Land line:

Mobile:

-

Home Address:

Flight Information diff --git a/application/third_party/tour_map/controllers/index.php b/application/third_party/tour_map/controllers/index.php new file mode 100644 index 00000000..f3a5aeb3 --- /dev/null +++ b/application/third_party/tour_map/controllers/index.php @@ -0,0 +1,20 @@ +load->view('welcome'); + } + + +} \ No newline at end of file diff --git a/application/third_party/tour_map/views/welcome.php b/application/third_party/tour_map/views/welcome.php new file mode 100644 index 00000000..fa916d88 --- /dev/null +++ b/application/third_party/tour_map/views/welcome.php @@ -0,0 +1,383 @@ + + + + + + + Tour Map + + + + + + + + + + 'Beijing', 'start_lng' => '116.41667', 'start_lat' => '39.91667', 'end' => 'urumqi', 'end_lng' => '87.61792', 'end_lat' => '43.793308', 'traffic' => '2', 'memo' => 'G87'); + $tour[] = array('start' => 'Beijing', 'start_lng' => '116.41667', 'start_lat' => '39.91667', 'end' => 'Xian', 'end_lng' => '108.95000', 'end_lat' => '34.26667', 'traffic' => '2', 'memo' => 'G87'); + $tour[] = array('start' => 'Xian', 'start_lng' => '108.95000', 'start_lat' => '34.26667', 'end' => 'Guilin', 'end_lng' => '110.290247', 'end_lat' => '25.273915', 'traffic' => '3', 'memo' => 'CA1225'); + $tour[] = array('start' => 'Guilin', 'start_lng' => '110.290247', 'start_lat' => '25.273915', 'end' => 'Longsheng', 'end_lng' => '110.648739', 'end_lat' => '24.828426', 'traffic' => '5', 'memo' => ''); + $tour[] = array('start' => 'Longsheng', 'start_lng' => '110.648739', 'start_lat' => '24.828426', 'end' => 'Guilin', 'end_lng' => '110.290247', 'end_lat' => '25.273915', 'traffic' => '5', 'memo' => ''); + $tour[] = array('start' => 'Guilin', 'start_lng' => '110.290247', 'start_lat' => '25.273915', 'end' => 'Yangshuo', 'end_lng' => '110.496593', 'end_lat' => '24.778481', 'traffic' => '5', 'memo' => ''); + $tour[] = array('start' => 'Yangshuo', 'start_lng' => '110.496593', 'start_lat' => '24.778481', 'end' => 'Guilin', 'end_lng' => '110.290247', 'end_lat' => '25.273915', 'traffic' => '5', 'memo' => ''); + $tour[] = array('start' => 'Guilin', 'start_lng' => '110.290247', 'start_lat' => '25.273915', 'end' => 'Shanghai', 'end_lng' => '121.473658', 'end_lat' => '31.230378', 'traffic' => '3', 'memo' => 'FM9350'); + + + $map_data = $this->input->get('map_data'); +//echo $map_data; + $debug = $this->input->get('debug'); + if (!empty($debug)) { + print_r(base64_decode($map_data)); + } + ?> +
+ + + + + + \ No newline at end of file diff --git a/application/third_party/train/controllers/search.php b/application/third_party/train/controllers/search.php index 0e217f82..433fa394 100644 --- a/application/third_party/train/controllers/search.php +++ b/application/third_party/train/controllers/search.php @@ -326,6 +326,7 @@ class search extends CI_Controller{ $seat_info = $this->BIZ_intel_train_model->get_seat_info($key); $obj->seat_info->$key = $seat_info; } + $obj->arriveTime = $obj->localarriveTime; print_r(json_encode($obj)); } @@ -438,7 +439,7 @@ class search extends CI_Controller{ function ticket_exchange($price,$num){ //echo $this->can_buy_now; if($this->cache == 'yes' || $this->seveth == 'yes'){ - if(isset($price)){ + if(isset($price) && is_numeric($num)){ if($price > 0){ return '有'; }else{ diff --git a/application/third_party/train/models/BIZ_intel_train_model.php b/application/third_party/train/models/BIZ_intel_train_model.php index 0f62017c..a659a6d9 100644 --- a/application/third_party/train/models/BIZ_intel_train_model.php +++ b/application/third_party/train/models/BIZ_intel_train_model.php @@ -73,7 +73,8 @@ class BIZ_intel_train_model extends CI_Model { SELECT *, (select s_country from TrainStation_intel where trainFromCode = s_code ) as From_country, - (select s_country from TrainStation_intel where trainToCode = s_code ) as To_country + (select s_country from TrainStation_intel where trainToCode = s_code ) as To_country, + (select top 1 trainArrive from trainlistDetail where train_no = tl.train_no order by trainOrder desc) as localarriveTime FROM trainlist tl LEFT JOIN diff --git a/application/third_party/tuniu/controllers/tuniu_train.php b/application/third_party/tuniu/controllers/tuniu_train.php index 559fba16..5dcdecb0 100644 --- a/application/third_party/tuniu/controllers/tuniu_train.php +++ b/application/third_party/tuniu/controllers/tuniu_train.php @@ -43,6 +43,7 @@ class Tuniu_train extends CI_Controller{ //做超过预售期的处理查询 $isCache = false; $iseven = false; + $cachedata = false; $now_time = time(); $differ = (strtotime($date) - $now_time) / 86400; if($differ > 29){ @@ -59,27 +60,35 @@ class Tuniu_train extends CI_Controller{ "sign": "'.$sign.'", "timestamp": "'.$time.'", "data": { "trainDate": "'.$date.'", "fromStation": "'.$fromStation.'", "toStation": "'.$toStation.'", "trainCode": "" } - }'; + }'; + //设置请求接口时间 + $api_start_time = microtime(true); + $back_data = post_tuniu($url,$post_data,$method = 'POST'); + //$back_data = null; + //接口结束时间 + $api_end_time = microtime(true); - log_message('error','tuniutrain 原始数据:'.$back_data); - //print_r(json_decode($back_data));die(); - //$log_info = ''; + //计算响应时间 + $api_responsive_time = $api_end_time - $api_start_time; - $tn_info = json_decode($back_data); - $retrun_code = $tn_info->returnCode; - $return_msg = $tn_info->errorMsg; + if(!empty($back_data)){ + $tn_info = json_decode($back_data); + $retrun_code = $tn_info->returnCode; + $return_msg = $tn_info->errorMsg; + }else{ + $retrun_code = '404'; + $return_msg = '途牛接口未响应'; + } if(isset($tn_info->data)){ if(empty(json_decode($back_data)->data)){ $isCache = true; - //$log_info = 'tuniutrain data缺失|数据源:'.$fromStation.'|'.$toStation.'|'.$date.'|retrun_code:'.$retrun_code.'|return_msg:'.$return_msg; }else{ $this->tuniuprice_model->addOrUpdate($fromStation,$toStation,$back_data); } }else{ $isCache = true; - //$log_info = 'tuniutrain 接口未响应|数据源:'.$fromStation.'|'.$toStation.'|'.$date.'|retrun_code:'.$retrun_code.'|return_msg:'.$return_msg; } if($isCache){ @@ -89,17 +98,23 @@ class Tuniu_train extends CI_Controller{ $trainCache = $this->tuniuprice_model->get_train_cache($fromStation,$toStation); if(!empty($trainCache)){ $back_data = $trainCache->tpc_content; - $isCache = true; - //$log_info .= '|调用缓存'; - //log_message('error',$log_info); + $cachedata = true; }else{ $back_data = null; - //$log_info .= '|缓存为空'; - //log_message('error',$log_info); + $cachedata = false; } } } + if($cachedata){ + $cacheuse = '使用缓存'; + }else{ + $cacheuse = '缓存为空'; + } + + //记录数据格式 |出发站|到达站|发车时间|接口响应时间|接口返回代码|接口返回信息|是否调用缓存 + log_message('error','tuniutrain|'.$fromStation.'|'.$toStation.'|'.$date.'|'.$api_responsive_time.'|'.$retrun_code.'|'.$return_msg.'|'.$cacheuse); + //途牛数据格式转换 $return_data = new stdClass(); $return_data->httpstatus = 200; diff --git a/application/third_party/tuniu/helpers/tuniu_helper.php b/application/third_party/tuniu/helpers/tuniu_helper.php index eb76527d..55a44a9c 100644 --- a/application/third_party/tuniu/helpers/tuniu_helper.php +++ b/application/third_party/tuniu/helpers/tuniu_helper.php @@ -44,8 +44,8 @@ curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包 curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); } - curl_setopt($curl, CURLOPT_TIMEOUT, 25); // 设置超时限制防止死循环 - curl_setopt($curl, CURLOPT_TIMEOUT_MS, 25000); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_TIMEOUT, 40); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_TIMEOUT_MS, 40000); // 设置超时限制防止死循环 curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 $tmpInfo = curl_exec($curl); // 执行操作 diff --git a/application/views/amp_editor.php b/application/views/amp_editor.php index ade80f75..9593b5a9 100644 --- a/application/views/amp_editor.php +++ b/application/views/amp_editor.php @@ -16,6 +16,15 @@
+
+

多媒体中心图片

+
+ + + + +
+
@@ -94,6 +103,27 @@ - + + + + + @@ -91,6 +91,7 @@
  • Html基础知识
  • AMP知识
  • AMP操作SOP
  • +
  • HTML构建工具V3
  • PS基础课件
  • 系统设置
  • diff --git a/application/views/bootstrap3/information_edit.php b/application/views/bootstrap3/information_edit.php index 7b6b12c5..a2bf64f4 100644 --- a/application/views/bootstrap3/information_edit.php +++ b/application/views/bootstrap3/information_edit.php @@ -1,1334 +1,1459 @@ +
    +
    + - //删除主图片 - function delete_root_image() { - $("#ic_photo").val(''); - $("#ic_photo_img").attr("src", '/css/images/uploadPic.jpg'); +
    + +
    + +
    + + + +
    +
    +
    +
    + +
    +
    + session->userdata('session_admin'); +$show_photo_meta = get_meta($information->ic_id, 'meta_use_list_picture'); +$amp_photo = ''; +if ($information->ic_photo && $show_photo_meta !== 'no') { + $amp_photo = $this->config->item('site_image_url') . $information->ic_photo; +} +$amp_build_url = "/amp_app/?icid=" . $information->ic_id . "&is_path=" . $information->is_path . "&usr=" . urlencode($amp_user['OPI_Name']) . "&url=" . urlencode($information->ic_url) . "&photo=" . urlencode($amp_photo) . "&site=" . urlencode($this->config->item('site_url')) . "&imgurl=" . urlencode($this->config->item('site_image_url')); +?> + ic_id, 'AMP_BODY_PC_STATUS') == 'yes') { + $PcAmpChecked = 'checked'; + } else { + $PcAmpChecked = ''; } + ?> + + | + | + + + amp_status === '1') {?> + + + amp_status === '2') {?> + + + amp_status === '0') {?> + + +
    +
    + +
    +
    +
    +
    +
    +
    链接标题
    + +
    +
    +
    +
    链接地址 + + + ic_sitecode == 'cht') {?> + + + ic_sitecode == 'gm') {?> + + +
    + +
    +
    + + - +
    +
    + + + + + + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    +
    + + + - //选择内容图片 - function openKCFinder_Content() { - var site_url = 'config->item('site_url') ?>'; - var weburl = encodeURI(site_url + $("#ic_url").val()); - window.CallBack = openKCFinder_Content_callback; - window.open('/media/popselectpicture.php?site_code=config->item('site_code'); ?>&site_lgc=config->item('site_lgc'); ?>&WebUrl=' + weburl, 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600'); - } - function openKCFinder_Content_callback(result) { - var site_image_url = 'config->item('media_image_url') ?>'; - var use_pictures = $("#use_pictures").val(); - if (result != null) { - for (var key in result.Pinfo) { - if ('config->item('site_code') ?>' == 'cht') { - editor.insertHtml('
    ' + result.Pinfo[key].Sinfo + '' + result.Pinfo[key].Sinfo + '
    '); - insertoutP(); - } else { - editor.insertHtml('' + result.Pinfo[key].PName + ''); - } - use_pictures = use_pictures + result.Pinfo[key].ID + ':' + result.Pinfo[key].PUrl + ':' + result.Pinfo[key].wh + ','; - } - $("#use_pictures").val(use_pictures); - } - } +
    +
    + + +
    +
    + + +
    +
    + + +
    - //搜索产品列表 - function select_product_list(product_type, product_name) { - $("#product_list_ul").html('waiting...'); - $.ajax({ - type: "post", - dataType: "json", - url: "", - data: {'product_type': product_type, 'product_name': product_name}, - success: function (data, textStatus) { - for (var key in data) { - if (data[key].name == 'ok') { - $("#product_list_ul").html(data[key].value); - return true; - } - } - }, - error: function () { - $.modaldialog.error('发生错误,请联系YCC'); - return false; - } - }); - } +
    + + +
    +
    + + + + + + + + + + + + + + + + + +

    + + +
    diff --git a/application/views/bootstrap3/refresh_amp_urls.php b/application/views/bootstrap3/refresh_amp_urls.php index 1c825239..b82cac48 100644 --- a/application/views/bootstrap3/refresh_amp_urls.php +++ b/application/views/bootstrap3/refresh_amp_urls.php @@ -11,6 +11,13 @@ dataType: "json", url: "/" + ic_id, success: function (result, textStatus) { + //当result为空的时候跳过 + if(result.length == 0 || result =='' || undefined || null){ + $(msg_obj).html("发生错误,请重试"); + create_amp_data(++index); + return; + } + $.each(result, function (i, field) { if (i === 'data') { amp_code = field.amp; @@ -60,7 +67,7 @@ if ($('#cache' + index).html() == '手动管理,不会自动更新') { //手动更新的项目跳过 create_amp_data(++index); } else { - batch_update_amp(index); + setTimeout("batch_update_amp("+index+")",5000); } } } diff --git a/application/views/cache/update.php b/application/views/cache/update.php index 1a6d50ff..61595611 100644 --- a/application/views/cache/update.php +++ b/application/views/cache/update.php @@ -3,9 +3,9 @@ 更新静态页-v1.0a - - - + + + + + + + + +

    Lorem Ipsum

    + +

    Ipsum, Lorem

    + +
    +

    +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam massa enim, tincidunt non hendrerit eget, malesuada et nisi. In hac habitasse platea dictumst. Praesent nec laoreet ante. Aenean tempus nisi in erat tempus tempus. Vestibulum imperdiet lobortis sapien eu tempus. Vivamus volutpat quam sed eros molestie vitae dignissim nulla ultricies. Vivamus dictum elit velit. Pellentesque pellentesque ornare ornare. Mauris vel gravida sapien. Praesent eleifend tristique ipsum nec tempor. Vestibulum cursus eleifend tellus, a egestas lectus euismod sed. +

    +

    +Duis nec massa quam. Nulla porta, enim ut consequat tincidunt, quam tortor consequat enim, eu interdum eros lorem eu turpis. Cras vestibulum orci quis felis tristique quis semper sem imperdiet. Sed mattis tincidunt risus scelerisque scelerisque. Aliquam nisl quam, bibendum quis luctus eu, sodales ut felis. Integer id turpis nisi. Phasellus mattis nulla eu odio faucibus a auctor orci tristique. Nulla ullamcorper, risus nec semper accumsan, libero lacus aliquet elit, quis lacinia metus nunc vestibulum turpis. Suspendisse vel sapien vel magna auctor aliquam. Aenean fringilla fringilla metus non imperdiet. Aliquam nisl lacus, tempus vitae commodo non, accumsan ut lectus. Nam in urna eu neque pretium aliquam. Maecenas sit amet urna lectus. Donec vitae metus enim. +

    +

    +Sed lacus nulla, faucibus eget ullamcorper ut, mollis at metus. Vivamus tortor felis, tincidunt at tristique ut, tincidunt feugiat velit. Ut euismod felis non urna luctus luctus. Integer nec urna massa. Mauris vestibulum hendrerit auctor. Morbi at tellus nec arcu scelerisque rhoncus. Phasellus facilisis interdum lorem vulputate posuere. Nullam quis felis est. Aenean metus augue, tempus non ultricies et, dapibus vel felis. Pellentesque at augue velit. Nulla erat nisi, posuere eu pellentesque id, pretium ac libero. Phasellus tincidunt sollicitudin sapien at mollis. Nullam et libero velit, nec tincidunt eros. Aliquam et sem elit. Quisque suscipit orci enim, vel aliquam nisi. Suspendisse in enim a ligula blandit volutpat in id velit. +

    +

    +Nam tempor neque nec ligula sollicitudin rhoncus. Etiam et lorem vel odio pharetra interdum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In imperdiet nisi sed diam rutrum gravida in vel massa. Nam ullamcorper ultrices diam, vitae consequat lacus consequat consequat. Curabitur laoreet leo sed tortor fringilla nec euismod libero lobortis. Donec non enim lectus. Suspendisse potenti. In hac habitasse platea dictumst. Fusce semper auctor neque nec lobortis. Praesent vitae mauris turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sed pharetra odio. Suspendisse potenti. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis eget odio purus, quis dapibus massa. +

    +

    +Curabitur ut dapibus eros. Donec tempor, felis ac facilisis bibendum, nisi purus pellentesque sem, sollicitudin tempor lectus nulla at mi. Maecenas quis urna ut ante pulvinar pellentesque. Duis auctor imperdiet suscipit. Pellentesque dui nulla, volutpat quis posuere a, gravida ornare augue. Proin nec felis pharetra magna pellentesque facilisis. Curabitur lacus libero, malesuada sed tincidunt ac, aliquet ut tortor. Etiam gravida lorem nulla, consectetur eleifend risus. Donec facilisis, turpis laoreet imperdiet laoreet, purus justo egestas nulla, et hendrerit leo eros at orci. Nunc vulputate mauris sit amet sapien accumsan nec euismod orci volutpat. Sed ultricies velit ut lorem venenatis in convallis tellus imperdiet. Aenean auctor ultrices est ultricies rhoncus. Phasellus non magna a leo luctus fermentum nec fermentum erat. +

    +

    + +Sed faucibus nisl quis diam mollis quis varius tortor tincidunt. Phasellus in turpis in tellus consectetur mollis. Donec a neque id metus condimentum dignissim. In hac habitasse platea dictumst. Pellentesque sem nisi, pulvinar nec sagittis vitae, lacinia non tellus. Aliquam dignissim dignissim volutpat. Pellentesque ut quam et mi tincidunt varius id vel quam. Duis consectetur elit ac ligula fringilla elementum. In elementum tellus viverra mi vehicula vitae tempus lectus laoreet. Nullam diam nibh, tincidunt vitae imperdiet a, luctus a felis. In posuere pulvinar volutpat. Pellentesque eget viverra justo. +

    +

    +Nullam nec sapien at felis molestie auctor. Sed dignissim erat eu nulla ullamcorper mattis. Curabitur felis sem, feugiat non semper ut, sollicitudin sed ipsum. Quisque cursus laoreet turpis, sit amet molestie neque consequat at. Vestibulum eu ligula quis nisl pulvinar rhoncus. Praesent faucibus, dolor in elementum ullamcorper, tellus ante mattis risus, ac imperdiet eros eros quis risus. Praesent luctus libero a diam pharetra eget placerat risus pulvinar. Donec sollicitudin pulvinar velit vel pellentesque. Quisque sagittis leo ac mauris congue adipiscing. In tempus facilisis facilisis. Aliquam erat volutpat. Suspendisse sagittis libero ipsum. +

    +

    +Aliquam at cursus ipsum. Vivamus purus mi, pretium at molestie id, dictum in quam. Proin egestas auctor iaculis. Maecenas sodales facilisis tellus eu bibendum. Vestibulum varius vehicula scelerisque. Praesent condimentum varius commodo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec sem nisl, sagittis eu euismod non, tempor nec magna. Fusce sed auctor nisl. Phasellus porttitor sagittis est, sit amet eleifend elit dignissim et. Nam consectetur elementum elit non egestas. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum a ultricies neque. Integer hendrerit nisi id dolor porta quis venenatis lacus dignissim. In vitae fringilla magna. +

    +

    +Fusce ultrices scelerisque felis, id semper quam posuere a. Sed nec erat eget velit euismod condimentum a in enim. Maecenas bibendum aliquam tincidunt. Mauris vestibulum neque at nulla sagittis id lacinia enim fermentum. Quisque adipiscing risus nec massa auctor condimentum. Mauris venenatis lacus justo, eu varius odio. Fusce commodo luctus felis, vitae lobortis lectus facilisis id. Nunc faucibus vestibulum urna et lacinia. Cras ornare quam neque, non gravida sapien. Cras porta, diam sit amet laoreet rutrum, massa erat commodo diam, eu rhoncus nisl massa ac metus. In sem mauris, venenatis nec euismod ac, suscipit condimentum neque. Quisque pretium blandit lectus, ut aliquet neque rhoncus eu. Vivamus ultrices porttitor tincidunt. Curabitur ut ipsum non ipsum ultrices tincidunt. Integer scelerisque augue nec nisl varius tristique. Morbi condimentum rutrum sodales. Pellentesque odio mauris, porttitor ac sollicitudin in, ultrices ut diam. +

    +

    +Sed congue adipiscing orci a pellentesque. Etiam quis neque eu nulla viverra egestas. Ut ultricies dui non enim rhoncus laoreet. Nulla molestie nibh non erat venenatis gravida. Pellentesque faucibus sem sit amet risus tincidunt non ultrices diam auctor. Praesent quis libero et tellus tempor molestie. Mauris ullamcorper feugiat libero sed elementum. Donec eget nunc eget diam hendrerit pulvinar. Ut ut imperdiet enim. Vestibulum sed quam lorem. Nunc ipsum massa, venenatis eget condimentum at, ornare id ante. Vestibulum ornare volutpat tincidunt. Etiam a eros erat. Curabitur lobortis, nisi a malesuada tincidunt, nisi enim congue eros, in dictum elit odio at nunc. Nam hendrerit porta velit a viverra. +

    +

    +Etiam vel velit urna. Donec commodo aliquet magna rhoncus pretium. Donec fermentum orci in diam dictum non pulvinar mi tristique. Morbi urna libero, sagittis vel facilisis nec, ornare vitae nunc. Pellentesque laoreet mi a mi condimentum sagittis. Donec eleifend, nisi sit amet tincidunt sollicitudin, leo magna accumsan elit, at adipiscing velit lacus id purus. Aenean nunc sapien, egestas vitae pretium viverra, bibendum vel tellus. Maecenas mattis dui ac justo facilisis sollicitudin. Proin in mi ac lacus hendrerit congue ac vitae elit. Aliquam erat volutpat. In hac habitasse platea dictumst. Phasellus dapibus diam vel velit consectetur tempor. Maecenas viverra suscipit bibendum. Sed non enim neque. +

    + +

    +Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Phasellus at odio et odio volutpat egestas. Fusce non pellentesque felis. Nunc fermentum posuere sem quis egestas. Integer nec orci vel eros fringilla bibendum. Praesent placerat molestie elit at mattis. Nunc rutrum faucibus arcu non bibendum. Vestibulum at sapien sit amet sem iaculis congue. Morbi tempus, libero vitae interdum suscipit, lacus ipsum suscipit quam, non pretium nulla orci eget dui. Praesent et nisl turpis, ultricies convallis quam. In tempor urna et eros aliquet accumsan. Phasellus lobortis bibendum libero sit amet viverra. Aenean consectetur, neque eu cursus posuere, est leo molestie dui, sit amet vulputate mi erat eu tortor. Suspendisse arcu velit, porta sit amet adipiscing sed, ultrices id urna. In hendrerit iaculis massa in pretium. Vivamus eros augue, venenatis non hendrerit a, bibendum in tortor. Fusce et mauris lorem, vitae semper ligula. Nam iaculis, eros eu varius varius, orci sapien rhoncus arcu, et luctus urna lectus non quam. Donec gravida convallis justo at bibendum. Quisque non est velit, sed laoreet augue. +

    +
    + + +