mirror of https://gitee.com/karson/fastadmin.git
!24 修复1062 Duplicate entry 'addon/index' for key 'name'
Merge pull request !24 from private/masterpull/521484/MERGE
commit
225fcfc61b
|
|
@ -264,10 +264,24 @@ class Menu extends Command
|
|||
$comment = preg_replace(array('/^\/\*\*(.*)[\n\r\t]/u', '/[\s]+\*\//u', '/\*\s@(.*)/u', '/[\s|\*]+/u'), '', $comment);
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
//获取主键
|
||||
protected function getAuthRulePK($name) {
|
||||
if (!empty($name))
|
||||
{
|
||||
return $this->model
|
||||
->where('name', $name)
|
||||
->value('id');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue