//按照需求将相同的行业排序在一起排序后的列表
function getIndustry($list){
$result = [];
while(count($list) > 0) {
$code = reset($list);//获取数组的第一个元素
$map = DB::table('bas_indus_categories')->select('pcode')->where('code', $code)->get()->first();
//获取一级行业下的二级行业
$mapList = DB::table('bas_indus_categories')->select('code')->where('pcode', $map->pcode)->get()->toArray();
if ($mapList) {
foreach ($mapList as $key=>$value){
$new_types_one_arr[] = $value->code;
}
$new = array_intersect($list,$new_types_one_arr);//获取2个数组的共同的元素
foreach ($new as $k=>$item){
array_push($result,$item);//将共同的元素放入一个新的数组中
}

$list = array_diff($list,$new);//获取2个数组的差集
}

}
return $result;
}