/** * 菜单列表 * @param integer $pid [description] */ public function index($pid = 0, $title = '') { $map = ['status' => ['egt', 0]]; if ($title) { $map['title'] = array('like', "%{$title}%"); } else { $map['pid'] = $pid; } $list = parent::_list('Menu', $map, 'sort asc,id asc'); $this->assign('list', $list); $tree = Db::name('Menu')->where('status', 'egt', 0)->order('sort asc,id asc')->select(); $this->assign('tree', \tools\Tree::listTree($tree)); return $this->fetch(); }
public function index($title = '', $pid = '') { if ($title) { $map['title'] = ['like', "%{$title}%"]; } if (is_numeric($pid)) { $map['pid'] = $pid; } else { $map['pid'] = 0; } $map['status'] = ['egt', 0]; $list = parent::_list('Category', $map, 'sort asc'); $this->assign('list', $list); $tree = Db::name('Category')->where('status', 'egt', 0)->order('sort asc,id asc')->select(); $this->assign('tree', \tools\Tree::listTree($tree)); return $this->fetch(); }