ClearCacheAttachment.php 991 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare (strict_types=1);
  3. namespace app\command;
  4. use app\common\repositories\system\attachment\AttachmentRepository;
  5. use app\common\repositories\system\auth\MenuRepository;
  6. use think\console\Command;
  7. use think\console\Input;
  8. use think\console\Output;
  9. /**
  10. * Class FormatMenuPath
  11. * @package app\command
  12. * @author zfy
  13. * @day 2020/8/26
  14. */
  15. class ClearCacheAttachment extends Command
  16. {
  17. /**
  18. * @author zfy
  19. * @day 2020/9/21
  20. */
  21. protected function configure()
  22. {
  23. // 指令配置
  24. $this->setName('clear:attachment')
  25. ->setDescription('clear cache attachment');
  26. }
  27. /**
  28. * @param Input $input
  29. * @param Output $output
  30. * @return int|void|null
  31. * @author zfy
  32. * @day 2020/9/21
  33. */
  34. protected function execute(Input $input, Output $output)
  35. {
  36. $output->writeln('开始清理');
  37. app()->make(AttachmentRepository::class)->clearCache();
  38. $output->writeln('开始完毕');
  39. }
  40. }