Browse Source

修复退伍军人加分

sandm 2 years ago
parent
commit
6ee5b90654
1 changed files with 53 additions and 12 deletions
  1. 53 12
      app/Http/Controllers/Web/Recruit/IndexController.php

+ 53 - 12
app/Http/Controllers/Web/Recruit/IndexController.php

@@ -19,15 +19,17 @@ use App\Models\RecruitAppointExpandSpecial;
 use App\Models\RecruitAppointDetail;
 use App\Models\RecruitAppointDetail;
 use App\Models\RecruitArticle;
 use App\Models\RecruitArticle;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Cache;
+use App\Services\Common\BaiduService;
 
 
 class IndexController extends WebBaseController
 class IndexController extends WebBaseController
 {
 {
 
 
-    protected $recruitService;
+    protected $recruitService,$baiduService;
 
 
-    public function __construct(RecruitService $recruitService)
+    public function __construct(RecruitService $recruitService,BaiduService $baiduService)
     {
     {
         $this->recruitService = $recruitService;
         $this->recruitService = $recruitService;
+        $this->baiduService = $baiduService;
     }
     }
 
 
     /**
     /**
@@ -83,11 +85,16 @@ class IndexController extends WebBaseController
             //笔试
             //笔试
             $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
             $pen_ticket = RecruitTicket::where('appoint_id',$appoint_info->id)->where('ex_type',1)->first();
             if($pen_ticket){
             if($pen_ticket){
-                $time = time();
-                if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
-                    $appoint_info->pen_ticket = 1;
+                $pen_health = RecruitSupplement::where("appoint_id",$appoint_info->id)->where("type","pen")->first();
+                if(!$pen_health){
+                    $appoint_info->pen_ticket = -2;
                 }else{
                 }else{
-                    $appoint_info->pen_ticket = -1;
+                    $time = time();
+                    if(strtotime($pen_ticket->ex_start) < $time && strtotime($pen_ticket->ex_end) > $time){
+                        $appoint_info->pen_ticket = 1;
+                    }else{
+                        $appoint_info->pen_ticket = -1;
+                    }
                 }
                 }
             }else{
             }else{
                 $appoint_info->pen_ticket = 0;
                 $appoint_info->pen_ticket = 0;
@@ -419,7 +426,7 @@ class IndexController extends WebBaseController
                     }
                     }
                     $user_info['special'] = [
                     $user_info['special'] = [
                         'point_apply'   =>  (string)$special['point_apply'],
                         'point_apply'   =>  (string)$special['point_apply'],
-                        'condition'     =>  $special['condition'],
+                        'condition'     =>  $special['condition'] ?? "退伍军人加分",
                         'material'      =>  $material
                         'material'      =>  $material
                     ];
                     ];
                 }
                 }
@@ -1633,16 +1640,45 @@ class IndexController extends WebBaseController
         }
         }
 
 
         $time = time();
         $time = time();
-        if($time > 1656043200){//手动截止
+        $type = $request->input('type',null);
+        $where = [];
+        if($type){
+            switch ($type){
+                case 'pen':
+                    $start = strtotime($recruit->pen_health_start);
+                    $end = strtotime($recruit->pen_health_end);
+                    break;
+                case 'computer':
+                    $start = strtotime($recruit->computer_health_start);
+                    $end = strtotime($recruit->computer_health_end);
+                    break;
+                case 'face':
+                    $start = strtotime($recruit->face_health_start);
+                    $end = strtotime($recruit->face_health_end);
+                    break;
+                default:
+                    $start = strtotime($recruit->supplement_start);
+                    $end = strtotime($recruit->supplement_end);
+                    break;
+            }
+            $where[] = ['type', '=', $type];
+        }else{
+            $start = strtotime($recruit->supplement_start);
+            $end = strtotime($recruit->supplement_end);
+
+        }
+        if($time > $end || $time < $start){
             return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
             return $this->showMessage('抱歉,考察审核端口已关闭!', route('recruit.show',array('id',$recruit['id'])), true, '上一页', '3');
         }
         }
 
 
-        $info = RecruitSupplement::where('appoint_id',$appoint_info->id)->first();
+        $where[] = ['appoint_id', '=', $appoint_info->id];
+        $info = RecruitSupplement::where($where)->first();
         if(!$info){
         if(!$info){
             $info = [
             $info = [
                 'appoint_id' => $appoint_info->id,
                 'appoint_id' => $appoint_info->id,
                 'health_code' => '',
                 'health_code' => '',
-                'trip_code' => ''
+                'trip_code' => '',
+                'type' => $type
             ];
             ];
         }else{
         }else{
             $info = $info->toArray();
             $info = $info->toArray();
@@ -1834,11 +1870,12 @@ class IndexController extends WebBaseController
             return redirect(route('login'));
             return redirect(route('login'));
         }
         }
         $appoint_id = $request->input('appoint_id');
         $appoint_id = $request->input('appoint_id');
+        $type = $request->input('type');
         $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('id',$appoint_id)->first();
         $appoint_info = RecruitAppointInfo::where('uid',$uid)->where('id',$appoint_id)->first();
         if(!$appoint_info){
         if(!$appoint_info){
             return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
             return ['status' => 0, 'msg' => '抱歉,找不到您要登记的报名记录!'];
         }
         }
-        $info = RecruitSupplement::where('appoint_id',$appoint_id)->first();
+        $info = RecruitSupplement::where('appoint_id',$appoint_id)->where('type',$type)->first();
         if($info){
         if($info){
             if($info->h_status == 1){
             if($info->h_status == 1){
                 return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
                 return ['status' => 0, 'msg' => '材料已审核通过,不允许修改'];
@@ -1881,6 +1918,10 @@ class IndexController extends WebBaseController
                     }
                     }
                 }
                 }
             }
             }
+
+            $this->baiduService->health_code(file_get_contents(base_path() . "/public" . $health_code[0]['response']['path']));
+
+
             $data['health_code'] = json_encode($health_code);
             $data['health_code'] = json_encode($health_code);
 
 
             $trip_code = $request->input('trip_code');
             $trip_code = $request->input('trip_code');
@@ -1893,7 +1934,7 @@ class IndexController extends WebBaseController
                 }
                 }
             }
             }
             $data['trip_code'] = json_encode($trip_code);
             $data['trip_code'] = json_encode($trip_code);
-
+            $data['type'] = $type;
             $data['h_status'] = 0;
             $data['h_status'] = 0;
             RecruitSupplement::create($data);
             RecruitSupplement::create($data);
             $appoint_info->health_audit = 4;
             $appoint_info->health_audit = 4;