完善标签功能

This commit is contained in:
2020-04-12 11:15:24 +08:00
parent 456d63a231
commit 8bc3b1fd9b
4 changed files with 55 additions and 85 deletions

View File

@@ -25,4 +25,18 @@ class Channel extends \think\Model {
$status = [0 => '禁用', 1 => '启用'];
return isset($status[$data['status']]) ? $status[$data['status']] : '禁用';
}
public static function getChannelList($pid, $tree){
$map = [];
$map[] = ['status', '=', 1];
if ($pid !== '') {
$map[] = ['pid', '=', $pid];
}
$list = self::where($map)->order('sort asc, id desc')->column("*");
if ($tree) {
$list = (new \sent\tree\Tree())->listToTree($list);
}
return $list;
}
}