1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace App\Jobs\Cron;
- use App\Models\Jobfair\JobfairBlacklist;
- use App\Services\Jobfair\JobfairService;
- use Illuminate\Bus\Queueable;
- use Illuminate\Queue\SerializesModels;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Support\Facades\Log;
- class Blacklist implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- const CREATE_LIST = 'create';
- const UPDATE_LIST = 'update';
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct()
- {
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle(JobfairService $jobfairService)
- {
- $company_id = $jobfairService->getJobfairBlacklistCompany();
- if ($company_id) {
- foreach ($company_id as $val) {
- $res = JobfairBlacklist::where(['company_id'=>$val])->first();
- if ($res) {
- JobfairBlacklist::where(['company_id'=>$val])
- ->update(['type'=>1, 'details'=>'未签到或者迟到/早退超过3次(包含3次)', 'add_time'=>time(), 'remove_time'=>0, 'status'=>1, 'operator'=>'系统']);
- } else {
- JobfairBlacklist::create(
- ['company_id'=>$val, 'type'=>1, 'details'=>'未签到或者迟到/早退超过3次(包含3次)', 'add_time'=>time(), 'operator'=>'系统']
- );
- }
- }
- }
- }
- }
|