ClearRedundancy.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\command;
  12. use app\common\repositories\system\merchant\MerchantRepository;
  13. use think\console\Command;
  14. use think\console\Input;
  15. use think\console\Output;
  16. use think\facade\Log;
  17. class ClearRedundancy extends Command
  18. {
  19. protected function configure()
  20. {
  21. // 指令配置
  22. $this->setName('clear:redundancy')
  23. ->setDescription('已删除的商户的商品相关数据');
  24. }
  25. protected function execute(Input $input, Output $output)
  26. {
  27. try{
  28. app()->make(MerchantRepository::class)->clearRedundancy();
  29. }catch (\Exception $exception){
  30. Log::info('清除冗余错误:'.$exception->getMessage());
  31. }
  32. $output->info('执行成功');
  33. }
  34. }