| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 | 
							- <?php
 
- namespace app\admin\controller;
 
- use app\admin\AdminBaseController;
 
- use app\common\model\OfficerAnswerModel;
 
- use app\common\model\OfficerReviewModel;
 
- use app\common\service\QrcodeService;
 
- class Officer extends AdminBaseController
 
- {
 
-     public function index()
 
-     {
 
-         return view();
 
-     }
 
-     public function listOfficer()
 
-     {
 
-         $list  = OfficerReviewModel::limit(input('limit'))
 
-             ->page(input('page'))
 
-             ->select();
 
-         $count = OfficerReviewModel::count();
 
-         if ($count == 0) {
 
-             ajax_return(1, '未查询到数据');
 
-         }
 
-         foreach ($list as $v) {
 
-             $v['name'] = strip_tags($v['name']);
 
-         }
 
-         list_return($list, $count);
 
-     }
 
-     /**
 
-      * 列表
 
-      */
 
-     public function detail()
 
-     {
 
-         $id = input('id');
 
-         if (empty($id)) {
 
-             return '该测评不存在';
 
-         }
 
-         return view('', ['id' => $id]);
 
-     }
 
-     public function listDetail()
 
-     {
 
-         $id    = input('id', 0);
 
-         $list  = OfficerAnswerModel::where('rid', $id)
 
-             ->where('status', 2)
 
-             ->order('id', 'desc')
 
-             ->limit(input('limit'))
 
-             ->page(input('page'))
 
-             ->append(['status_text'])
 
-             ->select();
 
-         $count = OfficerAnswerModel::where('rid', $id)
 
-             ->where('status', 2)
 
-             ->count();
 
-         if ($count == 0) {
 
-             ajax_return(1, '未查询到数据');
 
-         }
 
-         list_return($list, $count);
 
-     }
 
-     public function export()
 
-     {
 
-         $id   = input('id', 0);
 
-         $list = OfficerAnswerModel::with(['detail'])
 
-             ->where('rid', $id)
 
-             ->where('status', 2)
 
-             ->order('id', 'desc')
 
-             ->append(['status_text'])
 
-             ->select();
 
-         if ($list->isEmpty()) {
 
-             return '暂无人答题';
 
-         }
 
-         $xlsCell = [
 
-             ['name', '姓名'],
 
-             ['sex', '性别'],
 
-             ['age', '年龄'],
 
-             ['current_position', '当前岗位'],
 
-             ['education', '学历'],
 
-             ['major', '专业'],
 
-             ['seniority', '工龄'],
 
-             ['leader', '担任领导的累计年限'],
 
-             ['industry', '所在行业'],
 
-             ['company', '所在单位'],
 
-             ['job', '职位'],
 
-         ];
 
-         $res = [];
 
-         foreach ($list as $ak => $answer) {
 
-             $item                     = [];
 
-             $item['name']             = $answer['name'];
 
-             $item['sex']              = $answer['sex'];
 
-             $item['age']              = $answer['age'];
 
-             $item['current_position'] = $answer['current_position'];
 
-             $item['education']        = $answer['education'];
 
-             $item['major']            = $answer['major'];
 
-             $item['seniority']        = $answer['seniority'];
 
-             $item['leader']           = $answer['leader'];
 
-             $item['industry']         = $answer['industry'];
 
-             if (empty($answer['company_text'])) {
 
-                 $item['company'] = $answer['company'];
 
-             } else {
 
-                 $item['company'] = $answer['company'] . "({$answer['company_text']})";
 
-             }
 
-             if (empty($answer['job_text'])) {
 
-                 $item['job'] = $answer['job'];
 
-             } else {
 
-                 $item['job'] = $answer['job'] . "({$answer['job_text']})";
 
-             }
 
-             foreach ($answer['detail'] as $k => $v) {
 
-                 $index = 'item_' . $v['no'];
 
-                 if ($ak == 0) {
 
-                     $xlsCell[] = [$index, $index];
 
-                 }
 
-                 $item[$index] = $v['score'];
 
-             }
 
-             $res[] = $item;
 
-         }
 
- //        $xlsCell = array_merge($xlsCell, [
 
- //            ['name', '姓名'],
 
- //            ['mobile', '手机号'],
 
- //            ['sex', '性别'],
 
- //            ['age', '年龄'],
 
- //            ['marry', '婚姻状况'],
 
- //            ['education', '学历'],
 
- //            ['major', '专业'],
 
- //            ['seniority', '工龄'],
 
- //            ['leader', '担任领导的累计年限'],
 
- //            ['industry', '所在行业'],
 
- //            ['company', '所在单位'],
 
- //            ['job', '职位'],]);
 
-         export_exl("考试明细", $xlsCell, $res);
 
-     }
 
-     /**
 
-      * 二维码
 
-      */
 
-     public function qrcode()
 
-     {
 
-         $id = input('id/d', 0);
 
-         $file_name = "/officer_{$id}.png";
 
-         $link      = url('/mobile/officer/index') . '?id=' . $id;
 
-         $file_url  = QrcodeService::getQrcode($file_name, $link, 600);
 
-         ajax_return(0, '', $file_url);
 
-     }
 
- }
 
 
  |