Elegant.php 1.1 KB
<?php


namespace app\index\controller;


use app\common\controller\Frontend;
use app\common\model\TemplateView;
use think\Db;

class Elegant extends  Frontend
{
    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = 'default';
    public function _initialize()
    {
        parent::_initialize(); // TODO: Change the autogenerated stub
        $template = TemplateView::getSchoolTemplate( $this->school_id);
        $this->layout = $template->layout ?? 'default';
        $this->template = $template->template_url;
    }

    public function index(){
        $param = $this->request->param();
        $type = isset($param['type']) ? $param['type'] : 1;
        $elegant_list  = Db::name("elegant")->where("school_id", $this->school_id)->where('type',$type)->paginate(10,false,['param'=>request()->param()]);

        $this->assign("list",$elegant_list);
        $this->assign("type",$type);
        return $this->view->fetch();
    }
    public function detail($id =0){
        $info  = Db::name("elegant")->where("elegant_id", $id)->find();
        $this->assign("info",$info);
        return $this->view->fetch();
    }
}