소스 검색

Merge branch 'master' of http://59.57.98.130:3000/jjhc/jucai

linwu 1 년 전
부모
커밋
e9afa0fcb9
1개의 변경된 파일43개의 추가작업 그리고 15개의 파일을 삭제
  1. 43 15
      app/Admin/Controllers/Recruit/RecruitController.php

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

@@ -274,7 +274,7 @@ class RecruitController extends Controller
             ])->default(1)->help('允许提交审核的次数,直接输入数字即可');
             $form->datetimeRange('supplement_start', 'supplement_end', '材料补登时间');
             $form->radio('pay_switch', '缴费报名')->options([0 => '否', 1 => '是'])->default(0);
-            $form->radio('special_condition_type', '加分条件样式')->options([0 => '手输', 1 => '整场下拉选择',2 => '岗位适配'])->default(0);
+            $form->radio('special_condition_type', '加分条件样式')->options([0 => '手输', 1 => '整场下拉选择',2 => '岗位适配(单选)',3 => '岗位适配(多选)'])->default(0);
             $form->text('special_condition_value', '加分条件值')->default("")->help('如选择岗位适合,此放放空,选择整场下拉选择项请用英文,隔开');
         })->tab('笔试', function ($form) {
             $form->switch('pen_comfirm', '笔试确认')->help("打开后将会在设置时间段内开启笔试确认功能,有且仅当确认了才能打印准考证参加笔试")->default(0)->setMustMark();
@@ -2080,6 +2080,7 @@ class RecruitController extends Controller
     {//TODO 数据太大,无法压缩,得做成异步,现阶段指定导出人员
         Permission::check('recruit_out_excel');
         $recruit_id = $request->id;
+        $realname = $request->realname;
         $recruit = Recruit::find($recruit_id);
         if (empty($recruit)) {
             return response()->json(['status' => 0, 'msg' => '找不到对应的招考场次'], 200);
@@ -2087,9 +2088,10 @@ class RecruitController extends Controller
 
         //$data = $request->all();
         $where = [];
-        $where[] = ['recruit_appoint_info.audit','=',3];
+        //$where[] = ['recruit_appoint_info.audit','=',3];
         $where[] = ['recruit_appoint_info.recruit_id', '=', $recruit_id];
-        $where[] = ['recruit_appoint_info.realname', 'in', ['廖赐艺','吴鑫','庄惠阳','傅承恩','游美','吴维灵','许世芳','林非余','黄其森','徐阳雍','郑金埭','王俊龙','张询','吴晓瑜','王传晔','许宏焱','李焕金','许雅玲','陈月超']];
+        //$where[] = ['recruit_appoint_info.realname', 'in', ['肖思乐','张金铭','黄奖白','何佳鹏','李光祺','陈丽虹','卢江伟']];
+
 //        $param = parse_url($data['where']);
 //        parse_str($param['query'],$param);
 //        if (is_array($param)) {
@@ -2103,7 +2105,12 @@ class RecruitController extends Controller
 //            }
 //        }
         $select = ['recruit_appoint_info.*', 'recruit_post.code', 'recruit_post.name'];
-        $model = RecruitAppointInfo::where($where)->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left')->join('recruit_ticket','recruit_ticket.appoint_id','=','recruit_appoint_info.id','left');
+        if(!empty($realname)){
+            $model = RecruitAppointInfo::where($where)->whereIn('recruit_appoint_info.realname',explode(',',$realname))->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left');
+        }else{
+            $model = RecruitAppointInfo::where($where)->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left');
+        }
+
         if(in_array('expand_special',explode(',', $recruit->forms))){
             $model->join('recruit_appoint_expand_special', 'recruit_appoint_expand_special.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left');
             $special_select = ['recruit_appoint_expand_special.point_apply','recruit_appoint_expand_special.condition','recruit_appoint_expand_special.material'];
@@ -2119,6 +2126,7 @@ class RecruitController extends Controller
             ->orderBy('recruit_appoint_info.updated_at','desc')
             ->get();
 
+
         if(!is_dir(base_path() . "/storage/app/public/recruit/zip")){
             Storage::makeDirectory("public/recruit/zip");
         }
@@ -2138,7 +2146,11 @@ class RecruitController extends Controller
                     $material = json_decode($special['material'],true);
                     if($material){
                         foreach ($material as $k => $v){
-                            $old_path = base_path() . "/public/" . $v['url'];
+                            if(array_key_exists('response',$v) && array_key_exists('path',$v['response'])){
+                                $old_path = base_path() . "/public/" . $v['response']['path'];
+                            }else{
+                                $old_path = base_path() . "/public/" . $v['url'];
+                            }
                             if (file_exists($old_path)) {
                                 $basename = basename($old_path);
                                 $new_path = $path . $basename; //iconv("UTF-8", "GBK", $p->picture_name);
@@ -2151,7 +2163,11 @@ class RecruitController extends Controller
                     $identification = json_decode($value->identification,true);
                     if($identification){
                         foreach ($identification as $k => $v){
-                            $old_path = base_path() . "/public/"  . $v['url'];
+                            if(array_key_exists('response',$v) && array_key_exists('path',$v['response'])){
+                                $old_path = base_path() . "/public/" . $v['response']['path'];
+                            }else{
+                                $old_path = base_path() . "/public/" . $v['url'];
+                            }
                             if (file_exists($old_path)) {
                                 $basename = basename($old_path);
                                 $new_path = $path . $basename; //iconv("UTF-8", "GBK", $p->picture_name);
@@ -2164,7 +2180,11 @@ class RecruitController extends Controller
                     $education_certification = json_decode($value->education_certification,true);
                     if($education_certification){
                         foreach ($education_certification as $k => $v){
-                            $old_path = base_path() . "/public/"  . $v['url'];
+                            if(array_key_exists('response',$v) && array_key_exists('path',$v['response'])){
+                                $old_path = base_path() . "/public/" . $v['response']['path'];
+                            }else{
+                                $old_path = base_path() . "/public/" . $v['url'];
+                            }
                             if (file_exists($old_path)) {
                                 $basename = basename($old_path);
                                 $new_path = $path . $basename; //iconv("UTF-8", "GBK", $p->picture_name);
@@ -2177,7 +2197,11 @@ class RecruitController extends Controller
                     $other_certification = json_decode($value->other_certification,true);
                     if($other_certification){
                         foreach ($other_certification as $k => $v){
-                            $old_path = base_path() . "/public/"  . $v['url'];
+                            if(array_key_exists('response',$v) && array_key_exists('path',$v['response'])){
+                                $old_path = base_path() . "/public/" . $v['response']['path'];
+                            }else{
+                                $old_path = base_path() . "/public/" . $v['url'];
+                            }
                             if (file_exists($old_path)) {
                                 $basename = basename($old_path);
                                 $new_path = $path . $basename; //iconv("UTF-8", "GBK", $p->picture_name);
@@ -2186,6 +2210,9 @@ class RecruitController extends Controller
                         }
                     }
                 }
+                if(empty($value->word_url)){
+                    $value->word_url = $this->fetch_word(['recruit_id'=>$recruit_id,'appoint_id'=>$value->id]);
+                }
                 copy(base_path() . "/public/" . $value->word_url, $path . basename($value->word_url));
             }
 
@@ -2193,15 +2220,16 @@ class RecruitController extends Controller
             $zipper = new Zipper();
             $folder = base_path() . "/storage/app/public/recruit/zip/{$recruit->company}/";//$public_path  被压缩的文件名
             $zipper->make($savename)->add($folder)->close();//public_path($reduce_path)  压缩之后的文件名
-//            header("Content-Type: application/zip");
-//            header("Content-Transfer-Encoding: Binary");
-//            header("Content-Length: " . filesize($savename));
-//            header("Content-Disposition: attachment; filename=\"" . $savename . "\"");
-//
-//            readfile($savename);
-//            exit;
+            header("Content-Type: application/zip");
+            header("Content-Transfer-Encoding: Binary");
+            header("Content-Length: " . filesize($savename));
+            header("Content-Disposition: attachment; filename=\"" . $savename . "\"");
+
+            readfile($savename);
+            exit;
             return response()->json(['status' => 1, 'msg' => "/zip/{$recruit->name}.zip" ], 200);
         }else{
+            echo '没有搜索到相关人员';die;
             return response()->json(['status' => 0, 'msg' => '没有搜索到相关人员'], 200);
         }