smsService = $smsService; } public function yqfk() { return view("app.talent.jjhc.yqfk"); } public function chaxun(Request $request) { $data = array('msg'=>'查无此用户!','status' => 0); return response()->json($data); $info = DB::connection('fangyi')->table('fillinfo') ->where(['lxdh'=>$request->tel])->first(); if($info){ $data = array('status'=>1,'msg'=>'查到已存在数据!','info'=>$info); }else{ $data = array('msg'=>'查无此用户!','status' => 0); } return response()->json($data); } public function test(Request $request) { $keyword = $request->input('keyword'); if($keyword != "j0vOW5mBREZxdo3P"){ throw new ResponseException("who are you?", [], 404); } for ($room = 1;$room <= 78; $room++){ $list = DB::table("recruit_ticket")->leftJoin("recruit_appoint_info","recruit_ticket.appoint_id",'=','recruit_appoint_info.id')->where("recruit_ticket.ex_start",'2022-08-05 08:00:00')->where('recruit_ticket.ex_room',$room)->orderBy('ex_seat','ASC')->get()->toArray(); $objPHPExcel = IOFactory::load(base_path() . "/public/cunwu.xlsx"); $sheet = $objPHPExcel->getActiveSheet(); $row = 4; $sheet->setCellValue('A1', "晋江市公开招聘第十三批村务(社区)专职工作者笔试参考情况一览表(第".intval($room)."考场)"); foreach ($list as $k => $v){ $sheet->setCellValueByColumnAndRow('1',$row, $v->ex_seat); $sheet->setCellValueByColumnAndRow('2',$row, $v->realname); $sheet->setCellValueExplicitByColumnAndRow('3',$row, $v->ex_number,DataType::TYPE_STRING); $row++; } $writer = IOFactory::createWriter($objPHPExcel, 'Xlsx'); $writer->save(base_path() . "/public/excel/cunwu{$room}.xlsx"); } // for ($room = 1;$room <= 78; $room++){ // $word = new TemplateProcessor(base_path() . "/public/cunwu.docx"); // $word->setValue('room', $room); // if($room<10){ // $room = sprintf('%02s', $room); // } // $list = DB::table("recruit_ticket")->leftJoin("recruit_appoint_info","recruit_ticket.appoint_id",'=','recruit_appoint_info.id')->where("recruit_ticket.ex_start",'2022-08-05 08:00:00')->where('recruit_ticket.ex_room',$room)->orderBy('ex_seat','ASC')->get()->toArray(); // $rows = count($list);//总行数 // $word->cloneRow('id', $rows);//复制行 // for ($i = 0; $i < $rows; $i++) { // $word->setValue("id#" . ($i + 1), $i + 1);//替换变量 // $word->setValue("realname#" . ($i + 1), $list[$i]->realname); // $word->setValue("ex_number#" . ($i + 1), $list[$i]->ex_number); // $word->setValue("ex_seat#" . ($i + 1), $list[$i]->ex_seat); // } // $word->saveAs(base_path() ."/public/excel/cunwu{$room}.docx");//另存为 // } // $spreadsheet = new Spreadsheet(); // $sheet = $spreadsheet->getActiveSheet(); // $header = ['姓名','身份证','准考证','报考岗位']; // foreach ($header as $key => $value) { // $sheet->setCellValueByColumnAndRow($key+1, 1, $value); // } // $row = 2; // $sheet->getStyle('S')->getNumberFormat()->setFormatCode('0'); // $list = DB::table("recruit_ticket")->leftJoin("recruit_appoint_info","recruit_ticket.appoint_id",'=','recruit_appoint_info.id')->where("recruit_appoint_info.recruit_id",'16')->orderBy('recruit_appoint_info.post_id','ASC')->orderBy('recruit_appoint_info.id','ASC')->get()->toArray(); // $post_data = RecruitPost::where('recruit_id',16)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id'); // foreach ($list as $k => $v){ // $sheet->setCellValueByColumnAndRow('1',$row, $v->realname); // $sheet->setCellValueExplicitByColumnAndRow('2',$row, $v->card,DataType::TYPE_STRING); // $sheet->setCellValueExplicitByColumnAndRow('3',$row, $v->ex_number,DataType::TYPE_STRING); // $sheet->setCellValueByColumnAndRow('4',$row, $post_data[$v->post_id]); // $row++; // } // header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); // header('Content-Disposition: attachment;filename="'.time().'.xlsx"'); // header('Cache-Control: max-age=0'); // // If you're serving to IE 9, then the following may be needed // header('Cache-Control: max-age=1'); // // If you're serving to IE over SSL, then the following may be needed // header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past // header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified // header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 // header('Pragma: public'); // HTTP/1.0 // $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); // $writer->save('php://output'); echo "success"; // $list = DB::table('lt_apppointment')->distinct()->pluck('card')->toArray(); // $all = DB::table('lt_apppointment')->pluck('card')->toArray(); // $all = array_count_values($all); // $time = time(); // $data = [ // 'idCards' => $list, // 'sign' => strtoupper(md5("timestr={$time}&key=rsKVyec52fqEKpk4RRD2TU8fKvPxt6ombKg0qSq1velPQtBHVi")), // 'timeStr' => $time, // ]; // $data_string = json_encode($data); // $ch = curl_init (); // curl_setopt( $ch, CURLOPT_URL, "http://rc.jucai.gov.cn/api/dataInterface/findTalentInfoByIdCards" ); // curl_setopt($ch, CURLOPT_HTTPHEADER, array( // 'Content-Type: application/json', // 'Content-Length: ' . strlen($data_string)) // ); // curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); //若果报错 name lookup timed out 报错时添加这一行代码 // curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // curl_setopt( $ch, CURLOPT_TIMEOUT,60); // curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0); // curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0); // curl_setopt( $ch, CURLOPT_POST, 1); // curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); // $result = curl_exec ( $ch ); // curl_close ( $ch ); // $ret = json_decode($result,true); // $res = []; // if(count($ret['obj']) > 0){ // foreach ($ret['obj'] as $k => $v){ // if(array_key_exists($v['street'],$res)){ // $res[$v['street']]['number']++; // $res[$v['street']]['count'] += $all[$v['idCard']]; // }else{ // $res[$v['street']] = [ // 'number' => 1, // 'count' => $all[$v['idCard']] // ]; // } // } // } // // $spreadsheet = new Spreadsheet(); // $sheet = $spreadsheet->getActiveSheet(); // $header = ['镇街','使用人数','使用次数']; // foreach ($header as $key => $value) { // $sheet->setCellValueByColumnAndRow($key+1, 1, $value); // } // $row = 2; // foreach ($res as $k => $v){ // $sheet->setCellValueByColumnAndRow(1, $row, $k); // $sheet->setCellValueByColumnAndRow(2, $row, $v['number']); // $sheet->setCellValueByColumnAndRow(3, $row, $v['count']); // $row++; // } // $file_name = date("Y-m-d",time()) . '码上服务数据'; // header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); // header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"'); // header('Cache-Control: max-age=0'); // // If you're serving to IE 9, then the following may be needed // header('Cache-Control: max-age=1'); // // If you're serving to IE over SSL, then the following may be needed // header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past // header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified // header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 // header('Pragma: public'); // HTTP/1.0 // $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); // $writer->save('php://output'); // // //dd($res); } }