瀏覽代碼

修改行程码为空报错

sandm 2 年之前
父節點
當前提交
a44da92701
共有 1 個文件被更改,包括 21 次插入15 次删除
  1. 21 15
      app/Admin/Controllers/Recruit/RecruitController.php

+ 21 - 15
app/Admin/Controllers/Recruit/RecruitController.php

@@ -991,15 +991,18 @@ class RecruitController extends Controller
             ];
             $info->health_code = json_decode($info->health_code);
             $photo_data = [];
-            foreach ($info->health_code as $k => $v) {
-                if($v->status){
-                    $photo_data[] = [
-                        'alt' => $v->name,
-                        'pid' => $v->uid,
-                        'src' => $v->response->path,
-                    ];
+            if(is_array($info->health_code)){
+                foreach ($info->health_code as $k => $v) {
+                    if($v->status){
+                        $photo_data[] = [
+                            'alt' => $v->name,
+                            'pid' => $v->uid,
+                            'src' => $v->response->path,
+                        ];
+                    }
                 }
             }
+
             $photos['health_code'] = [
                 'title' => '健康码',
                 'id' => 1,
@@ -1008,15 +1011,18 @@ class RecruitController extends Controller
             ];
             $info->trip_code = json_decode($info->trip_code);
             $photo_data = [];
-            foreach ($info->trip_code as $k => $v) {
-                if($v->status){
-                    $photo_data[] = [
-                        'alt' => $v->name,
-                        'pid' => $v->uid,
-                        'src' => $v->response->path,
-                    ];
+            if(is_array($info->trip_code)){
+                foreach ($info->trip_code as $k => $v) {
+                    if($v->status){
+                        $photo_data[] = [
+                            'alt' => $v->name,
+                            'pid' => $v->uid,
+                            'src' => $v->response->path,
+                        ];
+                    }
                 }
             }
+
             $photos['trip_code'] = [
                 'title' => '行程码',
                 'id' => 1,
@@ -1325,7 +1331,7 @@ class RecruitController extends Controller
                 'log' => '健康信息审核未通过,原因是:'.$reason
             ];
             RecruitAppointLog::create($log);
-            $info->h_status = -1;
+            $info->h_status = 0;
             $info->h_msg = $reason;
             $info->save();
             $appointinfo->health_audit = 0;