| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\admin\command;
- use think\console\Command;
- use think\console\Input;
- use think\console\input\Option;
- use think\console\Output;
- use think\Exception;
- use app\common\model\Region;
- class Task extends Command
- {
-
- protected function configure()
- {
- $this->setName('task')->setDescription('Compress js and css file');
- }
- protected function execute(Input $input, Output $output)
- {
- $reg = new Region();
- $list = collection($reg::where('level', '=', 1)->select())->toArray();
- $arr = array();
- foreach ($list as $key => $value) {
- $arr[$value['id']] = $reg->where('parent_id', '=', $value['id'])->column('id,name');
- }
- file_put_contents('./11.txt', json_encode($arr, JSON_UNESCAPED_UNICODE));
- $output->info("Ok Successed!");
- }
- }
|