From 4c9a39f6ae6419b5157c75ca948df07ba26a967d Mon Sep 17 00:00:00 2001 From: ycc Date: Fri, 25 Dec 2020 16:29:33 +0800 Subject: [PATCH] =?UTF-8?q?Inspiration=E4=BF=A1=E6=81=AF=E6=8E=A8=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 412 +++++++++++++---------- application/models/information_model.php | 11 + application/views/mobile_first/ch-pc.php | 2 +- 3 files changed, 246 insertions(+), 179 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index 4d1d9153..3d3e9d99 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -115,7 +115,7 @@ class Information extends CI_Controller //删除前,备份amp的meta标签-isid。 $meta_value = $this->InfoMetas_model->get($info_detail->ic_id, 'AMP_JSON'); if ($meta_value) { - $this->Logs_model->backup_meta($info_detail->ic_id, $meta_value, 'AMP_JSON_'.$is_id); + $this->Logs_model->backup_meta($info_detail->ic_id, $meta_value, 'AMP_JSON_' . $is_id); } $this->Logs_model->delete($is_id, $info_detail->ic_content); @@ -137,10 +137,11 @@ class Information extends CI_Controller return true; } } - - //移动优先的编辑 - public function edit_mobile($is_id){ - //查询结构信息 + + //移动优先的编辑 + public function edit_mobile($is_id) + { + //查询结构信息 $Structure = $this->InfoStructures_model->Detail($is_id); if ($Structure == FALSE) { show_404(); @@ -159,12 +160,12 @@ class Information extends CI_Controller //信息内容 $data['information'] = $this->Information_model->Detail($is_id); - - $this->load->view('bootstrap3/header', $data); - $this->load->view('mobile_first/editor'); - $this->load->view('bootstrap3/footer'); - - } + + $this->load->view('bootstrap3/header', $data); + $this->load->view('mobile_first/editor'); + $this->load->view('bootstrap3/footer'); + + } public function edit($is_id) { @@ -230,7 +231,6 @@ class Information extends CI_Controller } - if ($Structure->is_sitecode == 'ct') { $data['infoTypeList'] = $this->config->item('InfoType_ct'); } elseif ($Structure->is_sitecode == 'ah') { @@ -278,7 +278,6 @@ class Information extends CI_Controller } - $data['templateList'] = $this->config->item('templates'); //翰特产品类型 $data['productTypeList'] = $this->config->item('ProductType_HT'); @@ -326,31 +325,31 @@ class Information extends CI_Controller $data['all_tags'] = array_filter($data['all_tags']); } - //获取移动优先的模板,如果有的话 - $mobile_first_template_path='mobile_first/'.$this->config->item('site_code'); - if(is_file(APPPATH.'views/'.$mobile_first_template_path.EXT)){ - $mobile_template_H1=$this->call_mobile_template_H1($mobile_first_template_path,$data['information']->is_path,$data['information']->ic_author,$data['information']->ic_title,$data['information']->ic_photo);//H1模板替换 - $data['mobile_first_template']=$this->load->view($mobile_first_template_path, '', TRUE); - $data['mobile_first_template']=str_replace('', $mobile_template_H1, $data['mobile_first_template']); - }else{ - $data['mobile_first_template']='没有找到移动模板'; - } - + //获取移动优先的模板,如果有的话 + $mobile_first_template_path = 'mobile_first/' . $this->config->item('site_code'); + if (is_file(APPPATH . 'views/' . $mobile_first_template_path . EXT)) { + $mobile_template_H1 = $this->call_mobile_template_H1($mobile_first_template_path, $data['information']->is_path, $data['information']->ic_author, $data['information']->ic_title, $data['information']->ic_photo);//H1模板替换 + $data['mobile_first_template'] = $this->load->view($mobile_first_template_path, '', TRUE); + $data['mobile_first_template'] = str_replace('', $mobile_template_H1, $data['mobile_first_template']); + } else { + $data['mobile_first_template'] = '没有找到移动模板'; + } + $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 redirect($jumpUrl){ + * + * header('HTTP/1.1 301 Moved Permanently'); + * + * header($jumpUrl);// 301 跳转到设置的 url + * + * exit(); + * + * } */ public function test_proxy($url = false) { $curl = curl_init(); @@ -448,7 +447,7 @@ class Information extends CI_Controller 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'); + $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') { @@ -483,17 +482,17 @@ class Information extends CI_Controller if (strcasecmp($site_code, "gm") == 0 && !empty($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url, true); - }else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) { - //读取模板生成PC和移动优先文件 - $this->make_mobile_html($information); - $this->make_pc_html($information); + } else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) { + //读取模板生成PC和移动优先文件 + $this->make_mobile_html($information); + $this->make_pc_html($information); } else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url); } else if (strcasecmp($site_code, "ah") == 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 && strcasecmp($site_code, "ah") != 0) { //非cht站点并且非GM并且非AH $update_info_log = $this->update_cache($ic_url); - }else if (strcasecmp($site_code, "ct") == 0 && !empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "ct") == 0 && !empty($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url); } @@ -557,155 +556,213 @@ class Information extends CI_Controller } return true; } - - function make_mobile_html($information){ - $data=array(); - //获取移动优先的模板,如果有的话 - $mobile_first_template_path='mobile_first/'.$this->config->item('site_code'); - if(is_file(APPPATH.'views/'.$mobile_first_template_path.EXT)){ - $mobile_template=$this->load->view($mobile_first_template_path, '', TRUE); - }else{ - return false; - } - $mobile_template=str_replace('', $this->input->post('ic_seo_title'), $mobile_template); - $mobile_template=str_replace('', $this->input->post('ic_seo_description'), $mobile_template); - $mobile_template=str_replace('', $this->input->post('ic_seo_keywords'), $mobile_template); - $mobile_template=str_replace('', $this->input->post('site_url').$this->input->post('ic_url'), $mobile_template); - $mobile_template_H1=$this->call_mobile_template_H1($mobile_first_template_path,$this->input->post('is_path'),$this->input->post('ic_author'),$this->input->post('ic_title'),$this->input->post('ic_photo'));//H1模板替换 - $mobile_template=str_replace('', $mobile_template_H1, $mobile_template); - $mobile_template=str_replace('', $this->input->post('ic_content'), $mobile_template); - $template_NEXT=$this->call_mobile_template_NEXT($mobile_first_template_path,$this->input->post('is_id')); - $mobile_template=str_replace('', $template_NEXT, $mobile_template); + + function make_mobile_html($information) + { + $data = array(); + //获取移动优先的模板,如果有的话 + $mobile_first_template_path = 'mobile_first/' . $this->config->item('site_code'); + if (is_file(APPPATH . 'views/' . $mobile_first_template_path . EXT)) { + $mobile_template = $this->load->view($mobile_first_template_path, '', TRUE); + } else { + return false; + } + $mobile_template = str_replace('', $this->input->post('ic_seo_title'), $mobile_template); + $mobile_template = str_replace('', $this->input->post('ic_seo_description'), $mobile_template); + $mobile_template = str_replace('', $this->input->post('ic_seo_keywords'), $mobile_template); + $mobile_template = str_replace('', $this->input->post('site_url') . $this->input->post('ic_url'), $mobile_template); + $mobile_template_H1 = $this->call_mobile_template_H1($mobile_first_template_path, $this->input->post('is_path'), $this->input->post('ic_author'), $this->input->post('ic_title'), $this->input->post('ic_photo'));//H1模板替换 + $mobile_template = str_replace('', $mobile_template_H1, $mobile_template); + $mobile_template = str_replace('', $this->input->post('ic_content'), $mobile_template); + $template_NEXT = $this->call_mobile_template_NEXT($mobile_first_template_path, $this->input->post('is_id')); + $mobile_template = str_replace('', $template_NEXT, $mobile_template); //社媒分享图片 - if(!empty($information->ic_photo)){ - $full_ic_photo=$this->config->item('site_image_url').$information->ic_photo; - $mobile_template=str_replace('', '', $mobile_template); - } - // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm - $mobile_html=$this->config->item('cache')[$this->config->item('site_code')]['cache_path'].$this->input->post('ic_url'); - $mobile_html=str_replace("\\", "/", $mobile_html); - if(substr($mobile_html, -1, 1)== '/'){ - $mobile_html=$mobile_html.'index.htm'; - } - $mobile_html.='-mobile.htm'; - create_folder_by_path(dirname($mobile_html)); - file_put_contents($mobile_html, $mobile_template, LOCK_EX); - } - - - function make_pc_html($information){ - $data=array(); + if (!empty($information->ic_photo)) { + $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; + $mobile_template = str_replace('', '', $mobile_template); + } + // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm + $mobile_html = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $this->input->post('ic_url'); + $mobile_html = str_replace("\\", "/", $mobile_html); + if (substr($mobile_html, -1, 1) == '/') { + $mobile_html = $mobile_html . 'index.htm'; + } + $mobile_html .= '-mobile.htm'; + create_folder_by_path(dirname($mobile_html)); + file_put_contents($mobile_html, $mobile_template, LOCK_EX); + } + + + function make_pc_html($information) + { + $data = array(); //获取PC的模板,如果有的话 - $template_path='mobile_first/'.$this->config->item('site_code'); - if(is_file(APPPATH.'views/'.$template_path.'-pc'.EXT)){ - $template=$this->load->view($template_path.'-pc', '', TRUE); - }else{ + $template_path = 'mobile_first/' . $this->config->item('site_code'); + if (is_file(APPPATH . 'views/' . $template_path . '-pc' . EXT)) { + $template = $this->load->view($template_path . '-pc', '', TRUE); + } else { return false; } - $template=str_replace('', $this->input->post('ic_seo_title'), $template); - $template=str_replace('', $this->input->post('ic_seo_description'), $template); - $template=str_replace('', $this->input->post('ic_seo_keywords'), $template); - $template=str_replace('', $this->input->post('site_url').$this->input->post('ic_url'), $template); - $template_H1=$this->call_mobile_template_H1($template_path,$this->input->post('is_path'),$this->input->post('ic_author'),$this->input->post('ic_title'),$this->input->post('ic_photo'));//H1模板替换 - $template=str_replace('', $template_H1, $template); - $template=str_replace('', $this->input->post('ic_content'), $template); - $template_NEXT=$this->call_mobile_template_NEXT($template_path,$this->input->post('is_id')); - $template=str_replace('', $template_NEXT, $template); + $template = str_replace('', $this->input->post('ic_seo_title'), $template); + $template = str_replace('', $this->input->post('ic_seo_description'), $template); + $template = str_replace('', $this->input->post('ic_seo_keywords'), $template); + $template = str_replace('', $this->input->post('site_url') . $this->input->post('ic_url'), $template); + $template_H1 = $this->call_mobile_template_H1($template_path, $this->input->post('is_path'), $this->input->post('ic_author'), $this->input->post('ic_title'), $this->input->post('ic_photo'));//H1模板替换 + $template = str_replace('', $template_H1, $template); + $template = str_replace('', $this->input->post('ic_content'), $template); + $template_NEXT = $this->call_mobile_template_NEXT($template_path, $this->input->post('is_id')); + $template = str_replace('', $template_NEXT, $template); //社媒分享图片 - if(!empty($information->ic_photo)){ - $full_ic_photo=$this->config->item('site_image_url').$information->ic_photo; - $template=str_replace('', '', $template); + if (!empty($information->ic_photo)) { + $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; + $template = str_replace('', '', $template); } // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm - $html_path=$this->config->item('cache')[$this->config->item('site_code')]['cache_path'].$this->input->post('ic_url'); - $html_path=str_replace("\\", "/", $html_path); - if(substr($html_path, -1, 1)== '/'){ - $html_path=$html_path.'index.htm'; + $html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $this->input->post('ic_url'); + $html_path = str_replace("\\", "/", $html_path); + if (substr($html_path, -1, 1) == '/') { + $html_path = $html_path . 'index.htm'; } - $html_path.='-pc.htm'; + $html_path .= '-pc.htm'; create_folder_by_path(dirname($html_path)); file_put_contents($html_path, $template, LOCK_EX); } - function call_mobile_template_H1($mobile_first_template_path,$is_path,$ic_author,$ic_title,$ic_photo){ - $data['infocategory']=$this->Information_model->get_detail_by_path($is_path,1);//信息所属分类,获取信息顶级节点内容 - $data['author']=$this->Operator_model->get_author_nikename($ic_author);//获取作者信息 - $data['ic_title']=$ic_title; - $data['ic_photo']=$ic_photo; - return $this->load->view($mobile_first_template_path.'-h1', $data, TRUE); + function call_mobile_template_H1($mobile_first_template_path, $is_path, $ic_author, $ic_title, $ic_photo) + { + $data['infocategory'] = $this->Information_model->get_detail_by_path($is_path, 1);//信息所属分类,获取信息顶级节点内容 + $data['author'] = $this->Operator_model->get_author_nikename($ic_author);//获取作者信息 + $data['ic_title'] = $ic_title; + $data['ic_photo'] = $ic_photo; + return $this->load->view($mobile_first_template_path . '-h1', $data, TRUE); } - function call_mobile_template_NEXT($template_path,$is_id){ - $data['detail']=$this->Information_model->Detail($is_id);//信息所属分类,获取信息顶级节点内容 - $data['root_detail']=$this->Information_model->get_detail_by_path($data['detail']->is_path,1);//信息所属分类,获取信息顶级节点内容 - //how to plan - $data['info_howtoplan']=$this->Information_model->search_by_words($data['root_detail']->is_path,array('how','plan')); - if(empty($data['info_howtoplan'])){//找不到对应信息则显示备用 - $data['info_howtoplan']=$this->Information_model->Detail('/travelguide/plan-first-trip.htm'); - } - $data['info_howtoplan_root']=$this->Information_model->get_detail_by_path($data['info_howtoplan']->is_path,1);//信息所属分类,获取信息顶级节点内容 - if(!empty($data['info_howtoplan'])){ - if(empty($data['info_howtoplan']->ic_photo)){ - $images=get_image_url_by_source($data['info_howtoplan']->ic_content); - if(!empty($images)){ - $data['info_howtoplan']->ic_photo=$images[1][0]; - } - }else{ - $data['info_howtoplan']->ic_photo=$this->config->item('site_image_url').$data['info_howtoplan']->ic_photo; + //通过内容找到第一张图片 + function set_photo_content($ic_photo, $ic_content) + { + if (empty($ic_photo)) { + $images = get_image_url_by_source($ic_content); + if (!empty($images)) { + return $images[1][0]; } + } else { + return $this->config->item('site_image_url') . $ic_photo; } - //best time to visit - $data['info_besttime']=$this->Information_model->search_by_words($data['root_detail']->is_path,array('best','time')); - if(empty($data['info_besttime'])){ - $data['info_besttime']=$this->Information_model->Detail('/weather/china-best-times.htm'); - } - $data['info_besttime_root']=$this->Information_model->get_detail_by_path($data['info_besttime']->is_path,1);//信息所属分类,获取信息顶级节点内容 - if(!empty($data['info_besttime'])){ - if(empty($data['info_besttime']->ic_photo)){ - $images=get_image_url_by_source($data['info_besttime']->ic_content); - if(!empty($images)){ - $data['info_besttime']->ic_photo=$images[1][0]; + return ''; + } + + function call_mobile_template_NEXT($template_path, $is_id) + { + $data['detail'] = $this->Information_model->Detail($is_id);//信息所属分类,获取信息顶级节点内容 + $data['type_detail'] = $this->Information_model->get_detail_by_path($data['detail']->is_path, 0);//信息所属分组,根据分组进行不同推荐 + $data['root_detail'] = $this->Information_model->get_detail_by_path($data['detail']->is_path, 1);//信息所属分类,获取信息顶级节点内容 + + switch (strtolower($data['type_detail']->ic_url_title)) { + case 'inspiration': + //随机获取两个同级节点内容 + $random_array = $this->Information_model->random(2, $data['detail']->is_parent_id, array($data['detail']->is_id)); + if (!empty($random_array[0])) { + $data['info_howtoplan'] = $random_array[0]; + $data['info_howtoplan_root'] = $data['root_detail']; + $data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content); } - }else{ - $data['info_besttime']->ic_photo=$this->config->item('site_image_url').$data['info_besttime']->ic_photo; - } - } - //top things to do - $data['info_topthings']=$this->Information_model->search_by_words($data['root_detail']->is_path,array('top','things')); - if(empty($data['info_topthings'])){ - $data['info_topthings']=$this->Information_model->Detail('/travelguide/article-top-china-tourist-destination.htm'); - } - $data['info_topthings_root']=$this->Information_model->get_detail_by_path($data['info_topthings']->is_path,1);//信息所属分类,获取信息顶级节点内容 - if(!empty($data['info_topthings'])){ - if(empty($data['info_topthings']->ic_photo)){ - $images=get_image_url_by_source($data['info_topthings']->ic_content); - if(!empty($images)){ - $data['info_topthings']->ic_photo=$images[1][0]; + if (!empty($random_array[1])) { + $data['info_besttime'] = $random_array[1]; + $data['info_besttime_root'] = $data['root_detail']; + $data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content); } - }else{ - $data['info_topthings']->ic_photo=$this->config->item('site_image_url').$data['info_topthings']->ic_photo; - } - } - //hotel , where to stay - $data['info_hotel']=$this->Information_model->search_by_words($data['root_detail']->is_path,array('hotel')); - if(empty($data['info_hotel'])){ - $data['info_hotel']=$this->Information_model->search_by_words($data['root_detail']->is_path,array('where','stay')); - } - if(empty($data['info_hotel'])){ - $data['info_hotel']=$this->Information_model->Detail('/travelguide/most-beautiful-places.htm'); - } - $data['info_hotel_root']=$this->Information_model->get_detail_by_path($data['info_hotel']->is_path,1);//信息所属分类,获取信息顶级节点内容 - if(!empty($data['info_hotel'])){ - if(empty($data['info_hotel']->ic_photo)){ - $images=get_image_url_by_source($data['info_hotel']->ic_content); - if(!empty($images)){ - $data['info_hotel']->ic_photo=$images[1][0]; + //漏斗作用的页面,随机挑选一篇 + $random_array = array( + '/travelguide/china-facts.htm', + '/travelguide/article-top-china-tourist-destination.htm', + '/travelguide/most-beautiful-places.htm', + '/weather/china-best-times.htm', + '/travelguide/article-10-movies-to-watch.htm', + '/travelguide/article-culture-shock-in-china.htm', + '/travelguide/article-what-chinese-eat-for-breakfast.htm', + '/travelguide/china-top-10-attractions.htm', + '/travelguide/chinese-food/eight-chinese-dishes.htm', + '/travelguide/china-travel-reopen-restrictions.htm' + ); + $data['info_topthings'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); + if (!empty($data['info_topthings'])) { + $data['info_topthings_root'] = $data['root_detail']; + $data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content); } - }else{ - $data['info_hotel']->ic_photo=$this->config->item('site_image_url').$data['info_hotel']->ic_photo; - } + //文化板块的页面,随机挑选一篇 + $random_array = array( + '/travelguide/chinese-zodiac/', + '/travelguide/culture/china-arts-crafts.htm', + '/beijing/forbidden-city/', + '/travelguide/culture/traditionalmedichine.htm', + '/travelguide/chinese-tea/', + '/travelguide/kungfu/', + '/travelguide/culture/china-history.htm', + '/travelguide/chinese-food/', + '/travelguide/chinese-language/' + ); + $data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); + if (!empty($data['info_hotel'])) { + $data['info_hotel_root'] = $data['root_detail']; + $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); + } + break; + case 'destination': + //how to plan + $data['info_howtoplan'] = $this->Information_model->search_by_words($data['root_detail']->is_path, array('how', 'plan')); + if (empty($data['info_howtoplan'])) {//找不到对应信息则显示备用 + $data['info_howtoplan'] = $this->Information_model->Detail('/travelguide/plan-first-trip.htm'); + } + $data['info_howtoplan_root'] = $this->Information_model->get_detail_by_path($data['info_howtoplan']->is_path, 1);//信息所属分类,获取信息顶级节点内容 + if (!empty($data['info_howtoplan'])) { + $data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content); + } + //best time to visit + $data['info_besttime'] = $this->Information_model->search_by_words($data['root_detail']->is_path, array('best', 'time')); + if (empty($data['info_besttime'])) { + $data['info_besttime'] = $this->Information_model->Detail('/weather/china-best-times.htm'); + } + $data['info_besttime_root'] = $this->Information_model->get_detail_by_path($data['info_besttime']->is_path, 1);//信息所属分类,获取信息顶级节点内容 + if (!empty($data['info_besttime'])) { + $data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content); + } + //top things to do + $data['info_topthings'] = $this->Information_model->search_by_words($data['root_detail']->is_path, array('top', 'things')); + if (empty($data['info_topthings'])) { + $data['info_topthings'] = $this->Information_model->Detail('/travelguide/article-top-china-tourist-destination.htm'); + } + $data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1);//信息所属分类,获取信息顶级节点内容 + if (!empty($data['info_topthings'])) { + $data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content); + } + //hotel , where to stay + $data['info_hotel'] = $this->Information_model->search_by_words($data['root_detail']->is_path, array('hotel')); + if (empty($data['info_hotel'])) { + $data['info_hotel'] = $this->Information_model->search_by_words($data['root_detail']->is_path, array('where', 'stay')); + } + if (empty($data['info_hotel'])) { + $data['info_hotel'] = $this->Information_model->Detail('/travelguide/most-beautiful-places.htm'); + } + $data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1);//信息所属分类,获取信息顶级节点内容 + if (!empty($data['info_hotel'])) { + $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); + } + break; + case 'planing-1(guide)': + case 'planning-2 (decision tips)': + $random_array = array( + '/feedback/', + '/travelguide/how-chinahighlights-selects-your-hotel.htm', + '/travelguide/article-private-tour-vs-group-tour.htm', + '/aboutus/who-recommended.htm', + '/aboutus/no-shops.htm', + '/aboutus/company-history.htm' + ); + break; + default: } - return $this->load->view($template_path.'-next', $data, TRUE); + + return $this->load->view($template_path . '-next', $data, TRUE); } //更新静态文件 @@ -746,9 +803,9 @@ class Information extends CI_Controller //if ($delete_only) { // $url = "http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url); //} else { - //先删除再生成,部分页面没有在信息平台中 - GET_HTTP("http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url)); - $url = "http://144.76.185.44:8029/gm.php/information/detail/?static_html_url=" . $url; + //先删除再生成,部分页面没有在信息平台中 + GET_HTTP("http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url)); + $url = "http://144.76.185.44:8029/gm.php/information/detail/?static_html_url=" . $url; //} break; @@ -806,7 +863,7 @@ class Information extends CI_Controller break; case 'ct': //子站点使用 - $url = 'http://50.97.246.187:22223' . $url; + $url = 'http://50.97.246.187:22223' . $url; break; case 'sht': case 'gl': @@ -859,8 +916,7 @@ class Information extends CI_Controller $url = isset($tempu['path']) ? $tempu['path'] : '/'; $pad = $tempu['host']; $flag = true; - } - //如果传递进来的url没有域名,则使用当前站点的信息进行判断 + } //如果传递进来的url没有域名,则使用当前站点的信息进行判断 else { $url = str_replace($this->config->item('site_url'), '', $url); $pad = str_replace('http://', '', $this->config->item('site_url')); @@ -905,11 +961,11 @@ class Information extends CI_Controller function backup_content($log_id) { $data['log_info'] = $this->Logs_model->read($log_id); - if($data['log_info']->log_action == 'backup_amp'){ - $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id,true); - }else{ - $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id); - } + if ($data['log_info']->log_action == 'backup_amp') { + $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id, true); + } else { + $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'); diff --git a/application/models/information_model.php b/application/models/information_model.php index 2150894f..a11e89a5 100644 --- a/application/models/information_model.php +++ b/application/models/information_model.php @@ -77,6 +77,17 @@ class Information_model extends CI_Model { return $this->GetList(); } + //在同级别下,随机获取N条数据,并且排除某些id + function random($topnum,$is_parent_id,array $exclude_ids){ + $this->init(); + $this->topNum = $topnum; + $this->search = " AND is_parent_id =". $this->HT->escape($is_parent_id); + $exclude_ids_string=implode(',',$exclude_ids); + $this->search .= " AND is_id NOT in ($exclude_ids_string,0)"; + $this->orderBy = " ORDER BY NewID() "; + return $this->GetList(); + } + //根据url搜索信息 function search_url($url) { $this->init(); diff --git a/application/views/mobile_first/ch-pc.php b/application/views/mobile_first/ch-pc.php index dd137aa6..30a7e6df 100644 --- a/application/views/mobile_first/ch-pc.php +++ b/application/views/mobile_first/ch-pc.php @@ -92,7 +92,7 @@
  • Guilin
  • Zhangjiajie
  • Yunnan
  • -
  • Huangshan
  • +
  • Huangshan
  • Xi'an
  • Chengdu