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
| <?php
|
| namespace services;
|
| use think\Exception;
| use think\facade\Config;
| use think\facade\Cache;
| use think\facade\Db;
| use think\facade\Session;
| use think\facade\Cookie;
|
|
| class CategoryService {
| /**
| * 获取分类列表
| * @param string $tableName
| * @param string $order
| * @return array
| */
| public function getList(array $where=[]): array{
| $menulist = Db::name('category')
| ->alias('a')
| ->field("
| a.cate_code as value,a.cate_name as label,a.father_code as pid,
| (case (select count(id) from web_category where father_code = a.cate_code) when 0 then true else false end) as leaf
| ")
| ->where($where)->order("order_id asc")->select()->toArray();
| return $menulist;
| }
| }
|
|