You've already forked guangan
分类支持pid
This commit is contained in:
@ -8,7 +8,12 @@ use think\admin\Controller;
|
|||||||
class Category extends Controller
|
class Category extends Controller
|
||||||
{
|
{
|
||||||
public function index() {
|
public function index() {
|
||||||
$categories = CmsCategory::mk()->where('status', 1)->order('sort asc,id desc')->field("id, name")->select();
|
$pid = $this->request->get('pid');
|
||||||
|
$query = CmsCategory::mk()->where('status', 1)->order('sort asc,id desc')->field("id, name");
|
||||||
|
if ($pid > 0) {
|
||||||
|
$query->where('pid', $pid);
|
||||||
|
}
|
||||||
|
$categories = $query->select();
|
||||||
$this->success('获取分类成功', $categories);
|
$this->success('获取分类成功', $categories);
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user