argument('type'); $file_path = $this->argument('filepath'); //路径相对于项目根目录即 /public if(empty($type) || empty($file_path)){ $this->output->error('请输入完整参数'); } //图文咨询订单导入 switch ($type){ case 'chat'; $this->makeChat($file_path); break; case 'phone'; $this->makePhone($file_path); break; case 'vaccine'; $this->makeVaccine($file_path); break; case 'nurse'; $this->makeNurse($file_path); break; case 'service'; $this->makeService($file_path); break; default; $this->output->error('请输入正确参数'); break; } } //图文订单 public function makeChat($file_path) { $filePath = './public/import/'.$file_path.'.xls'; if(!file_exists($filePath)){ $this->output->error('文件不存在'); exit; } Excel::import(new chatOrder(), $filePath); $this->output->success('Import successful'); } //电话订单 public function makePhone($file_path) { $filePath = './public/import/'.$file_path.'.xls'; if(!file_exists($filePath)){ $this->output->error('文件不存在'); exit; } Excel::import(new phoneOrder(), $filePath); $this->output->success('Import successful'); } //疫苗订单 public function makeVaccine($file_path) { $filePath = './public/import/'.$file_path.'.xls'; if(!file_exists($filePath)){ $this->output->error('文件不存在'); exit; } Excel::import(new vaccineOrder(), $filePath); $this->output->success('Import successful'); } //儿保订单 public function makeNurse($file_path) { $filePath = './public/import/'.$file_path.'.xls'; if(!file_exists($filePath)){ $this->output->error('文件不存在'); exit; } Excel::import(new nurseOrder(), $filePath); $this->output->success('Import successful'); } //服务包订单 public function makeService($file_path) { $filePath = './public/import/'.$file_path.'.xls'; if(!file_exists($filePath)){ $this->output->error('文件不存在'); exit; } Excel::import(new serviceOrder(), $filePath); $this->output->success('Import successful'); } }