ClearRedundancy.php 749 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\command;
  3. use app\common\repositories\system\merchant\MerchantRepository;
  4. use think\console\Command;
  5. use think\console\Input;
  6. use think\console\Output;
  7. use think\facade\Log;
  8. class ClearRedundancy extends Command
  9. {
  10. protected function configure()
  11. {
  12. // 指令配置
  13. $this->setName('clear:redundancy')
  14. ->setDescription('已删除的商户的商品相关数据');
  15. }
  16. protected function execute(Input $input, Output $output)
  17. {
  18. try{
  19. app()->make(MerchantRepository::class)->clearRedundancy();
  20. }catch (\Exception $exception){
  21. Log::info('清除冗余错误:'.$exception->getMessage());
  22. }
  23. $output->info('执行成功');
  24. }
  25. }