123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace app\user\controller;
- use app\common\controller\Userend;
- use app\common\model\Category as CategoryModel;
- use fast\Tree;
- /**
- * 分类管理
- *
- * @icon fa fa-list
- * @remark 用于管理网站的所有分类,分类可进行无限级分类,分类类型请在常规管理->系统配置->字典配置中添加
- */
- class Category extends Userend
- {
- /**
- * @var \app\common\model\Category
- */
- protected $model = null;
- protected $categorylist = [];
- protected $noNeedRight = ['selectpage'];
- public function _initialize()
- {
- parent::_initialize();
- $this->model = model('app\common\model\Category');
- $tree = Tree::instance();
- $tree->init(collection($this->model->order('weigh desc,id desc')->select())->toArray(), 'pid');
- $this->categorylist = $tree->getTreeList($tree->getTreeArray(0), 'name');
- $categorydata = [0 => ['type' => 'all', 'name' => __('None')]];
- foreach ($this->categorylist as $k => $v) {
- $categorydata[$v['id']] = $v;
- }
- $typeList = CategoryModel::getTypeList();
- $this->view->assign("flagList", $this->model->getFlagList());
- $this->view->assign("typeList", $typeList);
- $this->view->assign("parentList", $categorydata);
- $this->assignconfig('typeList', $typeList);
- }
- /**
- * Selectpage搜索
- *
- * @internal
- */
- public function selectpage()
- {
- return parent::selectpage();
- }
- }
|