0
This commit is contained in:
1 parent
97b3247998
commit
1f00e25024
6 files changed
+37
-28
No files matched your search
@@ -84,12 +84,6 @@ class Kaohao extends BaseController
|
||||
return ['msg'=>'考试已经结束,不能分配考号','val'=>0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 将班级转换成数组
|
||||
$list['banjiids'] = implode(',',$list['banjiids']);
|
||||
$ksid = $list['kaoshi'];
|
||||
|
||||
// 获取实例化学生数据模型
|
||||
$stu = new \app\renshi\model\Student;
|
||||
// 获取参加考试学生名单
|
||||
@@ -103,6 +97,7 @@ class Kaohao extends BaseController
|
||||
}
|
||||
])
|
||||
->select();
|
||||
|
||||
$njlist = nianjiList();
|
||||
// 重新组合学生信息
|
||||
$kaohao = array();
|
||||
@@ -298,7 +293,7 @@ class Kaohao extends BaseController
|
||||
'webtitle'=>'下载考号',
|
||||
'butname'=>'下载',
|
||||
'formpost'=>'POST',
|
||||
'url'=>'/kaoshi/'.$kaoshi.'/biaoqianXls',
|
||||
'url'=>'/kaoshi/kaohao/biaoqianxls',
|
||||
'kaoshi'=>$kaoshi
|
||||
);
|
||||
|
||||
@@ -348,6 +343,7 @@ class Kaohao extends BaseController
|
||||
])
|
||||
->find();
|
||||
|
||||
|
||||
$kh = new KH();
|
||||
// 获取考试信息
|
||||
$kaohao = $kh->srcKaohao($kaoshi,$banji);
|
||||
@@ -366,21 +362,33 @@ class Kaohao extends BaseController
|
||||
$sheet->setCellValue('F1', '姓名');
|
||||
|
||||
|
||||
// 实例化系统设置类
|
||||
$md5 = new \app\system\controller\Encrypt;
|
||||
|
||||
|
||||
|
||||
// 循环写出信息
|
||||
$i = 2;
|
||||
foreach ($kaohao as $key=>$bj)
|
||||
{
|
||||
foreach ($kslist->ks_subject as $ksbj => $sbj)
|
||||
|
||||
foreach ($kslist->ksSubject as $ksbj => $sbj)
|
||||
{
|
||||
foreach ($bj->banji_kaohao as $kkh => $kh)
|
||||
|
||||
// halt($obj);
|
||||
|
||||
|
||||
foreach ($bj->banjiKaohao as $kkh => $kh)
|
||||
{
|
||||
// 表格赋值
|
||||
$sheet->setCellValue('A'.$i, $i-1);
|
||||
$sheet->setCellValue('B'.$i, action('system/Encrypt/encrypt',['data'=>$kh->id.'|'.$sbj->subject_name->id,'key'=>'dlbz']));
|
||||
$sheet->setCellValue('C'.$i, $bj->cj_school->jiancheng);
|
||||
$sheet->setCellValue('D'.$i, $bj->cj_banji->numTitle);
|
||||
$stuKaohao = '';
|
||||
$stuKaohao = $md5->encrypt($kh->id.'|'.$sbj->subject_name->id,'dlbz');
|
||||
$sheet->setCellValue('C'.$i, $bj->cjSchool->jiancheng);
|
||||
$sheet->setCellValue('B'.$i, $stuKaohao);
|
||||
$sheet->setCellValue('D'.$i, $bj->cjBanji->numTitle);
|
||||
$sheet->setCellValue('E'.$i, $sbj->subject_name->jiancheng);
|
||||
$sheet->setCellValue('F'.$i, $kh->cj_student['xingming']);
|
||||
$sheet->setCellValue('F'.$i, $kh->cjStudent['xingming']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@@ -393,8 +401,8 @@ class Kaohao extends BaseController
|
||||
header('Cache-Control: max-age=0');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
|
||||
$writer->save('php://output');
|
||||
ob_flush();
|
||||
flush();
|
||||
// ob_flush();
|
||||
// flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class Kaohao extends Base
|
||||
// 获取考试标签
|
||||
$data = $this->where('kaoshi',$kaoshi)
|
||||
->where('banji','in',$banji)
|
||||
->field('id,banji,school')
|
||||
->field('banji')
|
||||
->order(['banji'])
|
||||
->group('banji')
|
||||
->with([
|
||||
@@ -44,17 +44,18 @@ class Kaohao extends Base
|
||||
])
|
||||
->select();
|
||||
|
||||
|
||||
$stu = new \app\renshi\model\Student;
|
||||
// 找出已经被删除学生,并添加该学生信息
|
||||
foreach ($data as $key => $value) {
|
||||
foreach ($value->banji_kaohao as $k => $val) {
|
||||
if($val->cj_student == Null)
|
||||
foreach ($value->banjiKaohao as $k => $val) {
|
||||
if($val->cjStudent == Null)
|
||||
{
|
||||
$stuinof = $stu::withTrashed()
|
||||
->where('id',$val->student)
|
||||
->field('id,xingming')
|
||||
->find();
|
||||
$data[$key]->banji_kaohao[$key]->cj_student = array('id'=>$stuinof->id,'xingming'=>$stuinof->xingming);
|
||||
$data[$key]->banjiKaohao[$key]->cjStudent = array('id'=>$stuinof->id,'xingming'=>$stuinof->xingming);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +127,7 @@ class Kaohao extends Base
|
||||
,'cjBanji'=>function($query){
|
||||
$query->field('id,paixu,ruxuenian');
|
||||
}
|
||||
,'cjSchool'=>function($query){
|
||||
,'cySchool'=>function($query){
|
||||
$query->field('id,jiancheng');
|
||||
}
|
||||
,'cjStudent'=>function($query){
|
||||
|
||||
@@ -50,6 +50,8 @@ Route::group('index', function () {
|
||||
Route::group('kaohao', function () {
|
||||
Route::rule('create/<kaoshi>','Kaohao/create','get'); # 信息列表
|
||||
Route::rule('save','Kaohao/save','post'); # 保存信息
|
||||
Route::rule('biaoqian/<kaoshi>','Kaohao/biaoqian','get'); # 信息列表
|
||||
Route::rule('biaoqianxls','Kaohao/biaoqianXls','post'); # 信息列表
|
||||
// Route::rule('read/<id>','Kaohao/read','get'); # 读取信息
|
||||
// Route::rule('edit/<id>','Kaohao/edit','get'); # 修改信息
|
||||
// Route::rule('update/<id>','Kaohao/update','put'); # 更新信息
|
||||
|
||||
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user