Skip to content
关注公众号,获取新课通知

相册分类列表


控制器 app/controller/admin/ImageClass.php

php
public function index()
{
    $param = $this->request->param();
    $limit = intval(getValByKey('limit',$param,10));
    $page = getValByKey('page',$param,1);
    $totalCount = $this->M->count();
    $list = $this->M->page($page,$limit)->order([
        'order'=>'desc',
        'id'=>'desc'
    ])->select();
    return showSuccess([
        'list'=>$list,
        'totalCount'=>$totalCount
    ]);
}

路由 router/admin.php

php
Route::get('imageclass/:page','admin.ImageClass/index');

验证器 app/validate/admin/ImageClass.php

php
protected $rule = [
    'page' => 'require|integer|>:0',
];
protected $scene = [
    ...
    'index'=>['page'],
    ...
];