Browse Source

开启材料补登功能

sandm 2 năm trước cách đây
mục cha
commit
8892e292fb
1 tập tin đã thay đổi với 38 bổ sung29 xóa
  1. 38 29
      app/Admin/Controllers/Recruit/RecruitController.php

+ 38 - 29
app/Admin/Controllers/Recruit/RecruitController.php

@@ -894,7 +894,7 @@ class RecruitController extends Controller
         Permission::check('recruit_ajax_supplement');
         $ids = $request->ids;
         $view_data['ids'] = $ids;
-        $info = RecruitSupplement::where('appoint_id',$ids)->first();
+        $info = RecruitSupplement::where('appoint_id',$ids)->where('type','supplement')->first();
         if(!$info){
             $view_data['switch'] = 0;
         }else{
@@ -908,13 +908,15 @@ class RecruitController extends Controller
             ];
             $info->identification = json_decode($info->identification);
             $photo_data = [];
-            foreach ($info->identification as $k => $v) {
-                if($v->status){
-                    $photo_data[] = [
-                        'alt' => $v->name,
-                        'pid' => $v->uid,
-                        'src' => $v->response->path,
-                    ];
+            if(is_array($info->identification)){
+                foreach ($info->identification as $k => $v) {
+                    if($v->status){
+                        $photo_data[] = [
+                            'alt' => $v->name,
+                            'pid' => $v->uid,
+                            'src' => $v->response->path,
+                        ];
+                    }
                 }
             }
             $photos['identification'] = [
@@ -925,13 +927,15 @@ class RecruitController extends Controller
             ];
             $info->household_register = json_decode($info->household_register);
             $photo_data = [];
-            foreach ($info->household_register as $k => $v) {
-                if($v->status){
-                    $photo_data[] = [
-                        'alt' => $v->name,
-                        'pid' => $v->uid,
-                        'src' => $v->response->path,
-                    ];
+            if(is_array($info->household_register)){
+                foreach ($info->household_register as $k => $v) {
+                    if($v->status){
+                        $photo_data[] = [
+                            'alt' => $v->name,
+                            'pid' => $v->uid,
+                            'src' => $v->response->path,
+                        ];
+                    }
                 }
             }
             $photos['household_register'] = [
@@ -942,13 +946,15 @@ class RecruitController extends Controller
             ];
             $info->education_certification = json_decode($info->education_certification);
             $photo_data = [];
-            foreach ($info->education_certification as $k => $v) {
-                if($v->status){
-                    $photo_data[] = [
-                        'alt' => $v->name,
-                        'pid' => $v->uid,
-                        'src' => $v->response->path,
-                    ];
+            if(is_array($info->education_certification)){
+                foreach ($info->education_certification as $k => $v) {
+                    if($v->status){
+                        $photo_data[] = [
+                            'alt' => $v->name,
+                            'pid' => $v->uid,
+                            'src' => $v->response->path,
+                        ];
+                    }
                 }
             }
             $photos['education_certification'] = [
@@ -976,15 +982,18 @@ class RecruitController extends Controller
 //            ];
             $info->manage = json_decode($info->manage);
             $photo_data = [];
-            foreach ($info->manage as $k => $v) {
-                if($v->status){
-                    $photo_data[] = [
-                        'alt' => $v->name,
-                        'pid' => $v->uid,
-                        'src' => $v->response->path,
-                    ];
+            if(is_array($info->manage)){
+                foreach ($info->manage as $k => $v) {
+                    if($v->status){
+                        $photo_data[] = [
+                            'alt' => $v->name,
+                            'pid' => $v->uid,
+                            'src' => $v->response->path,
+                        ];
+                    }
                 }
             }
+
             $photos['manage'] = [
                 'title' => '综治证明',
                 'id' => 1,