DemoJob.php 731 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Job;
  4. use App\Master\Framework\Extend\BaseJob;
  5. use App\Utils\LogUtil;
  6. class DemoJob extends BaseJob
  7. {
  8. //日志板块
  9. protected string $LOG_MODULE = 'DemoJob';
  10. /**
  11. * 任务执行失败后的重试次数,即最大执行次数为 $maxAttempts+1 次
  12. */
  13. protected int $maxAttempts = 2;
  14. public function __construct($params)
  15. {
  16. parent::__construct($params);
  17. }
  18. /**
  19. * 执行
  20. * @param $params
  21. * @return bool
  22. */
  23. protected function do($params): bool
  24. {
  25. LogUtil::info('do', $this->LOG_MODULE, __FUNCTION__, '123123213');
  26. // 业务代码
  27. return $this->success('执行成功',$params);
  28. }
  29. }