s->get_type_news(814); $info['cbjr']=$this->get_type_news(815); $info['jcfy']=$this->get_type_news(816); $info['zhxx']=$this->get_type_news(817); $info['csgc']=$this->get_type_news(818); $info['xxcb']=$this->get_type_news(819); $info['dfcj']=$this->get_type_news(820); $info['cjrw']=$this->get_type_news(821); $info['cgpl']=$this->get_type_news(822); $info['cxnw']=$this->get_type_news(823); $info['wxgz']=$this->get_type_news(802); $info['ccdt']=$this->get_type_news(845); $info['title']='综合频道'; $info['keywords']=''; $info['description']=''; return $info; } //新闻内容页 public function article_show(){ $newsid=intval(I('id')); $info['show']=$this->field('id,catid,title,keywords,thumb,description,inputtime')->where(array('status'=>99,'id'=>$newsid))->find(); $u=D('news_data')->field('content,copyfrom')->where(array('id'=>$newsid))->find(); $info['show']['content']=str_replace('[page]','',$u['content']); $str=str_replace('|0','',$u['copyfrom']); $info['show']['copyfrom']=str_replace('|1','国际船舶网',$str); $relation=$this->tags( explode(',',$info['show']['keywords'])); $info['xgyd']=$relation['data']; $info['newsjianzao']=$this->get_channel_jianzao(5); $info['newsyingyun']=$this->get_channel_yingyun(5); $info['newsjiaoyi']=$this->get_channel_jiaoyi(5); $info['newszonghe']=$this->get_channel_zonghe(5); $info['show']['catname']=catname($info['show']['catid']); unset($u); return $info; } /*小程序新闻内容页*/ public function xcx_article_show(){ $newsid=intval(I('id')); $info['show']=$this->field('id,catid,title,keywords,thumb,description,inputtime')->where(array('status'=>99,'id'=>$newsid))->find(); $u=D('news_data')->field('content,copyfrom')->where(array('id'=>$newsid))->find(); $info['show']['content']=str_replace('[page]','',$u['content']); $str=str_replace('|0','',$u['copyfrom']); $info['show']['copyfrom']=str_replace('|1','国际船舶网',$str); $info['xgyd']= $this->xcx_getxgyd($info['show']['catid']); $info['show']['catname']=catname($info['show']['catid']); unset($u); return $info; } /*小程序相关阅读,同栏目下内容*/ private function xcx_getxgyd($catid){ $sql="select * from es_news WHERE `catid`={$catid} AND `status` = 99 ORDER BY `updatetime` DESC limit 10"; $data = $this->query($sql,'select'); return $data; } private function tags($keywords,$limit=5,$page=1){ $keywords=is_array ($keywords)? array_map("strtolower",$keywords):$keywords; $get_tag_list=tpinterface('search_tags',array('data'=>$keywords,'limit'=>$limit=5,'page'=>$page )); $result=json_decode($get_tag_list,true); return $result; } public function search_news(){ $page = intval($_GET['page']); $page = $page <1? 1:$page ; $search_kind=htmlspecialchars(I('search_kind')); $search_keyword=I('search_keyword'); $search_keyword=htmlspecialchars(trim($search_keyword)); $get_tag_list=tpinterface('search_news',array('query'=>strtolower($search_keyword),'limit'=>20,'page'=>$page )); $result=json_decode($get_tag_list,true); import('wpage'); $page=new Wpage($result['total'],true); $info['list']=$result['data']; $info['page']=$page->show(); $info['total']=$result['total']; $info['key']=$search_keyword; return $info; } /*查询文章标题和 url gjq2019-03-26*/ public function get_pinglun_api($catid,$contentid){ $sql = "select `title`,`url` from `es_news` WHERE `catid`={$catid} AND `id`={$contentid}"; $res = $this->query($sql,'select'); $r = $res[0]; $res2 = $sql = "select * from `es_news_data` WHERE `id`={$contentid}"; $data_info = $res2[0]; if ($r) { return array('title'=>$r['title'], 'url'=>$r['url'],'allow_comment'=>(isset($data_info['allow_comment']) ? $data_info['allow_comment'] : 1)); } else { return false; } } }