From 2f02073487911c1956bc6a708ed2a958b8cc3a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Sun, 9 Aug 2020 16:19:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8F=AD=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/model/TongjiBj.php | 38 +- app/chengji/view/index/index.html | 4 +- app/facade/System.php | 12 + app/kaohao/model/Kaohao.php | 5 +- app/kaohao/model/SearchOne.php | 1 + app/kaohao/view/index/read.html | 2 +- app/kaoshi/controller/KaoshiSet.php | 11 +- app/kaoshi/model/Kaoshi.php | 2 +- app/kaoshi/view/kaoshi_set/create.html | 4 +- app/login/view/index/shangma_log.html | 14 +- app/student/controller/Index.php | 8 +- app/student/validate/Student.php | 4 +- app/student/view/index/create_all.html | 2 +- app/student/view/index/deletes.html | 2 +- app/student/view/index/index.html | 2 +- app/studentSearchChengji/controller/Index.php | 4 +- .../view/index/index.html | 854 +++++++++--------- app/system/controller/SystemBase.php | 19 +- app/system/model/SystemBase.php | 18 + app/system/validate/SystemBase.php | 11 +- app/system/view/system_base/edit.html | 29 +- app/teach/controller/Banji.php | 11 +- app/teach/model/Banji.php | 24 +- app/teach/model/Subject.php | 2 +- app/teacher/controller/Index.php | 3 +- app/tools/controller/Index.php | 84 +- app/tools/controller/KsCanyu.php | 58 +- app/tools/controller/OneStudentChengji.php | 85 +- app/tools/controller/System.php | 49 +- app/tools/model/OneStudentChengji.php | 113 ++- .../migrations/20181010035225_system_base.php | 3 + 31 files changed, 793 insertions(+), 685 deletions(-) create mode 100644 app/facade/System.php diff --git a/app/chengji/model/TongjiBj.php b/app/chengji/model/TongjiBj.php index adef27c8..68907ba0 100644 --- a/app/chengji/model/TongjiBj.php +++ b/app/chengji/model/TongjiBj.php @@ -237,12 +237,13 @@ class TongjiBj extends BaseModel ->with([ 'bjBanji'=>function($query){ $query - ->field('id, school_id, paixu') + ->field('id, school_id, paixu, ruxuenian, alias') ->with([ 'glSchool'=>function($query){ $query->field('id, jiancheng, paixu'); }, ]); + }, 'bjJieguo'=>function($query){ $query->field('subject_id, banji_id, stu_cnt, @@ -256,7 +257,6 @@ class TongjiBj extends BaseModel ->order(['subject_id']); } ]) - // ->cache(true) ->group('banji_id, kaoshi_id') ->append(['banjiTitle']) ->select(); @@ -336,8 +336,6 @@ class TongjiBj extends BaseModel $src['enddate'] = date("Y-m-d", strtotime("+1 day")); } - // halt($src); - $data = $this ->where('banji_id', $src['banji_id']) ->where('kaoshi_id', 'in', function ($query) use ($src) { @@ -457,14 +455,30 @@ class TongjiBj extends BaseModel // 获取班级名称 public function getBanjiTitleAttr() { - $more = new More(); - $cy = new Canyu(); - $src = [ - 'kaoshi_id' => $this->getAttr('kaoshi_id'), - 'banji_id' => $this->getAttr('banji_id'), - ]; + $ks = $this->getAttr('bjKaoshi'); + $bj = $this->getAttr('bjBanji'); - $bj = $cy->class($src); - return $bj[0]['banjiTitle']; + $njlist = nianJiNameList('str', $ks->getData('enddate')); + $njname = $njlist[$bj->ruxuenian]; + + $sys = \app\facade\System::sysClass(); + $classalias = $sys->classalias; + + $bjobj = new \app\teach\model\Banji; + + if($sys->classalias) + { + $bjname = $bj->alias; + if($bjname == '') + { + $bjname = $bjobj->numToWord($bj->paixu); + } + }else{ + $bjname = $bjobj->numToWord($bj->paixu); + } + + $title = $njname . $bjname . '班'; + + return $title; } } diff --git a/app/chengji/view/index/index.html b/app/chengji/view/index/index.html index d7263c57..58ae63a8 100644 --- a/app/chengji/view/index/index.html +++ b/app/chengji/view/index/index.html @@ -42,7 +42,7 @@
-
+
@@ -198,7 +198,7 @@ function addBanji(){ // 获取参数 var formval = form.val('search'); - cjgl.createCheckbox('banji_id',formval,'/tools/kscy/class','banji_id','banTitle'); + cjgl.createCheckbox('banji_id', formval, '/tools/kscy/class', 'banji_id', 'banTitle'); } diff --git a/app/facade/System.php b/app/facade/System.php new file mode 100644 index 00000000..fd2756a2 --- /dev/null +++ b/app/facade/System.php @@ -0,0 +1,12 @@ +classalias) { $title = $bj->where('id', $this->getAttr('banji_id'))->value('alias'); @@ -78,6 +77,8 @@ class Kaohao extends BaseModel return $title; } + + // 获取参加考试班级数字名 public function getNumBanjiTitleAttr() { diff --git a/app/kaohao/model/SearchOne.php b/app/kaohao/model/SearchOne.php index 100820d3..69c293b3 100644 --- a/app/kaohao/model/SearchOne.php +++ b/app/kaohao/model/SearchOne.php @@ -178,6 +178,7 @@ class SearchOne extends BaseModel return $stuCj; } + } diff --git a/app/kaohao/view/index/read.html b/app/kaohao/view/index/read.html index 5288f533..fe061a66 100644 --- a/app/kaohao/view/index/read.html +++ b/app/kaohao/view/index/read.html @@ -87,7 +87,7 @@ defenOptions = { elem: '#tabledemo', toolbar: '#toolbarDemo', - url:"/tools/onestudentchengji/oldcj", + url:"/tools/onestudentchengji/xkcj", method:"POST", //数据接口 page: false, //开启分页 loading:true, diff --git a/app/kaoshi/controller/KaoshiSet.php b/app/kaoshi/controller/KaoshiSet.php index eb300b8b..388088ae 100644 --- a/app/kaoshi/controller/KaoshiSet.php +++ b/app/kaoshi/controller/KaoshiSet.php @@ -6,8 +6,6 @@ use app\base\controller\AdminBase; // 引用考号数据模型类 use app\kaoshi\model\KaoshiSet as ksset; -// 考试控制器 -use app\kaoshi\controller\Kaoshi as kscon; class KaoshiSet extends AdminBase @@ -85,10 +83,11 @@ class KaoshiSet extends AdminBase ,'kaoshi_id' => $kaoshi_id ); - // 获取参加考试年级 - $ksset = new ksset(); - $nianJiNameList = $ksset->srcGrade($kaoshi_id); - $list['set']['nianji'] = $nianJiNameList; + // 获取考试时间 + $ks = new \app\kaoshi\model\Kaoshi; + $enddate = $ks->kaoshiInfo($kaoshi_id); + $enddate = $enddate->getData('enddate'); + $list['set']['nianji'] = nianJiNameList('str', $enddate); // 模板赋值 $this->view->assign('list', $list); diff --git a/app/kaoshi/model/Kaoshi.php b/app/kaoshi/model/Kaoshi.php index e913e802..c8b46dee 100644 --- a/app/kaoshi/model/Kaoshi.php +++ b/app/kaoshi/model/Kaoshi.php @@ -69,7 +69,7 @@ class Kaoshi extends BaseModel { // 获取参考年级 $kaoshiList = $this->where('id', $id) - ->field('id, title, status, luru') + ->field('id, title, status, luru, bfdate, enddate') ->find(); return $kaoshiList; } diff --git a/app/kaoshi/view/kaoshi_set/create.html b/app/kaoshi/view/kaoshi_set/create.html index 36d3848d..1de1fa14 100644 --- a/app/kaoshi/view/kaoshi_set/create.html +++ b/app/kaoshi/view/kaoshi_set/create.html @@ -8,8 +8,8 @@ diff --git a/app/login/view/index/shangma_log.html b/app/login/view/index/shangma_log.html index 3bb37626..1f717242 100644 --- a/app/login/view/index/shangma_log.html +++ b/app/login/view/index/shangma_log.html @@ -53,19 +53,21 @@
升级框架ThinkPHP V6.0.3
- 分离教师、学生应用 + 分离教师、学生应用,重构考号数据模型,修改所有模型继承
- 修改部分上传和列表的页面显示、班级名称生成算法、模型继承 + 优化学年、班级计算方法 +
+ 修改部分上传和列表的页面显示
修复已知错误
- 增加各分数段统计、增加学生成绩查询、增加班级最大数量配置 + 增加各分数段统计、学生成绩查询
- 取消录入成绩时对十分位的验证 + 增加年级最大数、班级最大数、班级别名是否开启、学年节点配置 +
+ 取消录入成绩时对十分位的限制
重新整理自定义方法,将不常用的方法归类到相应的模型或控制器中 -
- 增加最多班级和最多年级设置,增加班级别名设置,部分配置文件中内容移到系统设置页面中

diff --git a/app/student/controller/Index.php b/app/student/controller/Index.php index f02c77c4..64fd3cb5 100644 --- a/app/student/controller/Index.php +++ b/app/student/controller/Index.php @@ -7,7 +7,7 @@ use app\base\controller\AdminBase; // 引用学生数据模型类 use app\student\model\Student as STU; // 引用phpspreadsheet类 -use app\student\controller\Myexcel; +use app\tools\controller\File; class Index extends AdminBase { @@ -449,8 +449,7 @@ class Index extends AdminBase ], 'POST'); // 读取表格数据 - $excel = new Myexcel(); - $stuinfo = $excel->readXls(public_path() . 'uploads\\' . $list['url']); + $stuinfo = \app\facade\File::readXls(public_path() . 'uploads\\' . $list['url']); if($stuinfo[0][2] != "序号" && $stuinfo[1][2] != "姓名" && $stuinfo[2][2] != "身份证号") { $data = array('msg'=>'请使用模板上传','val'=>0,'url'=>''); @@ -529,8 +528,7 @@ class Index extends AdminBase ], 'POST'); // 读取表中数据 - $excel = new Myexcel(); - $stuinfo = $excel->readXls(public_path() . 'uploads\\' . $list['url']); + $stuinfo = \app\facade\File::readXls(public_path() . 'uploads\\' . $list['url']); // 判断表格是否正确 if($stuinfo[0][2] != "序号" && $stuinfo[1][2] != "ID" && $stuinfo[2][2] != "班级" && $stuinfo[3][2] != "姓名") diff --git a/app/student/validate/Student.php b/app/student/validate/Student.php index 49662c85..16fdd0d5 100644 --- a/app/student/validate/Student.php +++ b/app/student/validate/Student.php @@ -15,13 +15,13 @@ class Student extends Validate protected $rule = [ 'id|ID' => 'require|number', 'xingming|姓名' => 'require|chs|length:2,8', - 'sex|性别' => 'require|number', + 'sex|性别' => 'require|boolean', 'shengri|出生日期' => 'date', 'shenfenzhenghao|身份证号' => "require|idCard", 'ruxuenian|年级' => 'require|number', 'banji_id|班级' => 'require|number', 'kaoshi|是否参加考试' => 'require|number', - 'quanpin|姓名全拼' => 'require|' + 'quanpin|姓名全拼' => 'require' ]; /** diff --git a/app/student/view/index/create_all.html b/app/student/view/index/create_all.html index 430c6ea2..29972d97 100644 --- a/app/student/view/index/create_all.html +++ b/app/student/view/index/create_all.html @@ -1,4 +1,4 @@ -{extend name=".././view/create.html" /} +{extend name=".././view/createhref.html" /} {block name="form"}
diff --git a/app/student/view/index/deletes.html b/app/student/view/index/deletes.html index d2037ff0..010b43fd 100644 --- a/app/student/view/index/deletes.html +++ b/app/student/view/index/deletes.html @@ -34,7 +34,7 @@ layui.use('upload', function(){ //执行实例 var uploadInst = upload.render({ elem: '#upload' //绑定元素 - ,url: "/teacher/index/upload" //上传接口 + ,url: "/tools/file/upload" //上传接口 ,done: function(res){ if(res.val == 1){ $('#url').val(res.url); diff --git a/app/student/view/index/index.html b/app/student/view/index/index.html index 5a16960b..24278d85 100644 --- a/app/student/view/index/index.html +++ b/app/student/view/index/index.html @@ -33,7 +33,7 @@
{php} - $njlist = nianJiNameList(); + $njlist = nianJiNameList('str', time()); {/php} {volist name="njlist" id="vo"} diff --git a/app/studentSearchChengji/controller/Index.php b/app/studentSearchChengji/controller/Index.php index d5eb4d4f..af06e6e2 100644 --- a/app/studentSearchChengji/controller/Index.php +++ b/app/studentSearchChengji/controller/Index.php @@ -38,8 +38,8 @@ class Index extends StudentSearchBase } ]) ->find(); - // $list['id'] = $khInfo->id; - $list['id'] = 9480; + $list['id'] = $khInfo->id; + // $list['id'] = 9480; $list['kaoshi_title'] = $khInfo->cjKaoshi->title; $list['kaoshi_date'] = $khInfo->cjKaoshi->bfdate . '~' . $khInfo->cjKaoshi->enddate; diff --git a/app/studentSearchChengji/view/index/index.html b/app/studentSearchChengji/view/index/index.html index ec644d6d..50ab156a 100644 --- a/app/studentSearchChengji/view/index/index.html +++ b/app/studentSearchChengji/view/index/index.html @@ -1,427 +1,427 @@ - - - - - {$list.webtitle} - - - - - - {load href="__XADMIN__/css/font.css" /} - {load href="__XADMIN__/css/xadmin.css" /} - {load href="__STATIC__/mayi/css/studentSearch.css" /} - {load href="__XADMIN__/js/jquery.min.js" /} - {load href="__XADMIN__/lib/layui/layui.js" /} - {load href="__XADMIN__/js/xadmin.js" /} - {load href="__XADMIN__/js/cookie.js" /} - {load href="__XADMIN__/js/md5.min.js" /} - {load href="__STATIC__/echarts/echarts.js" /} - - - - - - - - - - - - - {if ( session('student.password') == 123) } -
- 您现在使用的是默认密码,为了您的信息不被漏,请及时修改密码。 -
- {/if} -
-
- {$list.kaoshi_title}考试成绩({$list.kaoshi_date}) -
-
-
-
-
- 各学科总分 -
-
-
-
-
-
-
-
-
- 各学科得分 -
-
-
-
-
-
-
-
-
- 各学科得分率 -
-
-
-
-
-
-
-
-
- 各学科成绩与平均分对比 -
-
-
-
-
-
-
-
-
- 各学科成绩位置 -
-
-
-
-
-
-
-
-
-
-
-
- 感谢{$list.thinks}提供技术支持。
- 本系统由{$list.danwei}负责管理 -
-
-
- - - + + + + + {$list.webtitle} + + + + + + {load href="__XADMIN__/css/font.css" /} + {load href="__XADMIN__/css/xadmin.css" /} + {load href="__STATIC__/mayi/css/studentSearch.css" /} + {load href="__XADMIN__/js/jquery.min.js" /} + {load href="__XADMIN__/lib/layui/layui.js" /} + {load href="__XADMIN__/js/xadmin.js" /} + {load href="__XADMIN__/js/cookie.js" /} + {load href="__XADMIN__/js/md5.min.js" /} + {load href="__STATIC__/echarts/echarts.js" /} + + + + + + + + + + + + + {if ( session('student.password') == 123) } +
+ 您现在使用的是默认密码,为了您的信息不被漏,请及时修改密码。 +
+ {/if} +
+
+ {$list.kaoshi_title}考试成绩({$list.kaoshi_date}) +
+
+
+
+
+ 各学科总分 +
+
+
+
+
+
+
+
+
+ 各学科得分 +
+
+
+
+
+
+
+
+
+ 各学科得分率 +
+
+
+
+
+
+
+
+
+ 各学科成绩与平均分对比 +
+
+
+
+
+
+
+
+
+ 各学科成绩位置 +
+
+
+
+
+
+
+
+
+
+
+
+ 感谢{$list.thinks}提供技术支持。
+ 本系统由{$list.danwei}负责管理 +
+
+
+ + + diff --git a/app/system/controller/SystemBase.php b/app/system/controller/SystemBase.php index fe093024..846f1202 100644 --- a/app/system/controller/SystemBase.php +++ b/app/system/controller/SystemBase.php @@ -14,7 +14,9 @@ class SystemBase extends AdminBase public function edit() { // 获取用户信息 - $list['data'] = sysbasemod::field('id, keywords, description, thinks, danwei, grademax, classmax, classalias') + $sys = new sysbasemod; + $list['data'] = $sys + ->field('id, keywords, description, thinks, danwei, grademax, classmax, classalias, xuenian') ->order(['id' => 'desc']) ->find(); @@ -47,9 +49,12 @@ class SystemBase extends AdminBase ,'grademax' ,'classmax' ,'classalias' + ,'xuenian' ], 'put'); $list['id'] = $id; + + // 验证表单数据 $validate = new \app\system\validate\SystemBase; $result = $validate->scene('edit')->check($list); @@ -58,7 +63,17 @@ class SystemBase extends AdminBase return json(['msg'=>$msg,'val'=>0]);; } - $data = sysbasemod::where('id', $id)->cache('key')->update($list); + $sys = new sysbasemod; + $sysList = $sys->find($id); + $sysList->keywords = $list['keywords']; + $sysList->description = $list['description']; + $sysList->thinks = $list['thinks']; + $sysList->danwei = $list['danwei']; + $sysList->grademax = $list['grademax']; + $sysList->classmax = $list['classmax']; + $sysList->classalias = $list['classalias']; + $sysList->xuenian = $list['xuenian']; + $data = $sysList->save(); // 根据更新结果设置返回提示信息 $data >= 0 ? $data = ['msg' => '设置成功','val'=>1] diff --git a/app/system/model/SystemBase.php b/app/system/model/SystemBase.php index 11f85d66..2c6a85cc 100644 --- a/app/system/model/SystemBase.php +++ b/app/system/model/SystemBase.php @@ -14,4 +14,22 @@ class SystemBase extends BaseModel ->find(); return $info; } + + + // 学年节点获取器 + public function getXuenianAttr($value) + { + $value = date('Y', time()).'-'.date('m-d', $value); + return $value; + } + + + // 学年节点修改器 + public function setXuenianAttr ($value) + { + $value = strtotime($value); + $value = '1986-'.date('m-d', $value); + $value = strtotime($value); + return $value; + } } diff --git a/app/system/validate/SystemBase.php b/app/system/validate/SystemBase.php index 3dbc7b2f..cd2aa7e9 100644 --- a/app/system/validate/SystemBase.php +++ b/app/system/validate/SystemBase.php @@ -13,11 +13,16 @@ class SystemBase extends Validate * @var array */ protected $rule = [ - 'id|ID' => 'require|number', + 'id|ID' => 'require|integer', 'keywords|关键字' => 'require|length:2,60', 'description|描述' => 'require|length:1,100', 'thinks|感谢' => 'require|length:1,80', 'danwei|单位' => 'require|length:2,80', + 'xuenian|学年节点' => 'require|date', + 'grademax|年级最大数' => 'require|integer', + 'classmax|年级最大数' => 'require|integer', + 'classalias|别名' => 'require|boolean', + ]; /** @@ -35,6 +40,10 @@ class SystemBase extends Validate ,'description' ,'thinks' ,'danwei' + ,'xuenian' + ,'grademax' + ,'classmax' + ,'classalias' ], ]; } diff --git a/app/system/view/system_base/edit.html b/app/system/view/system_base/edit.html index 90982097..f4d795ce 100644 --- a/app/system/view/system_base/edit.html +++ b/app/system/view/system_base/edit.html @@ -64,6 +64,15 @@ >
+
+ +
+ +
+
-
- -
- -
-