diff --git a/application/config/config.php b/application/config/config.php index 966a3298..f702ddf0 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -388,6 +388,7 @@ $config['proxy_ips'] = ''; //各站信息组和人员权限分配 $config['site'] = array( 'cht' => array('site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'https://www.chinahighlights.com', 'site_image_url' => '//images.chinahighlights.com', 'site_authors' => array('zzy', 'spt', 'yl', 'gavin', 'sw', 'zl', 'wbl', 'yqw', 'lf', 'zhm', 'pkl'), 'site_user' => ',ycc,lmr, zyh,J,shw,B,zzy,WJJ,Tony,pcf,zxy,wst,wz,v,S,yyg,yxd,wj,sw,yl,hx,spt,wmr,zl,syt,gavin,zm,htc,yqw,bhn,lmj,wbl,yqw,LYY,zhm,si'), + 'ch' => array('site_code' => 'ch', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'https://www.chinahighlights.com', 'site_image_url' => '//images.chinahighlights.com', 'site_authors' => array('TDJ'), 'site_user' => ',ycc,'), 'gm' => array('site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'https://www.chinarundreisen.com', 'site_image_url' => '//bilder.chinarundreisen.com', 'site_authors' => array('DX', 'X', 'K', 'Lan', 'lmr', 'zyh', 'ZYHL', 'TDJ'), 'site_user' => ',ycc,lmr,B,zyh,DX,X,K,htc,zm,bhn,Lan,Tony,zyh,J,v,ZYHL,TDJ,LYY,shw,'), 'vc' => array('site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'https://www.voyageschine.com', 'site_image_url' => '//images.voyageschine.com', 'site_authors' => array('JE', 'kq', 'lya', 'lyz', 'zyh'), 'site_user' => ',ycc,lmr, zyh,JE,htc,kq,lya,bhn,Tony,zyh,B,J,lyz,LYY,'), 'jp' => array('site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'https://www.arachina.com', 'site_image_url' => '//images.arachina.com', 'site_authors' => array('hql', 'LLM', 'SHX', 'lmr', 'zyh', 'zb'), 'site_user' => ',ycc,lmr, zyh,hql,LLM,SHX,htc,zpl,Tony,zyh,J,B,zb,LYY,'), diff --git a/application/controllers/import.php b/application/controllers/import.php index a538d067..cbe82353 100644 --- a/application/controllers/import.php +++ b/application/controllers/import.php @@ -14,7 +14,7 @@ class Import extends CI_Controller // $this->load->model('Area_model'); $this->load->model('Import_model'); // $this->load->model('InfoContents_model'); - // $this->load->model('InfoStructures_model'); + $this->load->model('InfoStructures_model'); $this->load->library('simple_html_dom_lib'); } @@ -51,7 +51,7 @@ class Import extends CI_Controller $h_id=$item->h_id; $file=$item->h_file; $h_done=1; - //$file='D:\wwwroot\gh-html\chinahighlights\xian\tour-planning-md.htm'; + //$file='f:\asiahighlights\myanmar\top-restaurants'; if (!is_file($file)) { echo '文件不存在:'.$file; continue; @@ -61,10 +61,17 @@ class Import extends CI_Controller echo '文件加载失败:'.$file; continue; } + $h_source=$html_object->outertext; $h_content=$html_object->find('div[id=mainContentRight]', 0); if (empty($h_content)) { $h_content=$html_object->find('div[id=content]', 0); } + if (empty($h_content)) { + $h_content=$html_object->find('div.Information', 0); + } + if (empty($h_content)) { + $h_content=$html_object->find('div[id=content_main]', 0); + } if (empty($h_content)) { $h_content=$html_object->find('div[id=mainContent]', 0); } @@ -89,10 +96,11 @@ class Import extends CI_Controller } else { $h_content=$h_content->innertext; } - +//echo $h_content;die(); $h_url=str_replace('\\', '/', $file); - $h_url=str_replace('D:/wwwroot/gh-html/chinahighlights/', 'https://www.chinahighlights.com/', $h_url); - $h_url=str_replace('D:/wwwroot/gh-html/asiahighlights/', 'https://www.asiahighlights.com/', $h_url); + $h_url=str_replace('F:/recovery-html/chinahighlights/', '/', $h_url); + $h_url=str_replace('F:/recovery-html/asiahighlights/', '/', $h_url); + $h_url=str_replace('d:/asiahighlights-htm/', '/', $h_url); $h_url=str_replace('index-md.htm', '', $h_url); $h_url=str_replace('-md.htm', '.htm', $h_url); @@ -129,10 +137,52 @@ class Import extends CI_Controller echo 'h_description:'.$h_description.'
'; echo '
'; //echo $h_content; - $this->Import_model->update_html_info($h_id, $h_h1, $h_title, $h_url, $h_description, $h_content, $h_done); + $this->Import_model->update_html_info($h_id, $h_h1, $h_title, $h_url, $h_description, $h_content,$h_source, $h_done); } } + //给节点分组 + public function allot_group($sitecode){ + $this->HT = $this->load->database('INFO', TRUE); + $sql=' select top 10 hg.*,isnull((select top 1 hg2.g_is_id from html_group hg2 where hg2.g_id=hg.g_panrent_id),0) as panrent_is_id from html_group hg where hg.g_done=0 and hg.g_sitecode=? order by hg.g_id asc '; + $query=$this->HT->query($sql,$sitecode); + if(empty($query->result())){ + echo '处理完毕'; + return; + } + + foreach ($query->result() as $item) { + //是根节点 + if($item->g_panrent_id==0){ + $this->HT->query('update Tourmanager.dbo.infoStructures set is_parent_id=-99 ,is_path= cast(is_id as varchar(max))+\',\',is_level=0,is_sort=0 where is_id=?',$item->g_is_id); + }else{ + //修改分类结构 + $panrent_is=$this->InfoStructures_model->Detail($item->panrent_is_id); + $is_parent_id=$panrent_is->is_id; + $is_path=$panrent_is->is_path.$item->g_is_id.','; + $is_id=$item->g_is_id; + $this->HT->query('update Tourmanager.dbo.infoStructures set is_parent_id=? ,is_path= ?,is_level=1 where is_id=?',array($is_parent_id,$is_path,$is_id)); + + $url_arr=explode(',',$item->g_url); + print_r($url_arr); + foreach($url_arr as $item_url){ + $query_like=$this->HT->query('select ic_id,ic_title,ic_url,is_id,is_parent_id,is_path,is_level from Tourmanager.dbo.infoContents inner join Tourmanager.dbo.infoStructures on is_ic_id=ic_id and ic_sitecode=is_sitecode +where ic_sitecode=? and ic_url like \'%'.trim($item_url).'%\' order by ic_id asc',$sitecode); + if(!empty($query_like->result())){ + foreach($query_like->result() as $item_child){ + $child_is_id=$item_child->is_id; + $child_is_parent_id=$is_id; + $child_is_path=$is_path.$child_is_id.','; + $this->HT->query('update Tourmanager.dbo.infoStructures set is_parent_id=? ,is_path= ?,is_level=2 where is_id=?',array($child_is_parent_id,$child_is_path,$child_is_id)); + } + } + } + } + print_r($this->HT->queries); + $this->HT->query('update html_group set g_done=1 where g_id=?',$item->g_id); + } + } + public function clear_site() { $this->Import_model->import_clear_site(); diff --git a/application/controllers/information.php b/application/controllers/information.php index e8d33a75..b852ef0d 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -137,6 +137,34 @@ class Information extends CI_Controller return true; } } + + //移动优先的编辑 + public function edit_mobile($is_id){ + //查询结构信息 + $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['information'] = $this->Information_model->Detail($is_id); + + $this->load->view('bootstrap3/header', $data); + $this->load->view('mobile_first/editor'); + $this->load->view('bootstrap3/footer'); + + } public function edit($is_id) { @@ -298,6 +326,14 @@ 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)){ + $data['mobile_first_template']=$this->load->view($mobile_first_template_path, '', TRUE); + }else{ + $data['mobile_first_template']='没有找到移动模板'; + } + $this->load->view('bootstrap3/header', $data); $this->load->view('bootstrap3/information_edit'); $this->load->view('bootstrap3/footer'); diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php index e782bc19..fe237c5c 100644 --- a/application/controllers/welcome.php +++ b/application/controllers/welcome.php @@ -18,12 +18,25 @@ class Welcome extends CI_Controller { } public function index() { - + $data=array(); $data['countryList'] = $this->Area_model->get_country_list(); $data['provinceList'] = $this->Area_model->get_province_list(); $data['city_list'] = $this->Area_model->get_municipalities_list(); $data['lastEditList'] = $this->Information_model->get_last_edit_list(); $data['last_city_list'] = $this->Area_model->get_last_edit_city(); + + $data['groupList']=$this->Information_model->group_list(); + + if($this->config->item('site_code')=='ch' || $this->config->item('site_code')=='ah' ){ + + $this->load->view('bootstrap3/header', $data); + $this->load->view('bootstrap3/welcome'); + $this->load->view('bootstrap3/footer'); + return; + } + + + if ($this->config->item('site_code') == 'pgr') { $data['countryList'] = $this->Area_model->get_country_list_for_site("'589','645','632','517','31','28','609','630','9','708','709'"); @@ -33,6 +46,9 @@ class Welcome extends CI_Controller { $this->load->view('bootstrap/welcome'); $this->load->view('bootstrap/footer'); } + + + public function search($isrecommend = false) { //先搜索url,如果找到唯一就跳走,多于一条的则列出来,一条没有的就去搜索信息 diff --git a/application/models/import_model.php b/application/models/import_model.php index b7888ea5..47f4d051 100644 --- a/application/models/import_model.php +++ b/application/models/import_model.php @@ -10,15 +10,16 @@ class Import_model extends CI_Model } function not_done_html_info($h_sitecode){ - $sql="select top 1000 * from html_infos where h_sitecode=? and h_done=2 order by h_id desc"; + $sql="select top 500 * from html_infos where h_sitecode=? and h_done=0 order by h_id desc"; $query=$this->HT->query($sql,$h_sitecode); return $query->result(); } - function update_html_info($h_id,$h_h1,$h_title,$h_url,$h_description,$h_content,$h_done){ - $sql=' update html_infos set h_done=? ,h_url=N?, h_description=N? ,h_h1=N? ,h_title=N?,h_content=N? where h_id=? '; - return $this->HT->query($sql,array($h_done,$h_url,$h_description,$h_h1,$h_title,$h_content,$h_id)); + function update_html_info($h_id,$h_h1,$h_title,$h_url,$h_description,$h_content,$h_source,$h_done){ + $sql=' update html_infos set h_done=? ,h_url=N?, h_description=N? ,h_h1=N? ,h_title=N?,h_content=N? ,h_source=N? where h_id=? '; + return $this->HT->query($sql,array($h_done,$h_url,$h_description,$h_h1,$h_title,$h_content,$h_source,$h_id)); } + function import_clear() { diff --git a/application/models/information_model.php b/application/models/information_model.php index 8a2cb0f6..e598093f 100644 --- a/application/models/information_model.php +++ b/application/models/information_model.php @@ -199,7 +199,7 @@ class Information_model extends CI_Model { $this->orderBy ? $sql.=$this->orderBy : false; $query = $this->HT->query($sql, array($site_code ? $site_code : $this->config->item('site_code'))); - //print_r($this->HT->queries);die(); + //print_r($this->HT->queries); if ($this->topNum === 1) { if ($query->num_rows() > 0) { $row = $query->row(); @@ -416,6 +416,14 @@ class Information_model extends CI_Model { return $query->row(); } + + //获取分组列表 + function group_list(){ + $this->init(); + $this->search =' AND is_level<=1 '; + $this->orderBy = ' ORDER BY is1.is_level ASC, is1.is_sort ASC,is1.is_path ASC '; + return $this->GetList(); + } } diff --git a/application/views/bootstrap3/information_edit.php b/application/views/bootstrap3/information_edit.php index affbd89a..c7c95b49 100644 --- a/application/views/bootstrap3/information_edit.php +++ b/application/views/bootstrap3/information_edit.php @@ -1,4 +1,4 @@ - +
-