setName('reset:imagePath') ->addArgument('origin', Argument::OPTIONAL, 'path:http:/crmeb.com') ->addArgument('replace', Argument::OPTIONAL, 'path:http:/crmeb.com') ->setDescription('php think reset:imagePath http://old.com http://new.com'); } /** * 重置图片路径 * @param Input $input * @param Output $output * @return int|void|null * @author wuhaotian * @email 442384644@qq.com * @date 2024/7/12 */ protected function execute(Input $input, Output $output) { $origin = $input->getArgument('origin'); $replace = $input->getArgument('replace'); $output->writeln('开始执行'); $service = ImageHostService::getInstance(); $res = $service->execute($origin,$replace); if ($res) { $output->info('执行完成'); } else { $output->warning('执行过程中存在错误,请在runtime/log中查看具体错误信息'); } } }