diff --git a/application/admin/controller/Category.php b/application/admin/controller/Category.php index c2d4882..306320f 100644 --- a/application/admin/controller/Category.php +++ b/application/admin/controller/Category.php @@ -102,9 +102,9 @@ class Category extends Backend $params = $this->preExcludeFields($params); if ($params['pid'] != $row['pid']) { - $childrenIds = Tree::instance()->init(collection(\app\common\model\Category::select())->toArray())->getChildrenIds($row['id']); + $childrenIds = Tree::instance()->init(collection(\app\common\model\Category::select())->toArray())->getChildrenIds($row['id'], true); if (in_array($params['pid'], $childrenIds)) { - $this->error(__('Can not change the parent to child')); + $this->error(__('Can not change the parent to child or itself')); } } diff --git a/application/admin/lang/zh-cn/category.php b/application/admin/lang/zh-cn/category.php index e7dae0e..2092274 100644 --- a/application/admin/lang/zh-cn/category.php +++ b/application/admin/lang/zh-cn/category.php @@ -13,6 +13,6 @@ return [ 'Updatetime' => '更新时间', 'Weigh' => '权重', 'Category warmtips' => '温馨提示:栏目类型请前往<b>常规管理</b>-><b>系统配置</b>-><b>字典配置</b>中进行管理', - 'Can not change the parent to child' => '父组别不能是它的子组别', + 'Can not change the parent to child or itself' => '父组别不能是它的子组别或它自己', 'Status' => '状态' ];