linwu 3 долоо хоног өмнө
parent
commit
058b4eab9e

+ 19 - 3
app/Http/Controllers/Api/Test/JobController.php

@@ -6,6 +6,7 @@ use App\Http\Controllers\Api\ApiBaseController;
 use App\Models\Category;
 use App\Models\Category;
 use App\Models\Company;
 use App\Models\Company;
 use App\Models\Jobs;
 use App\Models\Jobs;
+use App\Models\JobsContact;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 use PhpOffice\PhpSpreadsheet\IOFactory;
 use PhpOffice\PhpSpreadsheet\IOFactory;
 
 
@@ -33,6 +34,7 @@ class JobController extends ApiBaseController
                 'xuewei'       => $sheet->getCell("P{$row}")->getValue(),
                 'xuewei'       => $sheet->getCell("P{$row}")->getValue(),
                 'major'        => $sheet->getCell("Q{$row}")->getValue(),
                 'major'        => $sheet->getCell("Q{$row}")->getValue(),
                 'jobs_content' => $sheet->getCell("R{$row}")->getValue(),
                 'jobs_content' => $sheet->getCell("R{$row}")->getValue(),
+                'contacts'     => $sheet->getCell("T{$row}")->getValue(),
             ];
             ];
         }
         }
         $company_name_list = array_unique(array_column($record, 'company_name'));
         $company_name_list = array_unique(array_column($record, 'company_name'));
@@ -60,15 +62,29 @@ class JobController extends ApiBaseController
             $item['district']        = $company_list[$v['company_name']]['district'];
             $item['district']        = $company_list[$v['company_name']]['district'];
             $item['education']       = $education[$v['education']];
             $item['education']       = $education[$v['education']];
             $item['wage']            = -1;
             $item['wage']            = -1;
-            $item['age']             = [18,$v['max_age']];
-            $item['jobs_content']    = "学位要求:" . $v['xuewei'] . ";专业要求:" . $v['major'] . $v['jobs_content'] . "\n";
+            $item['age']             = [18, $v['max_age']];
+            $item['jobs_content']    = "性别要求:" . $v['sex'] . "学位要求:" . $v['xuewei'] . ";专业要求:" . $v['major'] . $v['jobs_content'] . "\n";
             $item['audit']           = 1;
             $item['audit']           = 1;
             $item['setmeal_id']      = 1;
             $item['setmeal_id']      = 1;
             $item['setmeal_name']    = "免费会员";
             $item['setmeal_name']    = "免费会员";
             $item['display']         = 1;
             $item['display']         = 1;
             $item['is_health']       = 1;
             $item['is_health']       = 1;
             $item['health_type']     = 1;
             $item['health_type']     = 1;
-            Jobs::create($item);
+            $jobs = Jobs::create($item);
+            $jobs_contacts = explode(':',$v['contacts']);
+            JobsContact::create([
+                'job_id' => $jobs['id'],
+                'contact' => $jobs_contacts[0],
+                'telephone' => $jobs_contacts[1],
+                'landline' => $jobs_contacts[1],
+                'address' => $company_list[$v['company_name']]['address'],
+                'email' => $company_list[$v['company_name']]['email'],
+                'notify_mobile' => 0,
+                'contact_show' => 1,
+                'telephone_show' => 1,
+                'email_show' => 1,
+                'landline_tel_show' => 1,
+            ]);
         }
         }
 
 
         return '完成';
         return '完成';