subtitle as title,seo,seokey,seodesc' . ",IF(LENGTH(logo)>0,IF(LOCATE('http', logo)=1,logo,CONCAT('" . $this->img_serve . "',logo)),logo) as logo")->where('id', $id)->where('ispass', 1)->first(); if (!$ztinfo) { Header("HTTP/1.1 404 Not Found"); exit; } $total = NewKeyword::query()->from('new_keyword as nk')->selectRaw('n.id')->leftjoin('news as n','nk.new_id','n.id')->where('nk.keyword_id',$id)->where('n.status',1)->count(); $pageNums = ceil($total / $limit); $newinfo = NewKeyword::query()->from('new_keyword as nk')->selectRaw('n.id,n.title,n.updated_at as showtime,n.description' . ",IF(LENGTH(n.logo)>0,IF(LOCATE('http', n.logo)=1,n.logo,CONCAT('" . $this->img_serve . "',n.logo)),n.logo) as logo")->leftjoin('news as n', 'nk.new_id', 'n.id')->where('nk.keyword_id', $id)->where('n.status', 1)->latest('n.updated_at')->offset($offset)->limit($limit)->get()->toArray(); if ($currpage > $pageNums && $total > 0) { header("Location: /wzkey/".$id); exit; } if ($this->template['template'] == '.') { $pageobj = new ListPage($total,$currpage,$limit,"/wzkey/".$id."/index-",""); $pagehtml = $pageobj->fpage(4,5,6); } else { $pageobj = new ListMpage($total,$currpage,$limit,"/wzkey/".$id."/index-",""); $pagehtml = $pageobj->fpage(4,6); } return view("home{$this->template['template']}show_topic_detail", ['slist' => $this->slist, 'ztinfo' => $ztinfo, 'data' => $newinfo,'pagehtml'=>$pagehtml]); } /** * @title 游戏合集 + 软件合集 * @param $p * @param $type * @param Request $request * @return \Illuminate\Contracts\View\Factory|\Illuminate\Foundation\Application|\Illuminate\View\View|void */ public function tagindex($p=0,$type,Request $request){ $p = str_replace('.htm', '', $p); $p = str_replace('index-', '', $p); $page = $p; if ($page <= 0) { $currpage = 1; }else{ $currpage = (int)$page; } $limit = 20; $offset = ($currpage - 1) * $limit; $this->Keyword=new Keyword(); if($type ==1){ $total = DB::table('keywords')->where('ispass',1)->where('type',1)->count(); $pageNums = ceil($total / $limit); $ztinfo = $this->Keyword->selectRaw('subtitle as keyword,id,updated_at as showtime,description'.",IF(LENGTH(logo)>0,IF(LOCATE('http', logo)=1,logo,CONCAT('".$this->img_serve."',logo)),logo) as logo")->orderby('updated_at','desc')->where('ispass',1)->where('type',1)->offset($offset)->limit($limit)->get()->toArray(); }elseif($type ==3){ $total = DB::table('keywords')->where('ispass',1)->where('type',3)->count(); $pageNums = ceil($total / $limit); $ztinfo = $this->Keyword->selectRaw('subtitle as keyword,id,updated_at as showtime,description'.",IF(LENGTH(logo)>0,IF(LOCATE('http', logo)=1,logo,CONCAT('".$this->img_serve."',logo)),logo) as logo")->orderby('updated_at','desc')->where('ispass',1)->where('type',3)->offset($offset)->limit($limit)->get()->toArray(); }else{ $ztinfo=$this->Keyword->selectRaw('keyword,id'.",IF(LENGTH(logo)>0,IF(LOCATE('http', logo)=1,logo,CONCAT('".$this->img_serve."',logo)),logo) as logo")->orderby('id','desc')->where('ispass',1)->where('type',2)->paginate(36); } if ($currpage > $pageNums && $total > 0) { header("Location: /key"); exit; } if ($type == 1) { if ($this->template['template'] == '.') { $pageobj = new ListPage($total,$currpage,$limit,"/key/index-",""); $pagehtml = $pageobj->fpage(4,5,6); } else { $pageobj = new ListMpage($total,$currpage,$limit,"/key/index-",""); $pagehtml = $pageobj->fpage(4,6); } } elseif ($type == 3) { if ($this->template['template'] == '.') { $pageobj = new ListPage($total,$currpage,$limit,"/key/soft/index-",""); $pagehtml = $pageobj->fpage(4,5,6); } else { $pageobj = new ListMpage($total,$currpage,$limit,"/key/soft/index-",""); $pagehtml = $pageobj->fpage(4,6); } } return view("home{$this->template['template']}list_ztindex",['slist'=>$this->slist,'list'=>$ztinfo,'type'=>$type,'pagehtml'=>$pagehtml]); } /** * @title 文章合集 * @param $p * @return \Illuminate\Contracts\View\Factory|\Illuminate\Foundation\Application|\Illuminate\View\View|void */ public function topicindex($p=0){ $p = str_replace('.htm', '', $p); $p = str_replace('index-', '', $p); $page = $p; if ($page <= 0) { $currpage = 1; }else{ $currpage = (int)$page; } $limit = 20; $offset = ($currpage - 1) * $limit; $total = DB::table('wzkeywords')->where('ispass',1)->count(); $pageNums = ceil($total / $limit); $ztinfo = Wzkeyword::query()->selectRaw('subtitle as keyword,id,updated_at as showtime,description'.",IF(LENGTH(logo)>0,IF(LOCATE('http', logo)=1,logo,CONCAT('".$this->img_serve."',logo)),logo) as logo")->orderby('updated_at','desc')->where('ispass',1)->offset($offset)->limit($limit)->get()->toArray(); if ($currpage > $pageNums && $total > 0) { header("Location: /key"); exit; } if ($this->template['template'] == '.') { $pageobj = new ListPage($total,$currpage,$limit,"/article/topic/index-",""); $pagehtml = $pageobj->fpage(4,5,6); } else { $pageobj = new ListMpage($total,$currpage,$limit,"/article/topic/index-",""); $pagehtml = $pageobj->fpage(4,6); } return view("home{$this->template['template']}show_topic_index",['slist'=>$this->slist,'list'=>$ztinfo,'pagehtml'=>$pagehtml]); } //专题排行 public function ztph($p=0,Request $request){ $this->SpecialGame=new SpecialGame(); $this->Special=new Special(); $request->merge(['page' => $p]); $ztinfo=$this->Special->from('special as a')->selectRaw('a.*,a.title as gamename,a.ztpath as gameid,a.created_at as showtime'.",IF(LOCATE('http', a.logo)=1,a.logo,CONCAT('".$this->img_serve."',a.logo)) as logo")->where('title','like','%排行%')->orderby('a.id','desc')->paginate(20); $rs=$ztinfo->toArray(); $data=array(); foreach($rs['data'] as $key=>$val){ $data[$key]=$val; $data[$key]['count']=$this->SpecialGame->where('special_id',$val['id'])->count(); } if($p ==0){ $pagehtml=preg_replace('/\?page=(\d+)/','/index_\1.html',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/\?page=(\d+)/','/index_\1.html',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/\?page=(\d+)/','/index_\1.html',$ztinfo->nextPageUrl()); }else{ $pagehtml=preg_replace('/index_\d+.html\?page=(\d+)/','index_\1.html',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/index_.*\?page=(\d+)/','index_\1.html',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/index_.*\?page=(\d+)/','index_\1.html',$ztinfo->nextPageUrl()); } return view("home{$this->template['template']}taglistph",['slist'=>$this->slist,'list'=>$ztinfo,'data'=>$data,'pagehtml'=>$pagehtml,'prenextpagehtml'=>$prenextpagehtml]); } //专题详情 public function ztgame($id){ $this->SpecialGame=new SpecialGame(); $this->Special=new Special(); if(preg_match('/^[0-9]+$/',$id)){ $ztinfo=$this->Special->from('special as a')->selectRaw('a.id, a.title, a.logo, a.description, a.type, a.`status`, a.add_user, a.edit_user, a.created_at, a.updated_at, a.tui, a.orderby, a.ztpath, a.catid, a.ztpagekey, a.onclick,a.seokey,a.title as gamename,a.ztpath as gameid,a.created_at as showtime'.",IF(LOCATE('http', a.logo)=1,a.logo,CONCAT('".$this->img_serve."',a.logo)) as logo")->where('a.id',$id)->first(); }else{ $ztinfo=$this->Special->from('special as a')->selectRaw('a.id, a.title, a.logo, a.description, a.type, a.`status`, a.add_user, a.edit_user, a.created_at, a.updated_at, a.tui, a.orderby, a.ztpath, a.catid, a.ztpagekey, a.onclick,a.seokey,a.title as gamename,a.ztpath as gameid,a.created_at as showtime'.",IF(LOCATE('http', a.logo)=1,a.logo,CONCAT('".$this->img_serve."',a.logo)) as logo")->where('a.ztpath',$id)->first(); } if(!$ztinfo){ Header("HTTP/1.1 404 Not Found"); exit; } $gameinfo=$this->SpecialGame->from('special_game as a')->selectRaw('b.*,b.title as gamename,b.id as gameid,b.created_at as showtime,e.name as catename,e.classpath'.",IF(LOCATE('http', b.logo)=1,b.logo,CONCAT('".$this->img_serve."',b.logo)) as logo")->leftjoin('games as b','a.game_id','b.id')->leftjoin('category as e','b.catid','e.id')->where('b.title','<>','')->where('a.special_id',$ztinfo['id'])->where('b.status',1)->paginate(20); //var_dump($gameinfo);exit; if(!$gameinfo){ //echo 1111;exit; } return view("home{$this->template['template']}tags",['slist'=>$this->slist,'ztinfo'=>$ztinfo,'list'=>$gameinfo]); } public function isMobile() { // 如果有HTTP_X_WAP_PROFILE则一定是移动设备 if (isset ($_SERVER['HTTP_X_WAP_PROFILE'])) { return TRUE; } // 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息 if (isset ($_SERVER['HTTP_VIA'])) { return stristr($_SERVER['HTTP_VIA'], "wap") ? TRUE : FALSE;// 找不到为flase,否则为TRUE } // 判断手机发送的客户端标志,兼容性有待提高 if (isset ($_SERVER['HTTP_USER_AGENT'])) { $clientkeywords = array( 'mobile', 'nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu', 'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini', 'operamobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap' ); // 从HTTP_USER_AGENT中查找手机浏览器的关键字 if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) { return TRUE; } } if (isset ($_SERVER['HTTP_ACCEPT'])) { // 协议法,因为有可能不准确,放到最后判断 // 如果只支持wml并且不支持html那一定是移动设备 // 如果支持wml和html但是wml在html之前则是移动设备 if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== FALSE) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === FALSE || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) { return TRUE; } } return FALSE; } //m 教程 public function mobjs($id, $p = 0, Request $request) { try { $p = str_replace('.htm', '', $p); $id = 0; if ($p > 200) { header("Location: /new-1"); exit; } if($this->template['template']=='.'){ $mlist = array(); $game = new game(); $query = $game->from('news as a')->selectRaw('a.filename,a.title,a.updated_at as time,a.newsurl,e.name as catname,a.logo,a.murl') ->leftjoin('category as e', 'a.catid', 'e.id')->where('a.status', 1)->where('a.islist', 1); $request->merge(['page' => $p]); $mlist = $query->orderBy('a.updated_at', 'desc')->paginate(30); $data = $mlist->toArray(); $this->Category = new Category(); if ($p == 0) { $pagehtml = preg_replace('/\?page=(\d+)/', '-\1/', $mlist->links()); $prenextpagehtml['previoupage'] = preg_replace('/\?page=(\d+)/', '/index_\1.html', $mlist->previousPageUrl()); $prenextpagehtml['nextpage'] = preg_replace('/\?page=(\d+)/', '/index_\1.html', $mlist->nextPageUrl()); } else { $pagehtml = preg_replace('/\d\?page=(\d+)/', '\1/', $mlist->links()); $prenextpagehtml['previoupage'] = preg_replace('/index_.*\?page=(\d+)/', 'index_\1.html', $mlist->previousPageUrl()); $prenextpagehtml['nextpage'] = preg_replace('/index_.*\?page=(\d+)/', 'index_\1.html', $mlist->nextPageUrl()); } return view("home{$this->template['template']}jc", ['slist' => $this->slist, 'data' => $data, 'pagehtml' => $pagehtml, 'prenextpagehtml' => $prenextpagehtml, 'catid' => $id]); }else{ $page = $p; if ($page <= 0) { $currpage = 1; }else{ $currpage = (int)$page; } $limit = 15 ; $offset = ($currpage - 1) * $limit; $total = DB::table('news')->where('status', 1)->count(); $pageNums = ceil($total / $limit); $data = News::query()->from('news as n')->selectRaw('n.filename,n.title,n.updated_at as time,n.newsurl,c.name as catname,n.logo,n.murl') ->leftjoin('category as c', 'n.catid', 'c.id')->where('n.status', 1)->where('n.islist', 1)->orderByDesc('n.updated_at')->offset($offset)->limit($limit)->get(); if ($currpage > $pageNums && $total > 0) { header("Location: /new-1/"); exit; } $pageobj = new ListMobPage($total,$currpage,$limit,"/new-",""); $pagehtml = $pageobj->fpage(4,6); return view("home{$this->template['template']}jc", ['slist' => $this->slist, 'data' => $data, 'catid' => $id, 'pagehtml' => $pagehtml]); } } catch (\Exception $exce) { if (strripos($exce->getMessage(),'Syntax error or access violation') !== false) { Header("HTTP/1.1 404 Not Found"); exit; } } } // game列表 public function gameList($catid,$p=0,Request $request){ $p=str_replace('.html','',$p); $this->News=new News(); $request->merge(['page' => $p]); if($catid ==16){ $ztinfo=$this->News->from('games as a') ->selectRaw('a.id, a.catid, a.title, a.keywords,a.updated_at as time,a.logo,a.gameurl,b.name as catname,a.filename,a.filesize '.",IF(LOCATE('http', a.logo)=1,a.logo,CONCAT('".'https://www.111cn.net'."',a.logo)) as logo")->whereIn('a.catid',array(16,27)) ->leftjoin('category as b','a.catid','b.id') ->where('a.status',1) ->where('a.islist',1) ->where('a.gameurl','game') ->orderBy('a.updated_at','desc')->paginate(40); }elseif($catid ==83){ $ztinfo=$this->News->from('games as a') ->selectRaw('a.id, a.catid, a.title, a.keywords,a.updated_at as time,a.logo,a.gameurl,b.name as catname,a.filename,a.filesize '.",IF(LOCATE('http', a.logo)=1,a.logo,CONCAT('".'https://www.111cn.net'."',a.logo)) as logo")->whereIn('a.catid',array(84,85,86,87,88,89,90,91,92,93,94,95,96,97)) ->leftjoin('category as b','a.catid','b.id') ->where('a.status',1) ->where('a.islist',1) ->where('a.gameurl','game') ->orderBy('a.updated_at','desc')->paginate(40); }else{ $ztinfo=$this->News->from('games as a') ->selectRaw('a.id, a.catid, a.title, a.keywords,a.updated_at as time,a.logo,gameurl,b.name as catname,a.filename,a.filesize '.",IF(LOCATE('http', a.logo)=1,a.logo,CONCAT('".'https://www.111cn.net'."',a.logo)) as logo") ->leftjoin('category as b','a.catid','b.id') ->where('a.catid',$catid) ->where('a.gameurl','game') ->where('a.islist',1) ->where('a.status',1)->orderBy('a.updated_at','desc')->paginate(40); } $rs=$ztinfo->toArray(); $this->Game=new Game; $pagehtml=$ztinfo->links(); //dd($rs);exit; if($p ==0){ $pagehtml=preg_replace('/\?page=(\d+)/','/game\1.html',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/\?page=(\d+)/','/game\1.html',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/\?page=(\d+)/','/game\1.html',$ztinfo->nextPageUrl()); }else{ $pagehtml=preg_replace('/\d+.html\?page=(\d+)/','\1.html',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/\.*\?page=(\d+)/','\1.html',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/\.*\?page=(\d+)/','\1.html',$ztinfo->nextPageUrl()); } $line=$this->News->from('category as a')->selectRaw('a.id, a.name,a.seo,a.seokey,a.seodesc')->where('a.id',$catid)->get()->toArray(); $line=$line[0]; $sort='game'; return view("home{$this->template['template']}gamelist",['slist'=>$this->slist,'list'=>$rs,'pagehtml'=>$pagehtml,'sort'=>$sort,'line'=>$line,'catid'=>$catid,'prenextpagehtml'=>$prenextpagehtml]); } public function newList($catid,$p=0,Request $request){ $this->News=new News(); $p=str_replace('.html','',$p); $request->merge(['page' => $p]); if($catid ==15){ $ztinfo=$this->News->from('news as a') ->selectRaw('a.id, a.catid, a.title, a.keywords,a.updated_at as time,a.logo,a.description,a.newsurl,e.name as catname,a.filename '.", IF(LENGTH(logo)>0,IF(LOCATE('http', logo)=1,logo,CONCAT('".'https://www.111cn.net'."',logo)),logo) as logo") ->leftjoin('category as e','a.catid','e.id') ->whereIn('a.catid',array(9,20,21,22,23,75,76,78,79)) ->where('a.islist',1) ->where('a.status',1)->orderBy('a.updated_at','desc')->paginate(40); }else{ $ztinfo=$this->News->from('news as a') ->selectRaw('a.id, a.catid, a.title, a.keywords,a.updated_at as time,a.logo,a.description,a.newsurl,e.name as catname,a.filename '.", IF(LENGTH(logo)>0,IF(LOCATE('http', logo)=1,logo,CONCAT('".'https://www.111cn.net'."',logo)),logo) as logo") ->leftjoin('category as e','a.catid','e.id') ->where('a.catid',$catid) ->where('a.islist',1) ->where('a.status',1)->orderBy('a.updated_at','desc')->paginate(40); } $rs=$ztinfo->toArray(); if($p ==0){ $pagehtml=preg_replace('/\?page=(\d+)/','/game\1.html',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/\?page=(\d+)/','/game\1.html',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/\?page=(\d+)/','/game\1.html',$ztinfo->nextPageUrl()); }else{ $pagehtml=preg_replace('/\d+.html\?page=(\d+)/','\1.html',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/\.*\?page=(\d+)/','\1.html',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/\.*\?page=(\d+)/','\1.html',$ztinfo->nextPageUrl()); } $line=$this->News->from('category as a')->selectRaw('a.id, a.name,a.seo,a.seokey,a.seodesc')->where('a.id',$catid)->get()->toArray(); $line=$line[0]; $sort='news'; return view("home{$this->template['template']}newlist",['slist'=>$this->slist,'list'=>$rs,'pagehtml'=>$pagehtml,'sort'=>$sort,'line'=>$line,'catid'=>$catid]); } public function golueList($catid,$p=0,Request $request){ $this->News=new News(); $p=str_replace('.html','',$p); $request->merge(['page' => $p]); if($catid ==67){ $ztinfo=$this->News->from('news as a') ->selectRaw('a.id, a.catid, a.title, a.keywords,a.updated_at as time,a.logo,a.description,a.newsurl,e.name as catname,a.filename '.", IF(LENGTH(logo)>0,IF(LOCATE('http', logo)=1,logo,CONCAT('".'https://www.111cn.net'."',logo)),logo) as logo") ->leftjoin('category as e','a.catid','e.id') ->whereIn('a.catid',array(67,68,69,70,71,74,81)) ->where('a.islist',1) ->where('a.status',1)->orderBy('a.updated_at','desc')->paginate(40); }else{ $ztinfo=$this->News->from('news as a') ->selectRaw('a.id, a.catid, a.title, a.keywords,a.updated_at as time,a.logo,a.description,a.newsurl,e.name as catname,a.filename '.", IF(LENGTH(logo)>0,IF(LOCATE('http', logo)=1,logo,CONCAT('".'https://www.111cn.net'."',logo)),logo) as logo") ->leftjoin('category as e','a.catid','e.id')->where('a.catid',$catid) ->where('a.islist',1) ->where('a.status',1)->orderBy('a.updated_at','desc')->paginate(40); } $rs=$ztinfo->toArray(); if($p ==0){ $pagehtml=preg_replace('/\?page=(\d+)/','/game\1.html',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/\?page=(\d+)/','/game\1.html',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/\?page=(\d+)/','/game\1.html',$ztinfo->nextPageUrl()); }else{ $pagehtml=preg_replace('/\d+.html\?page=(\d+)/','\1.html',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/\.*\?page=(\d+)/','\1.html',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/\.*\?page=(\d+)/','\1.html',$ztinfo->nextPageUrl()); } $line=$this->News->from('category as a')->selectRaw('a.id, a.name,a.seo,a.seokey,a.seodesc')->where('a.id',$catid)->get()->toArray(); $line=$line[0]; $sort='news'; return view("home{$this->template['template']}newlist",['slist'=>$this->slist,'list'=>$rs,'pagehtml'=>$pagehtml,'sort'=>$sort,'line'=>$line,'catid'=>$catid]); } //类似文章标签 (以主表 ‘keyword’字段查找包含这个字段的文章) public function huatindex($p=0,Request $request){ $this->News=new News(); $ztinfo=$this->News->from('newslink as a') ->selectRaw('a.id,a.title, a.keywords,a.createtime as time,a.description') // ->leftjoin('news as d','d.keywords','a.title') ->where('a.status',1)->orderBy('a.createtime','d esc')->paginate(8); $rs=$ztinfo->toArray(); // dd($rs);exit; $request->merge(['page' => $p]); if($p ==0){ $pagehtml=preg_replace('/\?page=(\d+)/','/list-\1',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/\?page=(\d+)/','/list-\1',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/\?page=(\d+)/','/list-\1',$ztinfo->nextPageUrl()); }else{ $pagehtml=preg_replace('/list-\d+\?page=(\d+)/','list-\1',$ztinfo->links()); $prenextpagehtml['previoupage']=preg_replace('/list-.*\?page=(\d+)/','list-\1',$ztinfo->previousPageUrl()); $prenextpagehtml['nextpage']=preg_replace('/list-.*\?page=(\d+)/','list-\1',$ztinfo->nextPageUrl()); } return view("home{$this->template['template']}huatindex",['slist'=>$this->slist,'list'=>$rs,'pagehtml'=>$pagehtml]); } public function mobwz($filename){ // $isMobile = $this->isMobile(); // if ($isMobile){ $filename=str_replace('.htm','',$filename); // dd($filename);exit; $this->News=new News(); $this->game=new Game(); $data=$this->News->from('news as a') ->selectRaw('a.id, a.catid, a.title, a.keywords, a.description, a.game_id, a.logo, a.status, a.content, a.add_user, a.edit_user, a.created_at, a.updated_at, a.addtime, a.seo, a.seokey, a.seodesc, a.sourceurl, a.maketableid, a.dtitle, a.is_bot, a.newsurl, a.first_user,e.name as catename,e.classpath,a.updated_at as newtime,d.dy,a.filename,a.murl'.",IF(LOCATE('http', a.logo)=1,a.logo,CONCAT('".$this->img_serve."',a.logo)) as logo") ->leftjoin('category as e','a.catid','e.id')->leftjoin('news_ext as d','a.id','d.newid')->where('a.status',1)->where('a.murl',$filename)->first(); $data = empty($data) ? array() : $data->toArray(); // dd($data);exit; if(!$data){ Header("HTTP/1.1 404 Not Found"); exit; } //添加代码------------------------------------------ $addto =$data['catid']; $obtainid =$data['id'];//获取文章id $enquiry=DB::table('news_count')->where('countid',$obtainid)->first(); $add=DB::table('news_ext')->where('newid',$obtainid)->value('dy'); if($add==0){ if($addto==145 ||$addto==504||$addto==506||$addto==507){ if($enquiry){ $enquiryaa=DB::table('news_count')->where('countid',$obtainid)->increment('count',1); if($enquiry and $enquiry->count ==100){ if($add){ $add=DB::table('news_ext')->insert(['newid'=>$obtainid,'dy'=>1]); } } }else{ $enquiryaa=DB::table('news_count')->Insert(['countid'=>$obtainid,'count'=>1]); } } } //结束代码---------------------------------------- if($data){ $kw=explode(',',$data['keywords']); $gklist=array(); $Klist=DB::table('keywords')->WhereIn('keyword',$kw)->get()->toArray(); foreach($Klist as $key=>$val){ $rs=DB::table('game_keyword')->Where('keyword_id',$val->id)->get()->toArray(); $gklist=array_unique(array_merge($gklist,array_column(list2array($rs),'game_id'))); } } $xq=date("w"); $glist=$kdata=$gameinfo=$tableinfo=array(); if($data['game_id']){ array_push($gklist,$data['game_id']); if(count($gklist) > 1){ $glist_obj=$this->game->from('games as a')->selectRaw('a.*,a.title as gamename,a.id as gameid,a.created_at as showtime,e.name as catename,e.classpath')->leftjoin('category as e','a.catid','e.id')->where('a.status',1)->whereIn('a.id',$gklist)->limit(10)->get()->toArray(); $glist=list2array($glist_obj); // if(count($gklist) >= 7){ // $gameinfo=$glist[$xq]; // }else{ // $rdnum=rand(0,count($gklist)-1); // if(count($gklist) == 1){ // $gameinfo=$glist[0]; // }else{ // $gameinfo=$glist[$rdnum]; // } // } $gameinfo=$this->game->from('games as a')->selectRaw('a.*,a.title as gamename,a.id as gameid,a.created_at as showtime,e.name as catename,e.classpath')->leftjoin('category as e','a.catid','e.id')->where('a.id',$data['game_id'])->where('a.status',1)->first(); $kdata = $this->game->from('games as a')->selectRaw('c.*')->leftjoin('game_keyword as b','a.id','b.game_id')->leftjoin('keywords as c','b.keyword_id','c.id')->where('a.id',$gameinfo['id'])->where('b.game_id','<>','')->where('a.status',1)->get()->toArray(); }else{ $gameinfo=$this->game->from('games as a')->selectRaw('a.*,a.title as gamename,a.id as gameid,a.created_at as showtime,e.name as catename,e.classpath')->leftjoin('category as e','a.catid','e.id')->where('a.id',$data['game_id'])->where('a.status',1)->first(); $kdata = $this->game->from('games as a')->selectRaw('c.*')->leftjoin('game_keyword as b','a.id','b.game_id')->leftjoin('keywords as c','b.keyword_id','c.id')->where('a.id',$gameinfo['id'])->where('b.game_id','<>','')->get()->where('a.status',1)->toArray(); } } if($data['maketableid']){ $tableinfo=DB::table('maketable')->where('id',$data['maketableid'])->first(); } $this->QueryList=new QueryList(); $img_arr=array(); //内容图片更换域名 $imgdata =$this->QueryList->html($data['content'])->find('img')->attrs('src'); foreach($imgdata as $imgk=>$imgv){ //$str_img=preg_replace('/^\/\//','https://',$v); $imgv= preg_replace('/\?.*/', '', $imgv); if(preg_match('/^http/',$imgv)){ }else{ if(empty($img_arr[$imgv])){ $img_arr[$imgv]=1; }else{ continue; } $data['content']=str_replace($imgv,'https://img.111cn.net'.$imgv,$data['content']); } } $config = \HTMLPurifier_Config::createDefault(); $config->set('HTML.AllowedComments', ['adv.']); // 或者使用正则表达式匹配所有以 adv. 开头的注释 $config->set('HTML.AllowedCommentsRegexp', '/^adv\./'); $purifier = new \HTMLPurifier($config); $data['content'] = $purifier->purify($data['content']); // dd($data);exit; return view("home{$this->template['template']}show_news",['slist'=>$this->slist,'list'=>$data,'gameinfo'=>$gameinfo,'tableinfo'=>$tableinfo,'klist'=>$kdata,'glist'=>$glist]); // }else{ // Header("HTTP/1.1 404 Not Found"); // exit; // } } //文章落地页 public function article($filename){ // echo 111;exit; $filename=str_replace('.htm','',$filename); // dd($filename);exit; $this->News=new News(); $this->game=new Game(); $data=$this->News->from('news as a') ->selectRaw('a.id, a.catid, a.title, a.keywords, a.description, a.game_id, a.logo, a.status, a.content, a.add_user, a.edit_user, a.created_at, a.updated_at, a.addtime, a.seo, a.seokey, a.seodesc, a.sourceurl, a.maketableid, a.dtitle, a.is_bot, a.newsurl, a.first_user,e.name as catename,e.classpath,a.updated_at as newtime,a.filename,a.murl') ->leftjoin('category as e','a.catid','e.id')->where('a.status',1)->where('a.filename',$filename)->first(); $data = empty($data) ? array() : $data->toArray(); // dd($data);exit; if(!$data){ Header("HTTP/1.1 404 Not Found"); exit; } //添加代码------------------------------------------ $addto =$data['catid']; $obtainid =$data['id'];//获取文章id $enquiry=DB::table('news_count')->where('countid',$obtainid)->first(); $add=DB::table('news_ext')->where('newid',$obtainid)->value('dy'); if($add==0){ if($addto==145 ||$addto==504||$addto==506||$addto==507){ if($enquiry){ $enquiryaa=DB::table('news_count')->where('countid',$obtainid)->increment('count',1); if($enquiry and $enquiry->count ==100){ if($add){ $add=DB::table('news_ext')->insert(['newid'=>$obtainid,'dy'=>1]); } } }else{ $enquiryaa=DB::table('news_count')->Insert(['countid'=>$obtainid,

Whoops, looks like something went wrong.