Blacklist.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Jobs\Cron;
  3. use App\Models\Jobfair\JobfairBlacklist;
  4. use App\Services\Jobfair\JobfairService;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Queue\SerializesModels;
  7. use Illuminate\Queue\InteractsWithQueue;
  8. use Illuminate\Contracts\Queue\ShouldQueue;
  9. use Illuminate\Foundation\Bus\Dispatchable;
  10. use Illuminate\Support\Facades\Log;
  11. class Blacklist implements ShouldQueue
  12. {
  13. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  14. const CREATE_LIST = 'create';
  15. const UPDATE_LIST = 'update';
  16. /**
  17. * Create a new job instance.
  18. *
  19. * @return void
  20. */
  21. public function __construct()
  22. {
  23. }
  24. /**
  25. * Execute the job.
  26. *
  27. * @return void
  28. */
  29. public function handle(JobfairService $jobfairService)
  30. {
  31. $company_id = $jobfairService->getJobfairBlacklistCompany();
  32. if ($company_id) {
  33. foreach ($company_id as $val) {
  34. $res = JobfairBlacklist::where(['company_id'=>$val])->first();
  35. if ($res) {
  36. JobfairBlacklist::where(['company_id'=>$val])
  37. ->update(['type'=>1, 'details'=>'未签到或者迟到/早退超过3次(包含3次)', 'add_time'=>time(), 'remove_time'=>0, 'status'=>1, 'operator'=>'系统']);
  38. } else {
  39. JobfairBlacklist::create(
  40. ['company_id'=>$val, 'type'=>1, 'details'=>'未签到或者迟到/早退超过3次(包含3次)', 'add_time'=>time(), 'operator'=>'系统']
  41. );
  42. }
  43. }
  44. }
  45. }
  46. }