Browse Source

更新两码上传

sandm 2 years ago
parent
commit
df45b8158a
1 changed files with 26 additions and 14 deletions
  1. 26 14
      app/Http/Controllers/Web/Recruit/IndexController.php

+ 26 - 14
app/Http/Controllers/Web/Recruit/IndexController.php

@@ -1946,33 +1946,40 @@ class IndexController extends WebBaseController
             }
 
             $health_result = $this->baiduService->health_code(file_get_contents(base_path() . "/public" . $health_code[0]['response']['path']));
-
+            $health_msg = [];
+            $h_status = 1;
             if(!array_key_exists('error_msg',$health_result) && !array_key_exists('error_code',$health_result)){
                 if(array_key_exists('姓名',$health_result)){
                     if($health_result['姓名'][0]['word'] != $appoint_info->realname){
-                        return ['status' => 0, 'msg' => '抱歉,请上传您本人的健康码!'];
+                        array_push($health_msg,'抱歉,请上传您本人的健康码!');
+                        $h_status = 0;
                     }
                 }else{
-                    return ['status' => 0, 'msg' => '健康码错误,识别不到姓名!'];
+                    array_push($health_msg,'健康码错误,识别不到姓名!');
+                    $h_status = 0;
                 }
                 if(array_key_exists('状态',$health_result)){
                     if($health_result['状态'][0]['word'] != '绿码'){
-                        return ['status' => 0, 'msg' => '抱歉,您的健康码非绿码!'];
+                        array_push($health_msg,'抱歉,您的健康码非绿码!');
+                        $h_status = 0;
                     }
                 }else{
-                    return ['status' => 0, 'msg' => '健康码错误,识别不到状态!'];
+                    array_push($health_msg,'健康码错误,识别不到状态!');
+                    $h_status = 0;
                 }
                 if(array_key_exists('更新时间',$health_result)){
                     $time = strtotime($health_result['更新时间'][0]['word']);
                     if($time < strtotime($recruit->pen_health_start) || $time > strtotime($recruit->pen_health_end)){
-                        return ['status' => 0, 'msg' => "抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的健康码!"];
+                        array_push($health_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的健康码!');
+                        $h_status = 0;
                     }
                 }else{
-                    return ['status' => 0, 'msg' => '健康码错误,识别不到时间!'];
+                    array_push($health_msg,'健康码错误,识别不到时间!');
+                    $h_status = 0;
                 }
-                $data['h_status'] = 1;
-                $data['h_msg'] = '健康码自动审核通过';
-                $appoint_info->health_audit = 1;
+                $data['h_status'] = $h_status;
+                $data['h_msg'] = $h_status == 1 ? '健康码自动审核通过' : implode(';',$health_msg);
+                $appoint_info->health_audit = $h_status;
                 $data['health_code'] = json_encode($health_code);
             }
 
@@ -1988,24 +1995,29 @@ class IndexController extends WebBaseController
                 }
             }
             $trip_result = $this->baiduService->trip_code(file_get_contents(base_path() . "/public" . $trip_code[0]['response']['path']));
+            $trip_msg = [];
+            $trip_status = 0;
             if(!array_key_exists('error_msg',$trip_result) && !array_key_exists('error_code',$trip_result)){
                 if(array_key_exists('途经地',$trip_result['result'])){
                     $fangyi_area = explode("\r\n",config('aix.fangyi.fangyi_zhaokao.fangyi_zhaokao.risk_area'));
                     $result = array_intersect($fangyi_area,$trip_result['result']['途经地'][0]['word']);
                     if(count($result) > 0){
-                        return ['status' => 0, 'msg' => '抱歉,您的行程中包含系统设置中高风险地区!'];
+                        array_push($trip_msg,'抱歉,您的行程中包含系统设置中高风险地区!');
+                        $trip_status = 0;
                     }
                 }
                 if(array_key_exists('风险性',$trip_result['result']) && $trip_result['result']['风险性']){
-                    return ['status' => 0, 'msg' => '抱歉,您的行程可能含有风险!'];
+                    array_push($trip_msg,'抱歉,您的行程可能含有风险!');
+                    $trip_status = 0;
                 }
                 if(array_key_exists('更新时间',$trip_result['result'])){
                     $time = strtotime($health_result['更新时间'][0]['word'][0]);
                     if($time > strtotime($recruit->pen_health_start) || $recruit < ($recruit->pen_health_end)){
-                        return ['status' => 0, 'msg' => "抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的行程码!"];
+                        array_push($trip_msg,'抱歉,请上传{$recruit->pen_health_start}至{$recruit->pen_health_end}之间的行程码!');
+                        $trip_status = 0;
                     }
                 }
-                $data['h_msg'] .= '行程码审核通过';
+                $data['h_msg'] = implode(';',$trip_msg);
             }
 
             $data['trip_result'] = json_encode($trip_result);