AutoClearPosterJob.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. namespace app\jobs\system;
  12. use crmeb\basic\BaseJobs;
  13. use app\services\system\attachment\SystemAttachmentServices;
  14. use crmeb\traits\QueueTrait;
  15. use think\facade\Log;
  16. /**
  17. * 自动清除海报
  18. * Class AutoClearPosterJob
  19. * @package app\jobs\user
  20. */
  21. class AutoClearPosterJob extends BaseJobs
  22. {
  23. use QueueTrait;
  24. /**
  25. * @return string
  26. */
  27. protected static function queueName()
  28. {
  29. return 'CRMEB_PRO_TASK';
  30. }
  31. /**
  32. * @param $event
  33. */
  34. public function doJob()
  35. {
  36. //清除昨日海报
  37. try {
  38. /** @var SystemAttachmentServices $attach */
  39. $attach = app()->make(SystemAttachmentServices::class);
  40. return $attach->emptyYesterdayAttachment();
  41. } catch (\Throwable $e) {
  42. Log::error('清除昨日海报,失败原因:[' . class_basename($this) . ']' . $e->getMessage());
  43. }
  44. }
  45. }