|
@@ -8,6 +8,7 @@ namespace app\admin\model\system;
|
|
|
|
|
|
use crmeb\traits\ModelTrait;
|
|
|
use crmeb\basic\BaseModel;
|
|
|
+use think\facade\Db;
|
|
|
use think\facade\Route as Url;
|
|
|
|
|
|
/**
|
|
@@ -115,9 +116,8 @@ class SystemMenus extends BaseModel
|
|
|
*/
|
|
|
public static function rolesByRuleList($rules)
|
|
|
{
|
|
|
- dump($rules);
|
|
|
+ Db::query("SET SESSION group_concat_max_len = " . PHP_INT_MAX);
|
|
|
$res = SystemRole::where('id', 'IN', $rules)->field('GROUP_CONCAT(rules) as ids')->find();
|
|
|
- dump($res['ids']);
|
|
|
$ruleList = self::where('id', 'IN', $res['ids'])->whereOr('pid', 0)->order('sort DESC')->select();
|
|
|
return self::tidyMenuTier(false, $ruleList);
|
|
|
}
|
|
@@ -150,33 +150,14 @@ class SystemMenus extends BaseModel
|
|
|
if ($adminAuth === null) $adminAuth = $adminFilter == true ? SystemAdmin::activeAdminAuthOrFail() : [];//当前登录用户的菜单
|
|
|
foreach ($menusList as $k => $menu) {
|
|
|
$menu = $menu->getData();
|
|
|
- if ($menu['id'] == 469) {
|
|
|
- dump($menu);
|
|
|
- dump($pid);
|
|
|
- }
|
|
|
if ($menu['pid'] == $pid) {
|
|
|
-// if ($pid == 21) {
|
|
|
-// dump('s');
|
|
|
-// }
|
|
|
unset($menusList[$k]);
|
|
|
$params = json_decode($menu['params'], true);//获取参数
|
|
|
-// if ($pid == 21) {
|
|
|
-// dump($params);
|
|
|
-// }
|
|
|
$authName = self::getAuthName($menu['action'], $menu['controller'], $menu['module'], $params);// 按钮链接
|
|
|
-// if ($pid == 21) {
|
|
|
-// dump($authName);
|
|
|
-// }
|
|
|
if ($pid != 0 && $adminFilter && in_array($authName, $allAuth) && (!in_array($authName, $adminAuth) || !array_key_exists($menu['id'], $adminAuth))) continue;
|
|
|
$menu['child'] = self::tidyMenuTier($adminFilter, $menusList, $menu['id']);
|
|
|
-// if ($pid == 21) {
|
|
|
-// dump($menu['child']);
|
|
|
-// }
|
|
|
if ($pid != 0 && !count($menu['child']) && !$menu['controller'] && !$menu['action']) continue;
|
|
|
$menu['url'] = !count($menu['child']) ? Url::buildUrl($menu['module'] . '/' . $menu['controller'] . '/' . $menu['action'], $params) : 'javascript:void(0);';
|
|
|
-// if ($pid == 21) {
|
|
|
-// dump($menu['url']);
|
|
|
-// }
|
|
|
if ($pid == 0 && !count($menu['child'])) continue;
|
|
|
$navList[] = $menu;
|
|
|
}
|