From ff190cd8afcb74799d7e97a954ace24f5e2470d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Wed, 23 Dec 2020 20:08:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=8E=9F=E6=9D=A5=E8=A1=A8?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/controller/Bjtongji.php | 2 +- app/chengji/model/Chengji.php | 2 +- app/chengji/model/TongjiNj.php | 81 ++++++++++++------- app/kaohao/model/SearchMore.php | 2 +- app/login/controller/Index.php | 3 +- app/login/controller/Student.php | 1 + app/login/controller/Teacher.php | 1 + app/teacherSearchChengji/controller/Index.php | 10 ++- .../migrations/20190430034853_chengji.php | 15 ++-- 9 files changed, 74 insertions(+), 43 deletions(-) diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php index cd291340..9d70b63e 100755 --- a/app/chengji/controller/Bjtongji.php +++ b/app/chengji/controller/Bjtongji.php @@ -175,7 +175,7 @@ class Bjtongji extends AdminBase // 设置要导出的项目、列名、起始行 $sbjcol = [ - 'cjCnt' => '人数' + 'chengji_cnt' => '人数' ,'avg' => '平均分' ,'jigelv' => '及格率%' ,'youxiulv' => '优秀率%' diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index 4d836d4b..11cbf6a0 100755 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -171,7 +171,7 @@ class Chengji extends BaseModel ,'defen' => $value->defen ,'defenlv' => $value->defenlv ,'bpaixu' => $value->bpaixu - ,'njpaixu' => $value->njpaixu + ,'xpaixu' => $value->njpaixu ]; $value->cjKaohao->cjStudent ? $data[$key]['student_name']=$value->cjKaohao->cjStudent->xingming : $data[$key]['student_name']= ''; } diff --git a/app/chengji/model/TongjiNj.php b/app/chengji/model/TongjiNj.php index 9c821528..2565ece3 100755 --- a/app/chengji/model/TongjiNj.php +++ b/app/chengji/model/TongjiNj.php @@ -76,29 +76,22 @@ class TongjiNj extends BaseModel 'school_id' => $school['id'], 'ruxuenian' => $nianji['ruxuenian'], 'subject_id' => $cj['id'], - - - 'title' => $val->bjSubject->title - ,'jiancheng' => $val->bjSubject->jiancheng - ,'stu_cnt' => $val->stu_cnt - ,'chengji_cnt' => $val->chengji_cnt - ,'sum' => $val->sum - ,'avg' => $val->avg * 1 - ,'defenlv' => $val->defenlv - ,'biaozhuncha' => $val->biaozhuncha * 1 - ,'youxiu' => $val->youxiu - ,'jige' => $val->jige - ,'youxiulv' => $val->youxiulv - ,'jigelv' => $val->jigelv - ,'max' => $val->max - ,'min' => $val->min - ,'q1' => $val->q1 * 1 - ,'q2' => $val->q2 * 1 - ,'q3' => $val->q3 * 1 - ,'zhongshu' => $val->zhongshu - ,'zhongweishu' => $val->zhongweishu + 'stu_cnt' => $cj['stucnt'], + 'chengji_cnt' => $cj['xkcnt'], + 'sum' => $cj['sum'], + 'avg' => $cj['avg'], + 'biaozhuncha' => $cj['biaozhuncha'], + 'youxiu' => $cj['youxiu'], + 'jige' => $cj['jige'], + 'max' => $cj['max'], + 'min' => $cj['min'], + 'q1' => $cj['sifenwei'][0], + 'q2' => $cj['sifenwei'][1], + 'q3' => $cj['sifenwei'][2], + 'zhongshu' => $cj['zhongshu'], + 'zhongweihu' => $cj['zhongweishu'], + 'defenlv' => $cj['defenlv'], ]; - $data = $this::create($tongjiJg); } } @@ -165,7 +158,7 @@ class TongjiNj extends BaseModel 'id' => $value->id ,'school_jiancheng' => $value->njSchool->jiancheng ,'school_paixu' => $value->njSchool->paixu - ,'stuCnt' => $value->stu_cnt + ,'stu_cnt' => $value->stu_cnt // 'title'=>$value->banjiTitle, // 'banjipaixu'=>$value->bjBanji->paixu, ]; @@ -175,17 +168,15 @@ class TongjiNj extends BaseModel 'avg' => $val->avg * 1 ,'youxiulv' => $val->youxiulv ,'jigelv' => $val->jigelv - ,'cjCnt' => $val->chengji_cnt + ,'chengji_cnt' => $val->chengji_cnt ,'title' => $val->njSubject->title ,'jiancheng' => $val->njSubject->jiancheng ,'biaozhuncha' => $val->biaozhuncha * 1 - ,'sifenwei' => [ - 'min' => $val->min - ,'q1' => $val->q1 * 1 - ,'q2' => $val->q2 * 1 - ,'q3' => $val->q3 * 1 - ,'max' => $val->max - ] + ,'min' => $val->min + ,'q1' => $val->q1 * 1 + ,'q2' => $val->q2 * 1 + ,'q3' => $val->q3 * 1 + ,'max' => $val->max ]; }else{ $data[$value->school_id]['quanke'] = [ @@ -304,4 +295,32 @@ class TongjiNj extends BaseModel return $jige; } + + // 差生率 + function getChashenglvAttr() + { + $cjCnt = $this->chengji_cnt; + $chaCnt = $cjCnt - $this->jige; + $chalv = 0; + if ($cjCnt > 0) { + $chalv = round($chaCnt / $cjCnt * 100, 2); + } + + return $chalv; + } + + + // 参试率 + function getCanshilvAttr() + { + $cjCnt = $this->chengji_cnt; + $stu_cnt = $this->stu_cnt; + $canshilv = 0; + if ($stu_cnt > 0) { + $chalv = round($cjCnt / $stu_cnt * 100, 2); + } + + return $chalv; + } + } diff --git a/app/kaohao/model/SearchMore.php b/app/kaohao/model/SearchMore.php index 905c92cf..70d972e7 100755 --- a/app/kaohao/model/SearchMore.php +++ b/app/kaohao/model/SearchMore.php @@ -44,7 +44,7 @@ class SearchMore extends BaseModel }) ->with([ 'ksChengji' => function($query){ - $query->field('id, kaohao_id, subject_id, defen, bpaixu, njpaixu') + $query->field('id, kaohao_id, subject_id, defen, bpaixu, xpaixu') ->with([ 'subjectName' => function ($q) { $q->field('id, title, jiancheng, lieming'); diff --git a/app/login/controller/Index.php b/app/login/controller/Index.php index 5074fed7..e5245c66 100755 --- a/app/login/controller/Index.php +++ b/app/login/controller/Index.php @@ -22,7 +22,7 @@ class Index $list = $sysbasemod::sysInfo(); # 描述 // 获取系统名称和版本号 $list['version'] = config('shangma.version'); - + View::assign('list',$list); @@ -70,6 +70,7 @@ class Index $userinfo->denglucishu = ['inc', 1]; $userinfo->lasttime = $userinfo->getData('thistime'); $userinfo->thistime = time(); + $userinfo->save(); } return json($yz); diff --git a/app/login/controller/Student.php b/app/login/controller/Student.php index 68d496e7..e8322c29 100755 --- a/app/login/controller/Student.php +++ b/app/login/controller/Student.php @@ -42,6 +42,7 @@ class Student $userinfo->denglucishu = ['inc', 1]; $userinfo->lasttime = $userinfo->getData('thistime'); $userinfo->thistime = time(); + $userinfo->save(); } return json($yz); diff --git a/app/login/controller/Teacher.php b/app/login/controller/Teacher.php index c5993291..a3aa9eee 100755 --- a/app/login/controller/Teacher.php +++ b/app/login/controller/Teacher.php @@ -46,6 +46,7 @@ class Teacher $userinfo->denglucishu = ['inc', 1]; $userinfo->lasttime = $userinfo->getData('thistime'); $userinfo->thistime = time(); + $userinfo->save(); } return json($yz); diff --git a/app/teacherSearchChengji/controller/Index.php b/app/teacherSearchChengji/controller/Index.php index 4425d6a6..9285f1a3 100755 --- a/app/teacherSearchChengji/controller/Index.php +++ b/app/teacherSearchChengji/controller/Index.php @@ -109,11 +109,17 @@ class Index extends TeacherSearchBase //实例化数据模型 $sysbasemod = new sysbasemod(); - $list = $sysbasemod::sysInfo(); # 描述 - $list['version'] = config('shangma.version'); # 版本号 + // 查询系统设置 + $list = $sysbasemod + ->order(['id'=>'desc']) + ->field('thinks, danwei') + ->find(); // 查询用户登信息 $list['username'] = session('username'); + $list['webtitle'] = config('shangma.webtitle'); + + $list['xingming'] = TCH::where('phone', $list['username'])->value('xingming'); $list['version'] = config('shangma.version'); diff --git a/database/migrations/20190430034853_chengji.php b/database/migrations/20190430034853_chengji.php index 1c82ec70..44771ee3 100755 --- a/database/migrations/20190430034853_chengji.php +++ b/database/migrations/20190430034853_chengji.php @@ -35,15 +35,18 @@ class Chengji extends Migrator $table ->addColumn('kaohao_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'考试']) ->addColumn('subject_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'学科']) - ->addColumn('user_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'用户']) ->addColumn('defen','decimal',['precision'=>5,'scale'=>1,'default'=>Null,'null'=>false,'comment'=>'得分']) ->addColumn('defenlv','decimal',['precision'=>6,'scale'=>2,'default'=>Null,'null'=>false,'comment'=>'得分率']) + ->addColumn('bpaixu','integer',['limit'=>4,'null'=>true,'comment'=>'班级排序']) - ->addColumn('njpaixu','integer',['limit'=>4,'null'=>true,'comment'=>'年级排序']) - ->addColumn('qupaixu','integer',['limit'=>4,'null'=>true,'comment'=>'区排序']) - ->addColumn('bweizhi','integer',['limit'=>4,'null'=>true,'comment'=>'班级位置']) - ->addColumn('njweizhi','integer',['limit'=>4,'null'=>true,'comment'=>'年级位置']) - ->addColumn('quweizhi','integer',['limit'=>4,'null'=>true,'comment'=>'区位置']) + ->addColumn('bweizhi','decimal',['precision'=>6,'scale'=>2,'null'=>true,'comment'=>'班级位置']) + ->addColumn('xpaixu','integer',['limit'=>4,'null'=>true,'comment'=>'学校排序']) + ->addColumn('xweizhi','decimal',['precision'=>6,'scale'=>2,'null'=>true,'comment'=>'学校位置']) + // 区排序和位置 + ->addColumn('qpaixu','integer',['limit'=>4,'null'=>true,'comment'=>'区排序']) + ->addColumn('qweizhi','decimal',['precision'=>6,'scale'=>2,'null'=>true,'comment'=>'区位置']) + + ->addColumn('create_time','integer',['limit'=>11,'default'=>'1539158918','null'=>false,'comment'=>'创建时间']) ->addColumn('update_time','integer',['limit'=>11,'default'=>'1539158918','null'=>false,'comment'=>'更新时间']) ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间'])