1
0
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:
xiaochong0302 2020-12-19 15:38:57 +08:00
parent 2a387958c9
commit 99cfb9bc9b
2 changed files with 9 additions and 4 deletions

View File

@ -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 [];
}

View File

@ -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();