mirror of https://gitee.com/karson/fastadmin.git
添加主键,修复无法更新fa_auth_rule 问题
parent
c129974c12
commit
732dd19efd
|
|
@ -265,9 +265,24 @@ class Menu extends Command
|
||||||
|
|
||||||
$title = $comment ? $comment : ucfirst($n->name);
|
$title = $comment ? $comment : ucfirst($n->name);
|
||||||
|
|
||||||
$ruleArr[] = array('pid' => $pid, 'name' => $name . "/" . strtolower($n->name), 'icon' => 'fa fa-circle-o', 'title' => $title, 'ismenu' => 0, 'status' => 'normal');
|
//获取主键,作为AuthRule更新依据
|
||||||
|
$id = $this->getAuthRulePK($name . "/" . strtolower($n->name));
|
||||||
|
|
||||||
|
$ruleArr[] = array('id' => $id, 'pid' => $pid, 'name' => $name . "/" . strtolower($n->name), 'icon' => 'fa fa-circle-o', 'title' => $title, 'ismenu' => 0, 'status' => 'normal');
|
||||||
}
|
}
|
||||||
$this->model->saveAll($ruleArr);
|
$this->model->saveAll($ruleArr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取主键
|
||||||
|
protected function getAuthRulePK($name) {
|
||||||
|
if (!empty($name))
|
||||||
|
{
|
||||||
|
$PK = $this->model
|
||||||
|
->where('name', $name)
|
||||||
|
->value('id');
|
||||||
|
|
||||||
|
}
|
||||||
|
return $PK;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue