|
@@ -2403,11 +2403,48 @@ class RecruitController extends Controller
|
|
|
|
|
|
public function test(Request $request){
|
|
|
|
|
|
- $list = RecruitAppointInfo::where('recruit_id',7)->where('audit',3)->get();
|
|
|
+ $list = RecruitSupplement::where('recruit_supplement.status',1)
|
|
|
+ ->join('recruit_appoint_info', 'recruit_supplement.appoint_id', '=' , 'recruit_appoint_info.id', 'left')
|
|
|
+ ->select('recruit_appoint_info.*')
|
|
|
+ ->get();
|
|
|
+
|
|
|
+
|
|
|
+ $post_data = RecruitPost::where('recruit_id',5)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
|
|
|
+
|
|
|
+ $header = ['姓名','性别','年龄','联系电话','身份证号码','岗位'];
|
|
|
+
|
|
|
+ $spreadsheet = new Spreadsheet();
|
|
|
+ $sheet = $spreadsheet->getActiveSheet();
|
|
|
+
|
|
|
+ foreach ($header as $key => $value) {
|
|
|
+ $sheet->setCellValueByColumnAndRow($key+1, 1, $value);
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach($list as $k => $v){
|
|
|
+ $sheet->setCellValueByColumnAndRow(1, $k+2, $v->realname);
|
|
|
+ $sheet->setCellValueByColumnAndRow(2, $k+2, $v->sex == 0 ? '女' : '男');
|
|
|
+ $time = explode('-',$v->birthday);
|
|
|
+ $sheet->setCellValueByColumnAndRow(3, $k+2, 2021-$time[0]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(4, $k+2, $v->mobile);
|
|
|
+ $sheet->setCellValueExplicitByColumnAndRow(5, $k+2, $v->card, DataType::TYPE_STRING);
|
|
|
+ $sheet->setCellValueByColumnAndRow(6, $k+2, $post_data[$v->post_id]);
|
|
|
|
|
|
- foreach ($list as $k => $v){
|
|
|
- $this->fetch_word_internship(['recruit_id'=>7,'appoint_id'=>$v->id]);
|
|
|
}
|
|
|
+ $file_name = '名单';
|
|
|
+ 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($list);
|
|
|
|
|
|
// $ids = [6,7,121,47,181,66,108,138,21,212,177,130,114,27,63,31,51];
|
|
|
// $data = RecruitAppointInfo::whereIn('id',$ids)->get();
|