From fce6e82c6707b6d712f6499705a3e009815f2d72 Mon Sep 17 00:00:00 2001 From: win7 Date: Thu, 26 Dec 2019 13:49:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD=E7=8F=AD?= =?UTF-8?q?=E7=BA=A7=E6=88=90=E7=BB=A9=E7=BB=9F=E8=AE=A1=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/controller/Bjtongji.php | 5 +++-- app/chengji/model/Bjtongji.php | 2 ++ app/kaoshi/model/Kaohao.php | 8 +++++++- app/teach/model/Banji.php | 26 +++++++++++++++++++++++++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php index 1e4a0da0..bb6d187d 100644 --- a/app/chengji/controller/Bjtongji.php +++ b/app/chengji/controller/Bjtongji.php @@ -134,6 +134,7 @@ class Bjtongji extends BaseController // $src['banji']= array_column($kh->cyBanji($src), 'id'); $src['banji']= $kh->cyBanji($src); + // 统计成绩 $btj = new BTJ; $data = $btj->tjBanji($src); @@ -189,7 +190,7 @@ class Bjtongji extends BaseController foreach ($xk as $key => $value) { $colend = $col + $sbjcolcnt - 1; $sheet->mergeCells($colname[$col].'3:'.$colname[$colend].'3'); - $sheet->setCellValue($colname[$col].'3', $value->subject_name->title.' ('.$value->manfen.')'); + $sheet->setCellValue($colname[$col].'3', $value->subjectName->title.' ('.$value->manfen.')'); foreach ($sbjcol as $k => $val) { $sheet->setCellValue($colname[$col].'4', $val); $col++; @@ -206,7 +207,7 @@ class Bjtongji extends BaseController foreach ($data as $key => $value) { $col = 2; $sheet->setCellValue('A'.$row, $row-4); - $sheet->setCellValue('B'.$row, $value['banji']); + $sheet->setCellValue('B'.$row, $value['banjinum']); foreach ($xk as $ke => $val) { foreach ($sbjcol as $k => $v) { $sheet->setCellValue($colname[$col].$row, $value['chengji'][$val->subject_name->lieming][$k]); diff --git a/app/chengji/model/Bjtongji.php b/app/chengji/model/Bjtongji.php index a45620a1..deea247c 100644 --- a/app/chengji/model/Bjtongji.php +++ b/app/chengji/model/Bjtongji.php @@ -53,6 +53,7 @@ class Bjtongji extends Base $temp = $tj->tongji($temp,$srcfrom['kaoshi']); $data[] = [ 'banji'=>$value['banjiTitle'], + 'banjinum'=>$value['banjiNum'], 'school'=>$value['glSchool']['jiancheng'], 'chengji'=>$temp ]; @@ -65,6 +66,7 @@ class Bjtongji extends Base $temp = $tj->tongji($allcj,$srcfrom['kaoshi']); $data[] = [ 'banji'=>'合计', + 'banjinum'=>'合计', 'school'=>'合计', 'chengji'=>$temp ]; diff --git a/app/kaoshi/model/Kaohao.php b/app/kaoshi/model/Kaohao.php index 644c9dad..8de10b0c 100644 --- a/app/kaoshi/model/Kaohao.php +++ b/app/kaoshi/model/Kaohao.php @@ -338,7 +338,9 @@ class Kaohao extends Base }) ->when(count($paixu)>0,function($query) use($paixu){ $query->where('banji','in',function($q)use($paixu){ - $q->name('banji')->where('paixu','in',$paixu)->field('id'); + $q->name('banji') + ->where('paixu','in',$paixu) + ->field('id'); }); }) ->with([ @@ -351,6 +353,7 @@ class Kaohao extends Base ->select() ->toArray(); + foreach ($bjids as $key => $value) { // halt($key); $bjids[$key] = $value['banji']; @@ -366,9 +369,12 @@ class Kaohao extends Base $query->field('id,title,jiancheng'); }, ]) + ->append(['numTitle']) ->select() ->toArray(); + foreach ($data as $key => $value) { + $data[$key]['banjiNum'] = $bj->myBanjiNum($value['id'],$kssj); $data[$key]['banjiTitle'] = $bj->myBanjiTitle($value['id'],$kssj); } diff --git a/app/teach/model/Banji.php b/app/teach/model/Banji.php index 6e503398..43abac33 100644 --- a/app/teach/model/Banji.php +++ b/app/teach/model/Banji.php @@ -112,7 +112,7 @@ class Banji extends Base /** - * 获取考试时的班级名称 + * 获取考试时的班级名称(文本格式-一年级十一班) * $jdshijian 考试开始时间 * $ruxuenian 年级 * $paixu 班级 @@ -147,5 +147,29 @@ class Banji extends Base return $bjtitle; } + /** + * 获取考试时的班级名称(数字格式5.1) + * $jdshijian 考试开始时间 + * $ruxuenian 年级 + * $paixu 班级 + * 返回 $str 班级名称 + * */ + public function myBanjiNum($bjid,$jdshijian=0) + { + // 查询班级信息 + $bjinfo = $this::withTrashed() + ->where('id',$bjid) + ->field('id,ruxuenian,paixu,delete_time') + ->find(); + + + //获取班级、年级列表 + $njlist = array_keys(nianjiList($jdshijian)); + $nj = array_search($bjinfo->ruxuenian,$njlist)+1; + $bjtitle = $nj.'.'.$bjinfo->paixu; + + return $bjtitle; + } + }