|
@@ -22,41 +22,38 @@ class Task extends Command
|
|
|
protected function execute(Input $input, Output $output)
|
|
protected function execute(Input $input, Output $output)
|
|
|
{
|
|
{
|
|
|
$reg = new Region();
|
|
$reg = new Region();
|
|
|
- $list = $reg::where('level', '=', 1)->column('id,name');
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $list = $reg::where('level', '=', 1)->field('id,name,ext_id')->select();
|
|
|
$arr = array();
|
|
$arr = array();
|
|
|
- $i = 0;
|
|
|
|
|
- foreach ($list as $key => $item) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ foreach ($list as $i=>$item) {
|
|
|
|
|
|
|
|
- $arr[$i]['label'] = $item;
|
|
|
|
|
- $arr[$i]['id'] = $key;
|
|
|
|
|
- $list1 =$reg::where('parent_id', '=', $key)->column('id,name');
|
|
|
|
|
- $j = 0;
|
|
|
|
|
- foreach ($list1 as $key1 => $item1) {
|
|
|
|
|
- $arr[$i]['children'][$j]['label'] = $item1;
|
|
|
|
|
- $arr[$i]['children'][$j]['id'] = $key1;
|
|
|
|
|
- $list2 =$reg::where('parent_id', '=', $key1)->column('id,name');
|
|
|
|
|
- $s = 0;
|
|
|
|
|
-
|
|
|
|
|
- foreach ($list2 as $key2 => $item2) {
|
|
|
|
|
- $arr[$i]['children'][$j]['children'][$s]['label'] = $item2;
|
|
|
|
|
- $arr[$i]['children'][$j]['children'][$s]['id'] = $key2;
|
|
|
|
|
- $list3 =$reg::where('parent_id', '=', $key2)->column('id,name');
|
|
|
|
|
|
|
+ $arr[$i]['label'] = $item->name;
|
|
|
|
|
+ $arr[$i]['id'] = $item->ext_id;
|
|
|
|
|
+ $list1 =$reg::where('parent_id', '=', $item->id)->field('id,name,ext_id')->select();
|
|
|
|
|
+
|
|
|
|
|
+ foreach ($list1 as $j => $item1) {
|
|
|
|
|
+
|
|
|
|
|
+ $arr[$i]['children'][$j]['label'] = $item1->name;
|
|
|
|
|
+ $arr[$i]['children'][$j]['id'] = $item1->ext_id;
|
|
|
|
|
+ $list2 =$reg::where('parent_id', '=', $item1->id)->field('id,name,ext_id')->select();
|
|
|
|
|
|
|
|
- $d = 0;
|
|
|
|
|
- foreach ($list3 as $key3 => $item3) {
|
|
|
|
|
|
|
+ foreach ($list2 as $s => $item2) {
|
|
|
|
|
+ $arr[$i]['children'][$j]['children'][$s]['label'] = $item2->name;
|
|
|
|
|
+ $arr[$i]['children'][$j]['children'][$s]['id'] = $item2->ext_id;
|
|
|
|
|
+ $list3 =$reg::where('parent_id', '=', $item2->id)->field('id,name,ext_id')->select();
|
|
|
|
|
+
|
|
|
|
|
+ foreach ($list3 as $d => $item3) {
|
|
|
if(!empty($item3)){
|
|
if(!empty($item3)){
|
|
|
- $arr[$i]['children'][$j]['children'][$s]['children'][$d]['label'] = $item3;
|
|
|
|
|
- $arr[$i]['children'][$j]['children'][$s]['children'][$d]['id'] = $key3;
|
|
|
|
|
- $d += 1;
|
|
|
|
|
|
|
+ $arr[$i]['children'][$j]['children'][$s]['children'][$d]['label'] = $item3->name;
|
|
|
|
|
+ $arr[$i]['children'][$j]['children'][$s]['children'][$d]['id'] = $item3->ext_id;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- $s +=1;
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- $j +=1;
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- $i +=1;
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
file_put_contents('./11.txt', json_encode($arr, JSON_UNESCAPED_UNICODE));
|
|
file_put_contents('./11.txt', json_encode($arr, JSON_UNESCAPED_UNICODE));
|