/**
* 获取菜单获取角色权限id 用于 匹配 前端权限
*
*/
public function getMenu()
{
$this->datas = $this->params;//接受验证通过的参数
$data = $this->checkToken($this->datas['Token'],true);//检查token 并返回值
$newarray = array();
unset( $this->datas['Token']);
$newarray = $this->getjs($data['id']);
// print_r("<pre>");
// print_r($newarray);
// // //响应数据给客户端
$this->returnMsg(200, '查询成功', $newarray);
}
Array
(
[0] => Array
(
[id] => 10
[parentId] => 0
[ibranch_id] => 1
[user_login_id] => 1
[name] => 客户管理
[menuSort] => 0
[dataFlag] => 0
[path] => /PotentialCustomers
[component] =>
[source] => icon-kehuliebiao
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
[0] => Array
(
[id] => 11
[parentId] => 10
[ibranch_id] => 1
[user_login_id] => 1
[name] => 客户中心
[menuSort] => 0
[dataFlag] => 0
[path] => /business/PotentialCustomers/PotentialCustomers
[component] => business/PotentialCustomers/PotentialCustomers
[source] => icon-kehuliebiao
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
)
)
[1] => Array
(
[id] => 12
[parentId] => 10
[ibranch_id] => 1
[user_login_id] => 1
[name] => 工作记录
[menuSort] => 0
[dataFlag] => 0
[path] => /business/WorkRecord/WorkRecord
[component] => business/WorkRecord/WorkRecord
[source] => icon-kehuliebiao
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
)
)
)
)
[1] => Array
(
[id] => 1
[parentId] => 0
[ibranch_id] => 1
[user_login_id] => 1
[name] => 基本配置
[menuSort] => 0
[dataFlag] => 0
[path] => /shop
[component] =>
[source] => iconfont iconicon_work
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
[0] => Array
(
[id] => 5
[parentId] => 1
[ibranch_id] => 1
[user_login_id] => 1
[name] => 员工设置
[menuSort] => 0
[dataFlag] => 0
[path] => /business/staff/staff
[component] => /business/staff/staff
[source] => icon-huaban
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
)
)
[1] => Array
(
[id] => 7
[parentId] => 1
[ibranch_id] => 1
[user_login_id] => 1
[name] => 市场设置
[menuSort] => 0
[dataFlag] => 0
[path] => /business/market/market
[component] => business/market/market
[source] => icon-kehuliebiao
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
)
)
[2] => Array
(
[id] => 8
[parentId] => 1
[ibranch_id] => 1
[user_login_id] => 1
[name] => 教务设置
[menuSort] => 0
[dataFlag] => 0
[path] => /business/jiaowuconfig/jiaowuconfig
[component] => business/jiaowuconfig/jiaowuconfig
[source] => icon-kehuliebiao
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
)
)
)
)
[2] => Array
(
[id] => 17
[parentId] => 0
[ibranch_id] => 1
[user_login_id] => 1
[name] => 学员中心
[menuSort] => 0
[dataFlag] => 0
[path] => /business/StudentList
[component] => business/StudentList/StudentList
[source] => icon-kehuliebiao
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
)
)
[3] => Array
(
[id] => 1
[parentId] => 0
[ibranch_id] => 1
[user_login_id] => 1
[name] => 基本配置
[menuSort] => 0
[dataFlag] => 0
[path] => /shop
[component] =>
[source] => iconfont iconicon_work
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
[0] => Array
(
[id] => 5
[parentId] => 1
[ibranch_id] => 1
[user_login_id] => 1
[name] => 员工设置
[menuSort] => 0
[dataFlag] => 0
[path] => /business/staff/staff
[component] => /business/staff/staff
[source] => icon-huaban
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
)
)
[1] => Array
(
[id] => 7
[parentId] => 1
[ibranch_id] => 1
[user_login_id] => 1
[name] => 市场设置
[menuSort] => 0
[dataFlag] => 0
[path] => /business/market/market
[component] => business/market/market
[source] => icon-kehuliebiao
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
)
)
[2] => Array
(
[id] => 8
[parentId] => 1
[ibranch_id] => 1
[user_login_id] => 1
[name] => 教务设置
[menuSort] => 0
[dataFlag] => 0
[path] => /business/jiaowuconfig/jiaowuconfig
[component] => business/jiaowuconfig/jiaowuconfig
[source] => icon-kehuliebiao
[code] => 123
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
)
)
)
)
[4] => Array
(
[id] => 9
[parentId] => 0
[ibranch_id] => 1
[user_login_id] => 1
[name] => 市场管理
[menuSort] => 0
[dataFlag] => 0
[path] => /business/market
[component] => business/marketActivity/marketActivity
[source] => icon-kehuliebiao
[code] => 1231
[alias] => menu
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] =>
[children] => Array
(
[0] => Array
(
[id] => 29
[parentId] => 9
[ibranch_id] => 1
[user_login_id] => 1
[name] => 活动管理
[menuSort] => 4
[dataFlag] => 0
[path] => /business/marketActivity/marketActivity
[component] =>
[source] => iconfont iconicon_savememo
[code] => 3
[alias] => 活动管理
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] => 活动管理
[children] => Array
(
)
)
[1] => Array
(
[id] => 30
[parentId] => 9
[ibranch_id] => 1
[user_login_id] => 1
[name] => 名单导入
[menuSort] => 5
[dataFlag] => 0
[path] => /business/nameimport
[component] =>
[source] => iconfont iconicon_addperson
[code] => 54123
[alias] => 名单导入
[category] => 1
[action] =>
[is_open] =>
[is_deleted] =>
[remark] => 名单导入
[children] => Array
(
)
)
)
)
)
/**
* 数组去重保留相同值
*/
private function array_unset_tt($arr,$key='id'){
//建立一个目标数组
$res = array();
foreach ($arr as $value) {
//查看有没有重复项
if(isset($res[$value[$key]])){
// print_r("<pre>");
// echo "res重复的值";
// print_r($res[$value[$key]]);
// echo "value重复的值";
// print_r($value);
$res[$value[$key]] = array_merge($res[$value[$key]],$value);//合并数组 相同值保留一个 没有的添加上
unset($value[$key]); //有:销毁
}else{
$res[$value[$key]] = $value;//无:添加到新数组
}
}
//重新改变为前端需要的数组样式
$res2 = array();
$i = 0;
foreach ($res as $value2) {
$res2[$i] = $value2;
$i++;
}
// print_r("<pre>");
// // print_r($arr);
// print_r($res2);
return $res2;
}
网友评论