LineJob.php 639 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\order\Line;
  7. class LineJob 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('cvt.txt',json_encode($data));
  22. line::createLevelOrder($data);
  23. } catch (\Throwable $e) {
  24. }
  25. return true;
  26. }
  27. }