<?php
namespace app\index\controller;
use think\facade\View;
use think\facade\Request;
use think\facade\Session;

class Lists extends Base{
	
    public function index(){
		$tdata=Request::param();
		$info=\app\index\model\CateContent::info($tdata['id']);
				
		if($info['is_effect']!=1 or empty($info)){
			return "<div style=\"width:200px; height:200px; text-align:center; position:fixed; left:50%; top:50%; margin:-100px 0 0 -100px; color:#f00\">
			抱歉未找到该栏目!<br /><a href=\"\\\" style=\" color:#66ccff\">返回首页</a></div>";
		}

		$list='';
		$page='';
		if($info['model_id']!=1){
			$list=\app\index\model\Lists::list_page($info['id'],$info['model_id'],$info['catepage']);
			$page = $list->render();
			
			//dump($list);
			
			$list=$list->items();
			foreach($list as $k=>$c){
				if($c['link']!=''){
					$list[$k]['url']=$c['link'];
				}else{
					$list[$k]['url']=info_seo_url($c['pid'],$c['id']);
				}
			}
		}

		if($info['seo_title']==''){
			$info['seo_title']=$info['catename'].'-'.tq_value(1,'seo_title','system');
		}
		
        View::assign(['info'=>$info,'list'=>$list,'page'=>$page]);
		$template ='./template/lists/'.$info['view_list'].'.html';
		return View::fetch($template);

    }


}
