// +---------------------------------------------------------------------- namespace app\command; use app\common\repositories\system\merchant\MerchantRepository; use think\console\Command; use think\console\Input; use think\console\Output; use think\facade\Log; class ClearRedundancy extends Command { protected function configure() { // 指令配置 $this->setName('clear:redundancy') ->setDescription('已删除的商户的商品相关数据'); } protected function execute(Input $input, Output $output) { try{ app()->make(MerchantRepository::class)->clearRedundancy(); }catch (\Exception $exception){ Log::info('清除冗余错误:'.$exception->getMessage()); } $output->info('执行成功'); } }