diff --git a/application/admin/controller/Category.php b/application/admin/controller/Category.php index c2d48827734c3775038f500f96b80f4f31749b68..306320fca79417bd6ddd9bc143161011b4737eb4 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 e7dae0e4375c5319ceae7809adc3a2c4e4dfedb9..20922745952ecc454aa7d597385abe489ade8bf5 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' => '温馨提示:栏目类型请前往常规管理->系统配置->字典配置中进行管理', - 'Can not change the parent to child' => '父组别不能是它的子组别', + 'Can not change the parent to child or itself' => '父组别不能是它的子组别或它自己', 'Status' => '状态' ];