diff --git a/app/kaohao/controller/Index.php b/app/kaohao/controller/Index.php index 6bed1f61..9abef00e 100755 --- a/app/kaohao/controller/Index.php +++ b/app/kaohao/controller/Index.php @@ -85,7 +85,7 @@ class Index extends AdminBase ->where('kaoshi_id', $list['kaoshi_id']) ->where('student_id', $value->id) ->find(); - if($check) + if($check) # 恢复后学生还是原来的班级,删除后重新添加可能会出错 { if($check->delete_time > 0) { diff --git a/app/kaohao/model/SearchMore.php b/app/kaohao/model/SearchMore.php index 7200e326..e3c1ddb7 100755 --- a/app/kaohao/model/SearchMore.php +++ b/app/kaohao/model/SearchMore.php @@ -243,7 +243,7 @@ class SearchMore extends BaseModel ->order(['banji_id', 'id']) ->with([ 'cjStudent' => function($q){ - $q->field('id, xingming, sex'); + $q->field('id, xingming, sex, shoupin'); } ]); } @@ -261,8 +261,9 @@ class SearchMore extends BaseModel ->where('id', $val->student_id) ->field('id, xingming') ->find(); - $data[$key]->banjiKaohao[$key]->cjStudent = array('id' => $stuinof->id, 'xingming' => $stuinof->xingming); + $data[$key]->banjiKaohao[$key]->cjStudent = array('id' => $stuinof->id, 'shoupin' => $stuinof->shoupin); } + $data[$key]['banjiKaohao'][$k]['shoupin'] = $val['cjStudent']['shoupin']; } } return $data; diff --git a/app/luru/controller/Index.php b/app/luru/controller/Index.php index 224d5655..b9827cd7 100755 --- a/app/luru/controller/Index.php +++ b/app/luru/controller/Index.php @@ -481,11 +481,10 @@ class Index extends AdminBase $i = 4; foreach ($kaohao as $key=>$bj) { - foreach ($bj->banjiKaohao as $k => $kh) { + $bjkh = $bj->banjiKaohao->toArray(); + $bjkh = sortArrByManyField($bjkh, 'shoupin', SORT_ASC); + foreach ($bjkh as $k => $kh) { $sheet->setCellValue('A' . $i, $i - 3); - $sheet->setCellValue('B' . $i, $md5::encrypt((string)$kh->id, 'dlbz')); - $sheet->setCellValue('C' . $i, $bj->banjiTitle); - $sheet->setCellValue('D' . $i, $kh->cjStudent['xingming']); // if(isset($kh->cjStudent->xingming)) // { // $sheet->setCellValue('D' . $i, $kh->cjStudent->xingming); @@ -493,6 +492,9 @@ class Index extends AdminBase // halt($kh->toArray()); // $sheet->setCellValue('D' . $i, '学生已经被删除'); // } + $sheet->setCellValue('B' . $i, $md5::encrypt((string)$kh['id'], 'dlbz')); + $sheet->setCellValue('C' . $i, $bj['banjiTitle']); + $sheet->setCellValue('D' . $i, $kh['cjStudent']['xingming']); $i ++; } diff --git a/database/seeds/Student.php b/database/seeds/Student.php index 305c3880..9e4fd38d 100644 --- a/database/seeds/Student.php +++ b/database/seeds/Student.php @@ -22,6 +22,7 @@ class Student extends Seeder ,'shengri' => 1349020800 ,'shenfenzhenghao' => '210202201210018223' ,'banji_id' => 1 + ,'shoupin' => 'yn' ] ,[ 'xingming' => '李倍亮' @@ -29,6 +30,7 @@ class Student extends Seeder ,'shengri' => 1349020800 ,'shenfenzhenghao' => '210202201210018214' ,'banji_id' => 1 + ,'shoupin' => 'lbl' ] ,[ 'xingming' => '张又张' @@ -36,6 +38,7 @@ class Student extends Seeder ,'shengri' => 1349020800 ,'shenfenzhenghao' => '210202201210018255' ,'banji_id' => 1 + ,'shoupin' => 'zyz' ] ,[ 'xingming' => '王小天' @@ -43,6 +46,7 @@ class Student extends Seeder ,'shengri' => 1349020800 ,'shenfenzhenghao' => '210202201210018236' ,'banji_id' => 1 + ,'shoupin' => 'wxt' ] ,[ 'xingming' => '张一凡' @@ -50,6 +54,7 @@ class Student extends Seeder ,'shengri' => 1349020800 ,'shenfenzhenghao' => '210202201210018227' ,'banji_id' => 1 + ,'shoupin' => 'zyf' ] ,[ 'xingming' => '成乐园' @@ -57,6 +62,7 @@ class Student extends Seeder ,'shengri' => 1349020800 ,'shenfenzhenghao' => '210202201210018218' ,'banji_id' => 1 + ,'shoupin' => 'cly' ] ]; @@ -70,4 +76,4 @@ class Student extends Seeder // 保存数据 $this->table('student')->insert($rows)->save(); } -} \ No newline at end of file +}