| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | 
							- <?php
 
- namespace App\Console\Commands\Transfer;
 
- use App\Models\Jobfair\JobfairPutJob;
 
- use App\Models\Jobfair\JobfairJob;
 
- use Illuminate\Console\Command;
 
- use Illuminate\Support\Facades\DB;
 
- use Illuminate\Support\Facades\Log;
 
- class TransPutJobs extends Command
 
- {
 
-     /**
 
-      * The name and signature of the console command.
 
-      *
 
-      * @var string
 
-      */
 
-     protected $signature = 'aix:transfer-put-jobs';
 
-     /**
 
-      * The console command description.
 
-      *
 
-      * @var string
 
-      */
 
-     protected $description = '舟山旧数据招聘会职位修改';
 
-     /**
 
-      * Create a new command instance.
 
-      *
 
-      * @return void
 
-      */
 
-     public function __construct()
 
-     {
 
-         parent::__construct();
 
-     }
 
-     /**
 
-      * Execute the console command.
 
-      *
 
-      * @return mixed
 
-      */
 
-     public function handle()
 
-     {
 
-         $this->info("开始更新招聘会职位数据...");
 
-         $total = JobfairPutJob::withTrashed()->get()->count();
 
-         $bar=$this->output->createProgressBar($total);
 
-         JobfairPutJob::withTrashed()->orderBy('id', 'asc')->chunk(1000, function ($jobs) use ($bar) {
 
-             foreach ($jobs as $job) {
 
-                 $jobfair = JobfairJob::where(['company_id'=>$job->company_id,'jobs_name'=>$job->jobs_name])->first();
 
-                 if($jobfair){
 
-                     $job->job_id=$jobfair->id;
 
-                     $job->save();
 
-                 }else{
 
-                     Log::info($job->id.'_'.$job->company_id.'_'.$job->jobs_name);
 
-                 }
 
-             }
 
-             $bar->advance(1000);
 
-         });
 
-         $bar->finish();
 
-         $this->line("  完成!");
 
-         $this->info("更新招聘会职位职位成功.");
 
-     }
 
- }
 
 
  |