Elegant.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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();
}
}