作者 saynone
提交者 Gitee

修复分类管理中可将父id设置为自己的错误

@@ -102,9 +102,9 @@ class Category extends Backend @@ -102,9 +102,9 @@ class Category extends Backend
102 $params = $this->preExcludeFields($params); 102 $params = $this->preExcludeFields($params);
103 103
104 if ($params['pid'] != $row['pid']) { 104 if ($params['pid'] != $row['pid']) {
105 - $childrenIds = Tree::instance()->init(collection(\app\common\model\Category::select())->toArray())->getChildrenIds($row['id']); 105 + $childrenIds = Tree::instance()->init(collection(\app\common\model\Category::select())->toArray())->getChildrenIds($row['id'] true);
106 if (in_array($params['pid'], $childrenIds)) { 106 if (in_array($params['pid'], $childrenIds)) {
107 - $this->error(__('Can not change the parent to child')); 107 + $this->error(__('Can not change the parent to child or itself'));
108 } 108 }
109 } 109 }
110 110
@@ -13,6 +13,6 @@ return [ @@ -13,6 +13,6 @@ return [
13 'Updatetime' => '更新时间', 13 'Updatetime' => '更新时间',
14 'Weigh' => '权重', 14 'Weigh' => '权重',
15 'Category warmtips' => '温馨提示:栏目类型请前往<b>常规管理</b>-><b>系统配置</b>-><b>字典配置</b>中进行管理', 15 'Category warmtips' => '温馨提示:栏目类型请前往<b>常规管理</b>-><b>系统配置</b>-><b>字典配置</b>中进行管理',
16 - 'Can not change the parent to child' => '父组别不能是它的子组别', 16 + 'Can not change the parent to child or itself' => '父组别不能是它的子组别或它自己',
17 'Status' => '状态' 17 'Status' => '状态'
18 ]; 18 ];