mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-25 20:17:23 +08:00
!51 修复创建角色routes字段报错
Merge pull request !51 from koogua/xiaochong0302/I2A19T
This commit is contained in:
commit
0867063d9c
@ -61,8 +61,11 @@ class Role extends Service
|
|||||||
|
|
||||||
$data['name'] = $validator->checkName($post['name']);
|
$data['name'] = $validator->checkName($post['name']);
|
||||||
$data['summary'] = $validator->checkSummary($post['summary']);
|
$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);
|
$role->update($data);
|
||||||
|
|
||||||
@ -114,9 +117,9 @@ class Role extends Service
|
|||||||
* @param array $routes
|
* @param array $routes
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function handleRoutes($routes)
|
protected function handleRoutes(array $routes)
|
||||||
{
|
{
|
||||||
if (empty($routes)) {
|
if (count($routes) == 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +105,8 @@ class Role extends Model
|
|||||||
{
|
{
|
||||||
if (is_array($this->routes) && !empty($this->routes)) {
|
if (is_array($this->routes) && !empty($this->routes)) {
|
||||||
$this->routes = kg_json_encode($this->routes);
|
$this->routes = kg_json_encode($this->routes);
|
||||||
|
} else {
|
||||||
|
$this->routes = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->create_time = time();
|
$this->create_time = time();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user