From 9a31560074b7c3dd73175f52c1b115d48a206597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=9C=E5=AE=9D=E4=B9=A6=E8=AE=B0?= Date: Fri, 14 May 2021 20:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=95=E5=85=A5=E6=88=90=E7=BB=A9=E6=9D=83?= =?UTF-8?q?=E9=99=90=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 +++++++++---- app/chengji/model/Chengji.php | 40 +++++++++++++++++++++++++++++--- app/event.php | 3 +++ app/kaoshi/controller/Index.php | 1 + app/kaoshi/model/Kaoshi.php | 10 +++++++- app/kaoshi/view/index/index.html | 13 +++++++++++ app/listener/KaoshiEdit.php | 38 ++++++++++++++++++++++++++++++ app/listener/KaoshiLuru.php | 2 -- 8 files changed, 112 insertions(+), 11 deletions(-) create mode 100644 app/listener/KaoshiEdit.php diff --git a/README.md b/README.md index aadd838c..27f2027e 100755 --- a/README.md +++ b/README.md @@ -161,7 +161,8 @@ 里面隐藏了两个很实用的功能,如果想了解隐藏功能,请下载。 ## 更新内容 - 升级ThinkPHP到v6.07 + 升级ThinkPHP到v6.08 + 升级LayUi到2.6.5 根据功能拆分js方法,增加一些js方法 大部分菜单或复选框改成ajax获取。 重新规划表格和创建模板 @@ -170,7 +171,7 @@ 增加、删除部分权限 增加、删除部分类别 修改统计项目默认值 - 用xs-select代替原来的ajax搜索菜单 + 用xs-select代替原来的ajax菜单 修改登录验证方式 重新规划基础数据模型和控制器 独立成绩录入相关操作到一个应用中 @@ -183,7 +184,14 @@ 修复已知的表格上传教师错误、重复输入phinx命令提示的错误、登录跳转和已录成绩显示错误 优化雷达图学科显示、成绩位置算法、部分统计表显示等 增加学生帐号显示成绩或等级设置 增加良好分数线,优秀、良好、合格的人数比例 - 增加教师和学生时的帐号、电话和身份证号的重复验证 + 增加教师和学生时的帐号、电话和身份证号的重复验证 + 增加查看班级学生名单 + 修复成绩报告已知错误 + 增加教研组 + 增加教研组长 + 增加课题和荣誉统计 + 增加删除学科查看与恢复 + 增加删除学科"列标识"重复验证 更多更新日志(http://www.www.dl-sm.cn.cn/login/log) @@ -202,8 +210,6 @@ https://www.kancloud.cn/llblax/abcd/789222 ## 下一步工作 * [ ] 项目的问题修复和功能完善 -* [ ] 尝试增加排课功能 -* [ ] 想一想接下来要干点什么…… ## 感谢 这个项目一直在更新和完善中,在这个磕磕绊绊的成长过程中得到了许多朋友、同仁的支持和肯定,特别是给项目技术支持和打赏的朋友们,同时也感谢留下Watch、Star、Fork的朋友和ThinkPHP、xadmin等框架,不断增加的Star也是让我们坚持下去的动力源泉。 diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index be21ed3d..f1dd23a1 100755 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -110,8 +110,43 @@ class Chengji extends BaseModel // 列出已录成绩列表 public function searchLuru($srcfrom) { - $nianji = \app\facade\Tools::nianJiNameList(); - $cjList = $this->searchBase($srcfrom); + $cjList = $this + ->where('user_id', $srcfrom['user_id']) + ->when(strlen($srcfrom['subject_id']) > 0, function ($query) { + $query->where('subject_id', $srcfrom); + }) + ->where('kaohao_id', 'in', function ($query) { + $query + ->name('kaohao') + ->where('kaoshi_id', 'in', function ($q) { + $q->name('kaoshi') + ->where('status&luru', 1) + ->field('id'); + }) + ->field('id'); + }) + ->with([ + 'subjectName' => function($query){ + $query->field('id, title, lieming'); + } + ,'cjKaohao' => function($query){ + $query->field('id, kaoshi_id, school_id, ruxuenian, nianji, banji_id, paixu, student_id') + ->append(['banjiTitle']) + ->with([ + 'cjSchool' => function($query){ + $query->field('id, jiancheng, paixu'); + } + ,'cjStudent' => function($query){ + $query->field('id, xingming, sex'); + } + ,'cjKaoshi' => function($query){ + $query->field('id, title'); + } + ]); + } + ]) + ->select(); + // 重新整理成绩 $data = array(); @@ -149,7 +184,6 @@ class Chengji extends BaseModel // 列出已录成绩列表 public function searchTeacher($srcfrom) { - $nianji = nianJiNameList(); $cjList = $this->searchBase($srcfrom); // 重新整理成绩 diff --git a/app/event.php b/app/event.php index 02bb3d96..5062149b 100755 --- a/app/event.php +++ b/app/event.php @@ -14,6 +14,9 @@ return [ 'kslu' => [ '\app\listener\KaoshiLuru' ], + 'ksedit' => [ + '\app\listener\KaoshiEdit' + ], 'tjlog' => [ '\app\listener\TongjiLog' ], diff --git a/app/kaoshi/controller/Index.php b/app/kaoshi/controller/Index.php index c29cba7a..ce4b533d 100755 --- a/app/kaoshi/controller/Index.php +++ b/app/kaoshi/controller/Index.php @@ -321,6 +321,7 @@ class Index extends AdminBase // 更新考试信息 public function update($id) { + event('ksedit', $id); event('kslu', $id); // 获取表单数据 $list = request()->only([ diff --git a/app/kaoshi/model/Kaoshi.php b/app/kaoshi/model/Kaoshi.php index c2209852..6bed8c50 100755 --- a/app/kaoshi/model/Kaoshi.php +++ b/app/kaoshi/model/Kaoshi.php @@ -63,6 +63,9 @@ class Kaoshi extends BaseModel ,'ksFanwei' => function ($query) { $query->field('id, title'); } + ,'ksTeahcer' => function ($query) { + $query->field('id, xingming'); + } ] ) ->append(['ckSubject', 'ckNianji']) @@ -100,7 +103,7 @@ class Kaoshi extends BaseModel { // 获取参考年级 $kaoshiList = $this->where('id', $id) - ->field('id, title, status, luru, bfdate, enddate') + ->field('id, title, user_id, status, luru, bfdate, enddate') ->find(); return $kaoshiList; } @@ -233,5 +236,10 @@ class Kaoshi extends BaseModel } + // 学期 + public function ksTeahcer() + { + return $this->belongsTo('\app\admin\model\Admin', 'user_id', 'id'); + } } diff --git a/app/kaoshi/view/index/index.html b/app/kaoshi/view/index/index.html index 95c182c0..93d0833d 100755 --- a/app/kaoshi/view/index/index.html +++ b/app/kaoshi/view/index/index.html @@ -115,6 +115,19 @@ layui.use(['table', 'mytable','createInput','form'], function() { return endate; } }, + { + field: 'user_id', + title: '创建人', + sort: true, + minWidth: 100, + templet: function(d) { + var str; + if (d.ksTeahcer) { + str = d.ksTeahcer.xingming; + } + return str; + } + }, { field: 'luru', title: '成绩编辑', minWidth: 100, templet: '#luru', sort: true }, { field: 'status', title: '状态', minWidth: 80, templet: '#jieshu', sort: true }, { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 250 }, diff --git a/app/listener/KaoshiEdit.php b/app/listener/KaoshiEdit.php new file mode 100644 index 00000000..1e1b3af4 --- /dev/null +++ b/app/listener/KaoshiEdit.php @@ -0,0 +1,38 @@ +ksInfo($kaoshi_id); + $user_id = session('user_id'); + if ($user_id != 1 && $user_id != 2) { + if($ksInfo){ + if($ksInfo->user_id != $user_id) + { + return $this->error('考试创建人才可以编辑考试信息!','/login/err'); + } + }else{ + return $this->error('没有找到考试。','/login/err'); + } + } + + + return $ksInfo; + } +} diff --git a/app/listener/KaoshiLuru.php b/app/listener/KaoshiLuru.php index b3243832..594f3ba6 100755 --- a/app/listener/KaoshiLuru.php +++ b/app/listener/KaoshiLuru.php @@ -32,9 +32,7 @@ class KaoshiLuru }else{ return $this->error('没有找到考试。','/login/err'); } - return $ksInfo; - } }