argument('type'); $file_path = $this->argument('filepath'); //路径相对于项目根目录即 /public if(empty($type) || empty($file_path)){ $this->output->error('请输入完整参数'); } //图文咨询订单导入 if($type == 'chat'){ $this->makeChat($file_path); } if($type == 'vaccine'){ $this->makeVaccine($file_path); } } 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 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'); } }