save
This commit is contained in:
parent
e9a06cdf67
commit
db97119704
@ -2,6 +2,7 @@
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use plugin\admin\app\common\Auth;
|
||||
use plugin\admin\app\common\Util;
|
||||
use plugin\admin\app\model\Admin;
|
||||
use support\exception\BusinessException;
|
||||
@ -107,14 +108,13 @@ class AccountController extends Crud
|
||||
}
|
||||
$info = [
|
||||
'nickname' => $admin['nickname'],
|
||||
'desc' => 'manager',
|
||||
'avatar' => $admin['avatar'],
|
||||
'token' => $request->sessionId(),
|
||||
'userId' => $admin['id'],
|
||||
'username' => $admin['username'],
|
||||
'email' => $admin['email'],
|
||||
'mobile' => $admin['mobile'],
|
||||
'roles' => []
|
||||
'isSupperAdmin' => Auth::isSupperAdmin()
|
||||
];
|
||||
return $this->json(0, 'ok', $info);
|
||||
}
|
||||
|
@ -336,23 +336,21 @@ class Crud extends Base
|
||||
/**
|
||||
* 格式化树
|
||||
* @param $items
|
||||
* @param array $include
|
||||
* @param int $type
|
||||
* @return Response
|
||||
*/
|
||||
protected function formatTree($items, array $include = [], int $type = 0): Response
|
||||
protected function formatTree($items): Response
|
||||
{
|
||||
$items_map = [];
|
||||
$format_items = [];
|
||||
foreach ($items as $item) {
|
||||
$items_map[] = [
|
||||
$format_items[] = [
|
||||
'name' => $item->title ?? $item->name ?? $item->id,
|
||||
'value' => (string)$item->id,
|
||||
'id' => $item->id,
|
||||
'pid' => $item->pid,
|
||||
];
|
||||
}
|
||||
$tree = new Tree($items_map);
|
||||
return $this->json(0, 'ok', $tree->getTree($include, $type));
|
||||
$tree = new Tree($format_items);
|
||||
return $this->json(0, 'ok', $tree->getTree());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,7 +166,18 @@ class RoleController extends Crud
|
||||
if ($rule_id_string !== '*') {
|
||||
$include = explode(',', $rule_id_string);
|
||||
}
|
||||
return $this->formatTree($rules, $include);
|
||||
$items = [];
|
||||
foreach ($rules as $item) {
|
||||
$items[] = [
|
||||
'name' => $item->title ?? $item->name ?? $item->id,
|
||||
'value' => (string)$item->id,
|
||||
'id' => $item->id,
|
||||
'pid' => $item->pid,
|
||||
];
|
||||
}
|
||||
$tree = new Tree($items);
|
||||
return $this->json(0, 'ok', $tree->getTree($include));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user