ClearCacheAttachment.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\command;
  13. use app\common\repositories\system\attachment\AttachmentRepository;
  14. use app\common\repositories\system\auth\MenuRepository;
  15. use think\console\Command;
  16. use think\console\Input;
  17. use think\console\Output;
  18. /**
  19. * Class FormatMenuPath
  20. * @package app\command
  21. * @author xaboy
  22. * @day 2020/8/26
  23. */
  24. class ClearCacheAttachment extends Command
  25. {
  26. /**
  27. * @author xaboy
  28. * @day 2020/9/21
  29. */
  30. protected function configure()
  31. {
  32. // 指令配置
  33. $this->setName('clear:attachment')
  34. ->setDescription('clear cache attachment');
  35. }
  36. /**
  37. * @param Input $input
  38. * @param Output $output
  39. * @return int|void|null
  40. * @author xaboy
  41. * @day 2020/9/21
  42. */
  43. protected function execute(Input $input, Output $output)
  44. {
  45. $output->writeln('开始清理');
  46. app()->make(AttachmentRepository::class)->clearCache();
  47. $output->writeln('开始完毕');
  48. }
  49. }