From 3f482566c9ffd46eba818751ae752ac55d70fd3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=97=AF=7E?= Date: Wed, 26 May 2021 09:36:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BF=8F=E6=82=94=E5=BD=95?= =?UTF-8?q?=E6=88=90=E7=BB=A9=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/model/Chengji.php | 21 ++++++++++++++------- app/student/model/Student.php | 2 +- app/teach/view/banji/index.html | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index 2755fe1d..819abf10 100755 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -70,11 +70,9 @@ class Chengji extends BaseModel ->when(count($src['kaoshi_id']) == 0 && count($src['banji_id']) ==0, function($query) { $query->whereMonth('update_time'); }) - ->when(strlen($src['user_id']) > 0 && strlen($src['user_group']) > 0, function ($query) use($src){ - $query->where('user_id', $src['user_id']) - ->where('user_group', $src['user_group']); + ->when(strlen($src['user_id']) > 0, function ($query) use($src){ + $query->where('user_id', $src['user_id']); }) - ->when(count($src['subject_id']) > 0, function ($query) use ($src) { $query->where('subject_id', 'in', $src['subject_id']); }) @@ -110,10 +108,19 @@ class Chengji extends BaseModel // 列出已录成绩列表 public function searchLuru($srcfrom) { + // 初始化参数 + $src = array( + 'kaoshi_id' => '' + ,'banji_id' => array() + ,'subject_id' => '' + ,'searchval' => '' + ,'user_id' => '' + ); + $src = array_cover($srcfrom, $src); $cjList = $this - ->where('user_id', $srcfrom['user_id']) - ->when(strlen($srcfrom['subject_id']) > 0, function ($query) { - $query->where('subject_id', $srcfrom); + ->where('user_id', $src['user_id']) + ->when(strlen($src['subject_id']) > 0, function ($query) use($src){ + $query->where('subject_id', $src['subject_id']); }) ->where('kaohao_id', 'in', function ($query) { $query diff --git a/app/student/model/Student.php b/app/student/model/Student.php index 8253e46d..aa088c92 100755 --- a/app/student/model/Student.php +++ b/app/student/model/Student.php @@ -106,7 +106,7 @@ class Student extends BaseModel ->column('id'); $data = $this - ->when($src['auth']['check'] == true, function ($query) use($src) { + ->when($src['auth']['check'] === true, function ($query) use($src) { $query->where('banji_id', 'in', $src['auth']['banji_id']); }) ->when(count($src['banji_id']) > 0, function ($query) use($src) { diff --git a/app/teach/view/banji/index.html b/app/teach/view/banji/index.html index 85b07319..2d668269 100755 --- a/app/teach/view/banji/index.html +++ b/app/teach/view/banji/index.html @@ -150,8 +150,8 @@ layui.use(['table', 'mytable', 'createInput', 'form'], function() { yidong(this, '/teach/banji/yidong/' + data.id, 1); break; case 'del': // 删除 - layer.msg('暂时不允许删除'); - break; + // layer.msg('暂时不允许删除'); + // break; mytable.del(obj, "/teach/banji/delete"); break; case 'edit': // 编辑