|
@@ -106,4 +106,100 @@ class Dashboard extends Backend |
|
@@ -106,4 +106,100 @@ class Dashboard extends Backend |
106
|
return $this->view->fetch();
|
106
|
return $this->view->fetch();
|
107
|
}
|
107
|
}
|
108
|
|
108
|
|
|
|
109
|
+
|
|
|
110
|
+
|
|
|
111
|
+ public function out(){
|
|
|
112
|
+
|
|
|
113
|
+ $result = Db::name('applet_user')->field('id,name,mobile,colleges')->order('id desc')->select();
|
|
|
114
|
+
|
|
|
115
|
+ $filename = "用户测评数据";
|
|
|
116
|
+ vendor('PHPExcel.PHPExcel');
|
|
|
117
|
+ $objPHPExcel = new \PHPExcel();
|
|
|
118
|
+ //设置保存版本格式
|
|
|
119
|
+ $objWriter = new \PHPExcel_Writer_Excel5($objPHPExcel);
|
|
|
120
|
+
|
|
|
121
|
+ //设置表头
|
|
|
122
|
+ $objPHPExcel->getActiveSheet()->setCellValue('A1','id');
|
|
|
123
|
+ $objPHPExcel->getActiveSheet()->setCellValue('B1','姓名');
|
|
|
124
|
+ $objPHPExcel->getActiveSheet()->setCellValue('C1','手机');
|
|
|
125
|
+ $objPHPExcel->getActiveSheet()->setCellValue('D1','意向院校');
|
|
|
126
|
+ $objPHPExcel->getActiveSheet()->setCellValue('E1','测评分值');
|
|
|
127
|
+ $objPHPExcel->getActiveSheet()->setCellValue('F1','学历背景得分');
|
|
|
128
|
+ $objPHPExcel->getActiveSheet()->setCellValue('G1','企业背景得分');
|
|
|
129
|
+ $objPHPExcel->getActiveSheet()->setCellValue('H1','收入水平得分');
|
|
|
130
|
+ $objPHPExcel->getActiveSheet()->setCellValue('I1','发展潜力得分');
|
|
|
131
|
+ $objPHPExcel->getActiveSheet()->setCellValue('J1','管理经验得分');
|
|
|
132
|
+ $objPHPExcel->getActiveSheet()->setCellValue('K1','英语水平得分');
|
|
|
133
|
+ $objPHPExcel->getActiveSheet()->setCellValue('L1','背景优势');
|
|
|
134
|
+ $objPHPExcel->getActiveSheet()->setCellValue('M1','背景劣势');
|
|
|
135
|
+ $objPHPExcel->getActiveSheet()->setCellValue('N1','匹配院校');
|
|
|
136
|
+
|
|
|
137
|
+ //改变此处设置的长度数值
|
|
|
138
|
+ $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10);
|
|
|
139
|
+ $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12);
|
|
|
140
|
+ //输出表格
|
|
|
141
|
+ $str = '用户未进行测评';
|
|
|
142
|
+ foreach ($result as $key => &$val) {
|
|
|
143
|
+
|
|
|
144
|
+ $count = Db::name('applet_answer')->where(['uid'=>$val['id'],'isdelete'=>0])->count();
|
|
|
145
|
+ $i=$key+2;//表格是从2开始的
|
|
|
146
|
+ if ($count>=1){
|
|
|
147
|
+
|
|
|
148
|
+ $row = SubjectService::getResult($val['id'],'');//score--1学历背景 2企业背景 3收入水平 4发展潜力 5管理经验 6英语水平
|
|
|
149
|
+
|
|
|
150
|
+ //优势
|
|
|
151
|
+ $advan = $row['advan'] ? implode('、',$row['advan']) : '暂无优势';
|
|
|
152
|
+
|
|
|
153
|
+ $inferi = $row['inferi'] ? implode('、',$row['inferi']) : '暂无劣势';
|
|
|
154
|
+
|
|
|
155
|
+ $colllist = $row['colllist'] ? implode('、',array_column($row['colllist'],'title')) : '无匹配院校';
|
|
|
156
|
+
|
|
|
157
|
+ //$score = Db::name('applet_answer')->where(['uid'=>$val['id'],'isdelete'=>0])->sum('score');
|
|
|
158
|
+
|
|
|
159
|
+ //dump($row);exit();
|
|
|
160
|
+ $objPHPExcel->getActiveSheet()->setCellValue('A'.$i,$val['id']);
|
|
|
161
|
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.$i,$val['name']);
|
|
|
162
|
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.$i,$val['mobile']);
|
|
|
163
|
+ $objPHPExcel->getActiveSheet()->setCellValue('D'.$i,$val['colleges']);
|
|
|
164
|
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.$i,$row['totalscore']);
|
|
|
165
|
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.$i,$row['score'][0]);
|
|
|
166
|
+ $objPHPExcel->getActiveSheet()->setCellValue('G'.$i,$row['score'][1]);
|
|
|
167
|
+ $objPHPExcel->getActiveSheet()->setCellValue('H'.$i,$row['score'][2]);
|
|
|
168
|
+ $objPHPExcel->getActiveSheet()->setCellValue('I'.$i,$row['score'][3]);
|
|
|
169
|
+ $objPHPExcel->getActiveSheet()->setCellValue('J'.$i,$row['score'][4]);
|
|
|
170
|
+ $objPHPExcel->getActiveSheet()->setCellValue('K'.$i,$row['score'][5]);
|
|
|
171
|
+ $objPHPExcel->getActiveSheet()->setCellValue('L'.$i,$advan);
|
|
|
172
|
+ $objPHPExcel->getActiveSheet()->setCellValue('M'.$i,$inferi);
|
|
|
173
|
+ $objPHPExcel->getActiveSheet()->setCellValue('N'.$i,$colllist);
|
|
|
174
|
+ }
|
|
|
175
|
+ else{
|
|
|
176
|
+ $objPHPExcel->getActiveSheet()->setCellValue('A'.$i,$val['id']);
|
|
|
177
|
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.$i,$val['name']);
|
|
|
178
|
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.$i,$val['mobile']);
|
|
|
179
|
+ $objPHPExcel->getActiveSheet()->setCellValue('D'.$i,$val['colleges']);
|
|
|
180
|
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.$i,$str);
|
|
|
181
|
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.$i,$str);
|
|
|
182
|
+ $objPHPExcel->getActiveSheet()->setCellValue('G'.$i,$str);
|
|
|
183
|
+ $objPHPExcel->getActiveSheet()->setCellValue('H'.$i,$str);
|
|
|
184
|
+ $objPHPExcel->getActiveSheet()->setCellValue('I'.$i,$str);
|
|
|
185
|
+ $objPHPExcel->getActiveSheet()->setCellValue('J'.$i,$str);
|
|
|
186
|
+ $objPHPExcel->getActiveSheet()->setCellValue('K'.$i,$str);
|
|
|
187
|
+ $objPHPExcel->getActiveSheet()->setCellValue('L'.$i,$str);
|
|
|
188
|
+ $objPHPExcel->getActiveSheet()->setCellValue('M'.$i,$str);
|
|
|
189
|
+ $objPHPExcel->getActiveSheet()->setCellValue('N'.$i,$str);
|
|
|
190
|
+ }
|
|
|
191
|
+
|
|
|
192
|
+ }
|
|
|
193
|
+ header("Pragma: public");
|
|
|
194
|
+ header("Expires: 0");
|
|
|
195
|
+ header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
|
|
|
196
|
+ header("Content-Type:application/force-download");
|
|
|
197
|
+ header("Content-Type:application/vnd.ms-execl");
|
|
|
198
|
+ header("Content-Type:application/octet-stream");
|
|
|
199
|
+ header("Content-Type:application/download");
|
|
|
200
|
+ header('Content-Disposition:attachment;filename='.$filename.'.xls');
|
|
|
201
|
+ header("Content-Transfer-Encoding:binary");
|
|
|
202
|
+ $objWriter->save('php://output');
|
|
|
203
|
+ }
|
|
|
204
|
+
|
109
|
} |
205
|
} |