AutoJob.php 658 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace crmeb\jobs;
  3. use crmeb\interfaces\JobInterface;
  4. use think\facade\Db;
  5. use think\queue\Job;
  6. use app\models\store\StorePink;
  7. class AutoJob implements JobInterface
  8. {
  9. public function fire(Job $job, $data): void
  10. {
  11. if($this->doDefaultJod($data))
  12. $job->delete();
  13. else {
  14. if ($job->attempts() > 3)
  15. $job->delete();
  16. }
  17. }
  18. public function doDefaultJod($data): bool
  19. {
  20. try {
  21. @file_put_contents('cvcc.txt',json_encode($data['data']));
  22. StorePink::autoPink($data['data']);
  23. } catch (\Throwable $e) {
  24. }
  25. return true;
  26. }
  27. }