信息推荐规则变更

ct-mobile-first
ycc 4 years ago
parent 584376f19b
commit ea7ccf984d

@ -751,7 +751,7 @@ class Information extends CI_Controller
function call_mobile_template_NEXT($template_path, $is_id) function call_mobile_template_NEXT($template_path, $is_id)
{ {
$data['detail'] = $this->Information_model->Detail($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['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);//信息所属分类,获取信息顶级节点内容 $data['root_detail'] = $this->Information_model->get_detail_by_path($data['detail']->is_path, 1);//信息所属分类,获取信息顶级节点内容
@ -805,9 +805,13 @@ class Information extends CI_Controller
$data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content);
} }
break; break;
case 'destination': case 'planing-1(guide)':
case 'planning-2 (decision tips)':
case 'destination': //url的第一段表示地区根据第一段来搜索相关数据如/beijing/ 而不是根据is_parent_id因为可能信息和线路是在不同的分类下
$destination_url=trim($data['detail']->ic_url);
$destination_url=substr($destination_url,0,strpos($destination_url,'/',1)+1);
//how to plan //how to plan
$data['info_howtoplan'] = $this->Information_model->search_by_words($data['root_detail']->is_path, array('how', 'plan')); $data['info_howtoplan'] = $this->Information_model->search_by_words($destination_url, array('how', 'plan'),$data['detail']->is_id);
if (empty($data['info_howtoplan'])) {//找不到对应信息则显示备用 if (empty($data['info_howtoplan'])) {//找不到对应信息则显示备用
$data['info_howtoplan'] = $this->Information_model->Detail('/travelguide/plan-first-trip.htm'); $data['info_howtoplan'] = $this->Information_model->Detail('/travelguide/plan-first-trip.htm');
} }
@ -816,7 +820,7 @@ class Information extends CI_Controller
$data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content); $data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content);
} }
//best time to visit //best time to visit
$data['info_besttime'] = $this->Information_model->search_by_words($data['root_detail']->is_path, array('best', 'time')); $data['info_besttime'] = $this->Information_model->search_by_words($destination_url, array('best', 'time'),$data['detail']->is_id);
if (empty($data['info_besttime'])) { if (empty($data['info_besttime'])) {
$data['info_besttime'] = $this->Information_model->Detail('/weather/china-best-times.htm'); $data['info_besttime'] = $this->Information_model->Detail('/weather/china-best-times.htm');
} }
@ -825,7 +829,7 @@ class Information extends CI_Controller
$data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content); $data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content);
} }
//top things to do //top things to do
$data['info_topthings'] = $this->Information_model->search_by_words($data['root_detail']->is_path, array('top', 'things')); $data['info_topthings'] = $this->Information_model->search_by_words($destination_url, array('top', 'things'),$data['detail']->is_id);
if (empty($data['info_topthings'])) { if (empty($data['info_topthings'])) {
$data['info_topthings'] = $this->Information_model->Detail('/travelguide/article-top-china-tourist-destination.htm'); $data['info_topthings'] = $this->Information_model->Detail('/travelguide/article-top-china-tourist-destination.htm');
} }
@ -833,21 +837,7 @@ class Information extends CI_Controller
if (!empty($data['info_topthings'])) { if (!empty($data['info_topthings'])) {
$data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content); $data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content);
} }
//hotel , where to stay //第四篇随机推荐下方url
$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( $random_array = array(
'/feedback/', '/feedback/',
'/travelguide/how-chinahighlights-selects-your-hotel.htm', '/travelguide/how-chinahighlights-selects-your-hotel.htm',
@ -856,24 +846,9 @@ class Information extends CI_Controller
'/aboutus/no-shops.htm', '/aboutus/no-shops.htm',
'/aboutus/company-history.htm' '/aboutus/company-history.htm'
); );
$data['info_howtoplan'] = $this->Information_model->Detail('/travelguide/article-private-tour-vs-group-tour.htm'); $data['info_hotel']=$this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]);
if (!empty($data['info_howtoplan'])) {
$data['info_howtoplan_root'] = $this->Information_model->get_detail_by_path($data['info_howtoplan']->is_path, 1);//信息所属分类,获取信息顶级节点内容
$data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content);
}
$data['info_besttime'] = $this->Information_model->Detail('/travelguide/how-chinahighlights-selects-your-hotel.htm');
if (!empty($data['info_besttime'])) {
$data['info_besttime_root'] = $this->Information_model->get_detail_by_path($data['info_besttime']->is_path, 1);//信息所属分类,获取信息顶级节点内容
$data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content);
}
$data['info_topthings'] = $this->Information_model->Detail('/aboutus/who-recommended.htm');
if (!empty($data['info_topthings'])) {
$data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1);//信息所属分类,获取信息顶级节点内容
$data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content);
}
$data['info_hotel'] = $this->Information_model->Detail('/aboutus/company-history.htm');
if (!empty($data['info_hotel'])) { if (!empty($data['info_hotel'])) {
$data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1);//信息所属分类,获取信息顶级节点内容 $data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1);
$data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content);
} }
break; break;

@ -65,15 +65,15 @@ class Information_model extends CI_Model {
} }
//根据关键词来搜索内容 //根据关键词来搜索内容
function search_by_words($is_path,array $words){ function search_by_words($url,array $words,$self_is_id){
$this->init(); $this->init();
$this->topNum = 1; $this->topNum = 1;
$sql_keyword=' AND ( 1=1 '; $sql_keyword=' AND ( 1=1 ';
foreach ($words as $item) { foreach ($words as $item) {
$sql_keyword .=" AND ic_url like '%". $this->HT->escape_like_str($item) ."%' "; $sql_keyword .=" AND ic_title like '%". $this->HT->escape_like_str($item) ."%' ";
} }
$sql_keyword.=' ) '; $sql_keyword.=' ) ';
$this->search =" AND is1.is_path LIKE '$is_path%' ". $sql_keyword; $this->search =" AND ic_url LIKE '$url%' ". $sql_keyword.' AND is_id<>'.$self_is_id;
return $this->GetList(); return $this->GetList();
} }

@ -31,7 +31,7 @@
<div class="row"> <div class="row">
<div class="col-md-24"> <div class="col-md-24">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"><?php echo $item->ic_title; ?> <span class="pull-right" title="添加节点"><a href="<?php echo site_url('city/addnode/'.$item->is_id) ?>">+</a></span> <div class="panel-heading"><a href="<?php echo site_url('information/edit/'.$item->is_id) ?>"> <?php echo $item->ic_title; ?></a> <span class="pull-right" title="添加节点"><a href="<?php echo site_url('city/addnode/'.$item->is_id) ?>">+</a></span>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<ul class="list-inline"> <ul class="list-inline">

Loading…
Cancel
Save