mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-25 04:07:17 +08:00
修复角色routes字段填充问题
This commit is contained in:
parent
2a387958c9
commit
99cfb9bc9b
@ -61,8 +61,11 @@ class Role extends Service
|
||||
|
||||
$data['name'] = $validator->checkName($post['name']);
|
||||
$data['summary'] = $validator->checkSummary($post['summary']);
|
||||
$data['routes'] = $validator->checkRoutes($post['routes']);
|
||||
$data['routes'] = $this->handleRoutes($data['routes']);
|
||||
|
||||
if (isset($post['routes'])) {
|
||||
$data['routes'] = $validator->checkRoutes($post['routes']);
|
||||
$data['routes'] = $this->handleRoutes($data['routes']);
|
||||
}
|
||||
|
||||
$role->update($data);
|
||||
|
||||
@ -114,9 +117,9 @@ class Role extends Service
|
||||
* @param array $routes
|
||||
* @return array
|
||||
*/
|
||||
protected function handleRoutes($routes)
|
||||
protected function handleRoutes(array $routes)
|
||||
{
|
||||
if (empty($routes)) {
|
||||
if (count($routes) == 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,8 @@ class Role extends Model
|
||||
{
|
||||
if (is_array($this->routes) && !empty($this->routes)) {
|
||||
$this->routes = kg_json_encode($this->routes);
|
||||
} else {
|
||||
$this->routes = '';
|
||||
}
|
||||
|
||||
$this->create_time = time();
|
||||
|
Loading…
x
Reference in New Issue
Block a user