赛亿官网

Base.php 1.5KB

    <?php /** * 控制器公共类(基础类)文件 */ namespace app\index\controller; use think\Controller; use think\Request; use app\admin\model\Category as CategoryModel; /** * 控制器基础类 * * @category index * @package Controller * @author huwhois <huwhois@163.com> */ class Base extends Controller { protected $category_model; protected $meta = [ 'title'=>'', 'description'=>'', 'keywords'=>'' ]; // protected $categories; public function __construct(Request $request = null) { parent::__construct($request); $this->category_model = new CategoryModel(); $categories = obj_tree($this->category_model->field('id, pid, name, url, type')->where('is_del', 0)->cache(false)->order('sort')->select()); $this->assign('categories', $categories); // var_dump($categories); // exit; // // 产品中心 -- 侧边栏 // $aside_product = model('admin/article')->where(['is_del'=>0,'cid'=>2])->field('id, cid, title')->limit(10)->order(['sort' => 'desc', 'id' => 'desc'])->select(); // // 新闻动态 -- 侧边栏 // $aside_news = model('admin/article')->where(['is_del'=>0,'cid'=>3])->field('id, cid, title')->limit(5)->order(['sort' => 'desc', 'id' => 'desc'])->select(); // $this->assign('aside_product', $aside_product); // $this->assign('aside_news', $aside_news); $this->meta['title'] = "赛亿科技"; $this->assign('meta', $this->meta); } }