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

商品规格列表


控制器 app/controller/admin/Skus.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
    ]);
}

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

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

路由 router/admin.php

php
Route::get('skus/:page','admin.Skus/index');