From 90953f620098e39a478322e282afd65a1ba20fd2 Mon Sep 17 00:00:00 2001 From: cxdbz Date: Sun, 12 Jan 2020 20:04:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=BD=95=E5=85=A5=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=AE=8C=E6=88=90=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=B7=B2?= =?UTF-8?q?=E5=BD=95=E6=88=90=E7=BB=A9=E9=A1=B5=E9=9D=A2=E5=BC=80=E5=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/controller/Index.php | 412 --------------- app/chengji/controller/Luru.php | 479 ++++++++++++++++++ app/chengji/model/Chengji.php | 71 ++- app/chengji/route/chengji.php | 23 +- app/chengji/view/index/biaolu.html | 141 ------ .../{index/biaoqian.html => luru/biaolu.html} | 35 +- app/chengji/view/luru/index.html | 133 +++++ app/chengji/view/{index => luru}/malu.html | 4 +- app/common.php | 2 +- app/index/view/index/welcome.html | 2 +- app/login/view/index/shangma_log.html | 20 +- database/seeds/Rule.php | 15 +- 12 files changed, 733 insertions(+), 604 deletions(-) create mode 100644 app/chengji/controller/Luru.php delete mode 100644 app/chengji/view/index/biaolu.html rename app/chengji/view/{index/biaoqian.html => luru/biaolu.html} (92%) create mode 100644 app/chengji/view/luru/index.html rename app/chengji/view/{index => luru}/malu.html (98%) diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index dace2e8d..8770ded2 100644 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -13,378 +13,6 @@ use \app\teach\model\Subject; class Index extends BaseController { - // 使用二维码录入成绩 - public function malu() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'扫码录成绩', - 'butname'=>'录入', - 'formpost'=>'PUT', - 'url'=>'/chengji/malu', - ); - - - // 模板赋值 - $this->view->assign('list',$list); - // 渲染 - return $this->view->fetch(); - } - - // 保存使用二维码录入的成绩 - public function malusave() - { - // 获取表单数据 - $list = $this->request->only(['kaohao_id','subject_id','defen'],'post'); - - $kaoshiid = Kaohao::where('id',$list['kaohao_id'])->value('kaoshi'); - // 判断考试结束时间是否已过 - $enddate = kaoshiDate($kaoshiid,'enddate'); - if($enddate === true) - { - $data=['msg'=>'考试时间已过,不能录入成绩','val'=>0]; - return json($data); - } - - // 成绩验证 - $manfen = getmanfen($kaoshiid,$list['subject_id']); - $mfyz = manfenvalidate($list['defen'],$manfen); - if($mfyz['val'] == 0) - { - return json($mfyz); - } - - // 保存成绩 - $cjone = Chengji::withTrashed() - ->where('subject_id',$list['subject_id']) - ->where('kaohao_id',$list['kaohao_id']) - ->find(); - - // 如果存在成绩则更新,不存在则添加 - if($cjone) - { - // 判断记录是否被删除 - if($cjone->delete_time > 1) - { - $cjone->restore(); - } - - if($cjone->defen == $list['defen']) - { - $data=['msg'=>'与原成绩相同,不需要修改。','val'=>1]; - return json($data); - } - - $cjone->defen = $list['defen']; - $data = $cjone->save(); - - }else{ - $data = [ - 'kaohao_id'=>$list['kaohao_id'], - 'subject_id'=>$list['subject_id'], - 'user_id'=>session('userid'), - 'defen'=>$list['defen'] - ]; - $data = Chengji::create($data); - } - - - $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - return json($data); - } - - - // 学生成绩表中修改成绩 - public function update($id) #id为考号ID - { - // 获取表单数据 - $list = $this->request->only( - ['colname', - 'newdefen'] - ,'post'); - $list['kaohao_id'] = $id; - - // 判断考试结束时间是否已过 - $kaoshiid = Kaohao::where('id',$list['kaohao_id'])->value('kaoshi'); - $enddate = kaoshiDate($kaoshiid,'enddate'); - if($enddate === true) - { - $data=['msg'=>'考试时间已过,不能录入成绩','val'=>0]; - return json($data); - } - - - // 获取学科id - $subject = new \app\teach\model\Subject; - $subject_id = $subject->where('lieming',$list['colname'])->value('id'); - - - - // 成绩验证 - $manfen = getmanfen($kaoshiid,$subject_id); - $mfyz = manfenvalidate($list['newdefen'],$manfen); - if($mfyz['val'] == 0) - { - return json($mfyz); - } - - - - // 更新成绩 - $cjone = Chengji::withTrashed() - ->where('kaohao_id',$list['kaohao_id']) - ->where('subject_id',$subject_id) - ->find(); - - - // 如果存在成绩则更新,不存在则添加 - if($cjone) - { - // 判断记录是否被删除 - if($cjone->delete_time > 1) - { - $cjone->restore(); - } - - if($cjone->defen == $list['newdefen']) - { - $data=['msg'=>'与原成绩相同,不需要修改。','val'=>1]; - return json($data); - } - - $cjone->defen = $list['newdefen']; - $data = $cjone->save(); - - }else{ - $data = [ - 'kaohao_id'=>$list['kaohao_id'], - 'subject_id'=>$subject_id, - 'user_id'=>session('userid'), - 'defen'=>$list['newdefen'] - ]; - $data = Chengji::create($data); - } - - // 判断返回内容 - $data ? $data=['msg'=>'录入成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回更新结果 - return json($data); - } - - - - // 根据考号获取学生信息 - public function read() - { - // 获取表单数据 - $val = input('post.val'); - // 实例化系统设置类 - $md5 = new \app\system\controller\Encrypt; - - $val = $md5->decrypt($val,'dlbz'); - $list = explode('|',$val); - $sbj = $list[1]; - - $cjlist = Kaohao::where('id',$list[0]) - ->field('id,banji,school,student') - ->with([ - 'ksChengji'=>function($q) use($sbj){ - $q->where('subject_id',$sbj) - ->field('kaohao_id,subject_id,defen'); - } - ,'cjBanji'=>function($q){ - $q->field('id,paixu,ruxuenian') - ->append(['numTitle','banjiTitle']); - } - ,'cjSchool'=>function($q){ - $q->field('id,jiancheng'); - } - ,'cjStudent'=>function($q){ - $q->field('id,xingming'); - } - ]) - ->find(); - if($cjlist->cjStudent == Null) - { - $stu = new \app\renshi\model\Student; - $stuinfo = $stu::withTrashed() - ->where('id',$cjlist->student) - ->field('id,xingming,sex') - ->find(); - $cjlist->cjStudent = array( - 'id'=>$stuinfo->id, - 'xingming'=>$stuinfo->xingming - ); - } - $cjlist->sbj = Subject::where('id',$sbj)->field('id,title')->find(); - - // 获取列名 - return json($cjlist); - } - - - // 表格录入成绩上传页面 - public function biaolu() - { - - $ks = new \app\kaoshi\model\Kaoshi; - // 获取参考年级 - $list['data'] = $ks::order(['id'=>'desc']) - ->field('id,title') - ->with([ - 'ksNianji' - ,'ksSubject'=>function($query){ - $query->field('id,subjectid,kaoshiid') - ->with(['subjectName'=>function($q){ - $q->field('id,title'); - }] - ); - } - ]) - ->where('enddate','>=',time()) - ->select() - ->toArray(); - - - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'表格录入', - 'butname'=>'下载', - 'formpost'=>'POST', - 'url'=>'/kaoshi/kaohao/dwcaiji', - ); - - - // 模板赋值 - $this->view->assign('list',$list); - // 渲染 - return $this->view->fetch('biaoqian'); - } - - - - // 保存表格批量上传的成绩 - public function saveAll() - { - // set_time_limit(0); - // 获以电子表格存储位置 - $url = input('post.url'); - - // 实例化操作表格类 - $excel = new \app\renshi\controller\Myexcel; - - // 读取表格数据 - $cjinfo = $excel->readXls(public_path().'public\\uploads\\'.$url); - - $kaoshiid = $cjinfo[1][0]; #获取考号 - - - if($kaoshiid == null || $cjinfo[2][0] != '序号' || $cjinfo[2][1] != '编号' || $cjinfo[2][2] != '班级' || $cjinfo[2][3] != '姓名') - { - $data=['msg'=>'请使用模板上传','val'=>0]; - return json($data); - } - // 判断考试结束时间是否已过 - $enddate = kaoshiDate($kaoshiid,'enddate'); - if($enddate === true) - { - $data=['msg'=>'考试时间已过,不能录入成绩','val'=>0]; - return json($data); - } - - // 删除空单元格得到学科列名数组 - array_splice($cjinfo[1],0,4); - $xk = $cjinfo[1]; - - // 删除成绩采集表无用的标题行得到成绩数组 - array_splice($cjinfo,0,3); - - // 查询考试信息 - $kh = new Kaohao; - // $ks = new \app\kaoshi\model\Kaoshi; - - - $user_id = session('userid'); # 获取用户id - $data = array(); - - - // 重新组合数组 - foreach ($xk as $key => $value) { - // 获取成绩满分 - $manfen = getmanfen($kaoshiid,$value); - # code... - foreach ($cjinfo as $k => $val) { - $defen = $val[$key+4]; # 当前学生当前学科成绩 - // 如果不存在值,跳过这次循环 - if($defen === null){ - continue; - } - // 验证成绩格式,如果不对则跳过 - $mfyz = manfenvalidate($defen,$manfen); - if($mfyz['val'] == 0) - { - continue; - } - - // 添加或更新数据 - $cjone = Chengji::withTrashed() - ->where('kaohao_id',$val[1]) - ->where('subject_id',$value) - ->find(); - // 判断成绩是否存在 - if($cjone) - { - // 如果存在则更新记录 - if($cjone->defen != $defen || $cjone->delete_time > 1) - { - $cjone->restore(); - $cjone->defen = $defen; - $cjone->save(); - } - }else{ - // 如果不存在则新增记录 - $data = [ - 'kaohao_id'=>$val[1], - 'subject_id'=>$value, - 'user_id'=>$user_id, - 'defen'=>$defen - ]; - Chengji::create($data); - } - } - } - - - // 判断成绩更新结果 - $data=['msg'=>'成绩导入成功','val'=>1]; - - // ob_flush(); - // flush(); - // 返回成绩结果 - return json($data); - } - - - // 上传成绩采集表格 - public function upload() - { - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - - // 上传文件并返回结果 - $data = upload($list,$file,true); - - return json($data); - } - - // 成绩列表 public function index($kaoshi) { @@ -471,46 +99,6 @@ class Index extends BaseController } - - - // // 删除成绩 - // public function deletecj($id) - // { - - // // 声明要删除成绩数组 - // $data = array(); - - // if($id == 'm') - // { - // $id = request()->delete('ids/a');// 获取delete请求方式传送过来的数据并转换成数据 - // $i=0; - // foreach ($id as $key => $value) { - // $data[$i]['id'] = $value; - // $data[$i]['yuwen'] = Null; - // $data[$i]['shuxue'] = Null; - // $data[$i]['wanyu'] = Null; - // } - // }else{ - // $data[0]['id'] = $id; - // $data[0]['yuwen'] = Null; - // $data[0]['shuxue'] = Null; - // $data[0]['waiyu'] = Null; - // $data[0]['stuSum'] = Null; - // $data[0]['stuAvg'] = Null; - // } - - - // $cj = new Chengji(); - // $data = $cj->saveAll($data); - - // // 根据更新结果设置返回提示信息 - // $data ? $data=['msg'=>'成绩删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // // 返回信息 - // return json($data); - // } - - // 批量删除成绩 public function deletecjs($kaoshi) { diff --git a/app/chengji/controller/Luru.php b/app/chengji/controller/Luru.php new file mode 100644 index 00000000..81286639 --- /dev/null +++ b/app/chengji/controller/Luru.php @@ -0,0 +1,479 @@ +'desc']) + ->field('id,title') + ->with([ + 'ksNianji' + ,'ksSubject'=>function($query){ + $query->field('id,subjectid,kaoshiid') + ->with(['subjectName'=>function($q){ + $q->field('id,title'); + }] + ); + } + ]) + ->limit(6) + ->select() + ->toArray(); + + + + // 设置要给模板赋值的信息 + $list['webtitle'] = '已录列表'; + $list['dataurl'] = 'luru/data'; + + + // 模板赋值 + $this->view->assign('list',$list); + // 渲染 + return $this->view->fetch(); + } + + + + + // 获取本人录入成绩信息 + public function ajaxData() + { + // 获取参数 + $src = $this->request + ->only(['page','limit','field','type','kaoshi','school','ruxuenian','paixu','searchval' + ],'POST'); + + $src['school'] = strToarray($src['school']); + + // 获取参与考试的班级 + $kh = new \app\kaoshi\model\Kaohao; + $src['banji']= array_column($kh->cyBanji($src), 'id'); + + + // 实例化 + $cj = new Chengji; + + // 查询要显示的数据 + $data = $cj->searchLuru($src); + + // 获取符合条件记录总数 + $cnt = count($data); + // 获取当前页数据 + $limit_start = $src['page'] * $src['limit'] - $src['limit']; + $limit_length = $src['limit']; + $data = array_slice($data,$limit_start,$limit_length); + + // 重组返回内容 + $data = [ + 'code'=> 0 , // ajax请求次数,作为标识符 + 'msg'=>"", // 获取到的结果数(每页显示数量) + 'count'=>$cnt, // 符合条件的总数据量 + 'data'=>$data, //获取到的数据结果 + ]; + + + return json($data); + } + + + + + + + + // 使用二维码录入成绩 + public function malu() + { + // 设置页面标题 + $list['set'] = array( + 'webtitle'=>'扫码录成绩', + 'butname'=>'录入', + 'formpost'=>'PUT', + 'url'=>'/chengji/malu', + ); + + + // 模板赋值 + $this->view->assign('list',$list); + // 渲染 + return $this->view->fetch(); + } + + // 保存使用二维码录入的成绩 + public function malusave() + { + // 获取表单数据 + $list = $this->request->only(['kaohao_id','subject_id','defen'],'post'); + + $kaoshiid = Kaohao::where('id',$list['kaohao_id'])->value('kaoshi'); + // 判断考试结束时间是否已过 + $enddate = kaoshiDate($kaoshiid,'enddate'); + if($enddate === true) + { + $data=['msg'=>'考试时间已过,不能录入成绩','val'=>0]; + return json($data); + } + + // 成绩验证 + $manfen = getmanfen($kaoshiid,$list['subject_id']); + $mfyz = manfenvalidate($list['defen'],$manfen); + if($mfyz['val'] == 0) + { + return json($mfyz); + } + + // 保存成绩 + $cjone = Chengji::withTrashed() + ->where('subject_id',$list['subject_id']) + ->where('kaohao_id',$list['kaohao_id']) + ->find(); + + // 如果存在成绩则更新,不存在则添加 + if($cjone) + { + // 判断记录是否被删除 + if($cjone->delete_time > 1) + { + $cjone->restore(); + } + + if($cjone->defen == $list['defen']) + { + $data=['msg'=>'与原成绩相同,不需要修改。','val'=>1]; + return json($data); + } + + $cjone->defen = $list['defen']; + $data = $cjone->save(); + + }else{ + $data = [ + 'kaohao_id'=>$list['kaohao_id'], + 'subject_id'=>$list['subject_id'], + 'user_id'=>session('userid'), + 'defen'=>$list['defen'] + ]; + $data = Chengji::create($data); + } + + + $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + return json($data); + } + + + // 学生成绩表中修改成绩 + public function update($id) #id为考号ID + { + // 获取表单数据 + $list = $this->request->only( + ['colname', + 'newdefen'] + ,'post'); + $list['kaohao_id'] = $id; + + // 判断考试结束时间是否已过 + $kaoshiid = Kaohao::where('id',$list['kaohao_id'])->value('kaoshi'); + $enddate = kaoshiDate($kaoshiid,'enddate'); + if($enddate === true) + { + $data=['msg'=>'考试时间已过,不能录入成绩','val'=>0]; + return json($data); + } + + + // 获取学科id + $subject = new \app\teach\model\Subject; + $subject_id = $subject->where('lieming',$list['colname'])->value('id'); + + + + // 成绩验证 + $manfen = getmanfen($kaoshiid,$subject_id); + $mfyz = manfenvalidate($list['newdefen'],$manfen); + if($mfyz['val'] == 0) + { + return json($mfyz); + } + + + + // 更新成绩 + $cjone = Chengji::withTrashed() + ->where('kaohao_id',$list['kaohao_id']) + ->where('subject_id',$subject_id) + ->find(); + + + // 如果存在成绩则更新,不存在则添加 + if($cjone) + { + // 判断记录是否被删除 + if($cjone->delete_time > 1) + { + $cjone->restore(); + } + + if($cjone->defen == $list['newdefen']) + { + $data=['msg'=>'与原成绩相同,不需要修改。','val'=>1]; + return json($data); + } + + $cjone->defen = $list['newdefen']; + $data = $cjone->save(); + + }else{ + $data = [ + 'kaohao_id'=>$list['kaohao_id'], + 'subject_id'=>$subject_id, + 'user_id'=>session('userid'), + 'defen'=>$list['newdefen'] + ]; + $data = Chengji::create($data); + } + + // 判断返回内容 + $data ? $data=['msg'=>'录入成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回更新结果 + return json($data); + } + + + + // 根据考号获取学生信息 + public function read() + { + // 获取表单数据 + $val = input('post.val'); + // 实例化系统设置类 + $md5 = new \app\system\controller\Encrypt; + + $val = $md5->decrypt($val,'dlbz'); + $list = explode('|',$val); + $sbj = $list[1]; + + $cjlist = Kaohao::where('id',$list[0]) + ->field('id,banji,school,student') + ->with([ + 'ksChengji'=>function($q) use($sbj){ + $q->where('subject_id',$sbj) + ->field('kaohao_id,subject_id,defen'); + } + ,'cjBanji'=>function($q){ + $q->field('id,paixu,ruxuenian') + ->append(['numTitle','banjiTitle']); + } + ,'cjSchool'=>function($q){ + $q->field('id,jiancheng'); + } + ,'cjStudent'=>function($q){ + $q->field('id,xingming'); + } + ]) + ->find(); + if($cjlist->cjStudent == Null) + { + $stu = new \app\renshi\model\Student; + $stuinfo = $stu::withTrashed() + ->where('id',$cjlist->student) + ->field('id,xingming,sex') + ->find(); + $cjlist->cjStudent = array( + 'id'=>$stuinfo->id, + 'xingming'=>$stuinfo->xingming + ); + } + $cjlist->sbj = Subject::where('id',$sbj)->field('id,title')->find(); + + // 获取列名 + return json($cjlist); + } + + + // 表格录入成绩上传页面 + public function biaolu() + { + + $ks = new \app\kaoshi\model\Kaoshi; + // 获取参考年级 + $list['data'] = $ks::order(['id'=>'desc']) + ->field('id,title') + ->with([ + 'ksNianji' + ,'ksSubject'=>function($query){ + $query->field('id,subjectid,kaoshiid') + ->with(['subjectName'=>function($q){ + $q->field('id,title'); + }] + ); + } + ]) + ->where('enddate','>=',time()) + ->select() + ->toArray(); + + + + // 设置页面标题 + $list['set'] = array( + 'webtitle'=>'表格录入', + 'butname'=>'下载', + 'formpost'=>'POST', + 'url'=>'/kaoshi/kaohao/dwcaiji', + ); + + + // 模板赋值 + $this->view->assign('list',$list); + // 渲染 + return $this->view->fetch(); + } + + + + // 保存表格批量上传的成绩 + public function saveAll() + { + // set_time_limit(0); + // 获以电子表格存储位置 + $url = input('post.url'); + + // 实例化操作表格类 + $excel = new \app\renshi\controller\Myexcel; + + // 读取表格数据 + $cjinfo = $excel->readXls(public_path().'public\\uploads\\'.$url); + + $kaoshiid = $cjinfo[1][0]; #获取考号 + + + if($kaoshiid == null || $cjinfo[2][0] != '序号' || $cjinfo[2][1] != '编号' || $cjinfo[2][2] != '班级' || $cjinfo[2][3] != '姓名') + { + $data=['msg'=>'请使用模板上传','val'=>0]; + return json($data); + } + // 判断考试结束时间是否已过 + $enddate = kaoshiDate($kaoshiid,'enddate'); + if($enddate === true) + { + $data=['msg'=>'考试时间已过,不能录入成绩','val'=>0]; + return json($data); + } + + // 删除空单元格得到学科列名数组 + array_splice($cjinfo[1],0,4); + $xk = $cjinfo[1]; + + // 删除成绩采集表无用的标题行得到成绩数组 + array_splice($cjinfo,0,3); + + // 查询考试信息 + $kh = new Kaohao; + // $ks = new \app\kaoshi\model\Kaoshi; + + + $user_id = session('userid'); # 获取用户id + $data = array(); + + + // 重新组合数组 + foreach ($xk as $key => $value) { + // 获取成绩满分 + $manfen = getmanfen($kaoshiid,$value); + # code... + foreach ($cjinfo as $k => $val) { + $defen = $val[$key+4]; # 当前学生当前学科成绩 + // 如果不存在值,跳过这次循环 + if($defen === null){ + continue; + } + // 验证成绩格式,如果不对则跳过 + $mfyz = manfenvalidate($defen,$manfen); + if($mfyz['val'] == 0) + { + continue; + } + + // 添加或更新数据 + $cjone = Chengji::withTrashed() + ->where('kaohao_id',$val[1]) + ->where('subject_id',$value) + ->find(); + // 判断成绩是否存在 + if($cjone) + { + // 如果存在则更新记录 + if($cjone->defen != $defen || $cjone->delete_time > 1) + { + $cjone->restore(); + $cjone->defen = $defen; + $cjone->save(); + } + }else{ + // 如果不存在则新增记录 + $data = [ + 'kaohao_id'=>$val[1], + 'subject_id'=>$value, + 'user_id'=>$user_id, + 'defen'=>$defen + ]; + Chengji::create($data); + } + } + } + + + // 判断成绩更新结果 + $data=['msg'=>'成绩导入成功','val'=>1]; + + // ob_flush(); + // flush(); + // 返回成绩结果 + return json($data); + } + + + // 上传成绩采集表格 + public function upload() + { + // 获取文件信息 + $list['text'] = $this->request->post('text'); + $list['serurl'] = $this->request->post('serurl'); + + // 获取表单上传文件 + $file = request()->file('file'); + + // 上传文件并返回结果 + $data = upload($list,$file,true); + + return json($data); + } + + + + + + + + + +} diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index 63cc1371..69c2cf92 100644 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -28,14 +28,79 @@ class Chengji extends Base } - // 列出要显示的学生成绩 + + // 列出已录成绩列表 + public function searchLuru($srcfrom) + { + // 初始化参数 + $src = array( + 'field'=>'banji', + 'type'=>'desc', + 'kaoshi'=>'0', + 'banji'=>array(), + 'subject_id'=>array(), + 'searchval'=>array(), + 'user_id'=>session('userid'); + ); + + // 用新值替换初始值 + $src = array_cover( $srcfrom , $src ) ; + $banji = strToarray($src['banji']); + $subject_id = strToarray($src['subject_id']); + $kaoshi = $src['kaoshi']; + $searchval = $src['searchval']; + + // 获取参加考试时间 + $ks = new app\kaoshi\model\Kaoshi; + $enddate = $ks->where('id',$kaoshiid)->value('enddate'); + + $nianji = nianjiList($enddate); + + + + $cjList = $this + ->where('user_id'=>$src['user_id']) + ->when(count($subject_id)>0,function($query)use($subject_id){ + $query->where('subjectid','in',$subject_id); + }) + ->where('kaohao_id','in',function($query)use($banji,$kaoshi,$searchval,$nianji){ + $query->name('kaohao') + ->where('kaoshi',$kaoshi) + ->where(count($banji)>0,function($q)use($banji){ + $q->where('banji','in',$banji); + }) + ->when(strlen($searchval>0),function($w)use($searchval,$nianji){ + $w->name('student') + ->where('banji','in',function($x)use($nianji){ + $x->name('banji') + ->where('ruxuenian','in',$nianji) + ->field('id'); + }) + ->where('xingminng','like','%'.$searchval.'%') + ->field('id'); + }); + }) + ->select(); + halt($cjList->toArray()); + + + return true; + + + + + + + } + + + + // 列出要显示的学生所有学科成绩 public function search($srcfrom) { // 初始化参数 $src = array( - 'page'=>'1', - 'limit'=>'10', 'field'=>'banji', 'type'=>'desc', 'kaoshi'=>'', diff --git a/app/chengji/route/chengji.php b/app/chengji/route/chengji.php index 34dfcbd8..a3c93cc5 100644 --- a/app/chengji/route/chengji.php +++ b/app/chengji/route/chengji.php @@ -13,13 +13,6 @@ use think\facade\Route; // 成绩管理 Route::group('index', function () { - Route::rule('malu','Index/malu','get'); # 扫码界面 - Route::rule('malusave','Index/malusave','put'); # 扫码保存 - Route::rule('read','Index/read','post'); # 成绩读取 - Route::rule('biaolu','Index/biaolu','get'); # 保存信息 - Route::rule('saveall','Index/saveAll','post'); # 读取信息 - Route::rule('edit/','Index/edit','get'); # 修改信息 - Route::rule('update/','Index/update','put'); # 更新信息 Route::rule('list/','Index/index','get'); # 成绩列表 Route::rule('data','Index/ajaxData','post'); # 成绩获取 Route::rule('readcjadd/','Index/readAdd','get'); # 成绩录入列表 @@ -65,4 +58,18 @@ Route::group('schtj', function () { Route::rule('biaoge/','Schtongji/biaoge','get'); # 班级表格 Route::rule('data','Schtongji/ajaxData','post'); # 扫码界面 Route::rule('tongji','Schtongji/tongji','post'); # 统计各年级成绩 - }); \ No newline at end of file + }); + +// 录入 +Route::group('luru', function () { + Route::rule('malu','Luru/malu','get'); # 扫码界面 + Route::rule('malusave','Luru/malusave','put'); # 扫码保存 + Route::rule('read','Luru/read','post'); # 扫码后读取成绩 + Route::rule('biaolu','Luru/biaolu','get'); # 表格录入界面 + Route::rule('saveall','Luru/saveAll','post'); # 保存表格录入信息 + Route::rule('edit/','Luru/edit','get'); # 修改信息 + Route::rule('update/','Luru/update','put'); # 更新信息 + Route::rule('','Luru/index','get'); # 成绩获取 + Route::rule('data','Luru/ajaxData','post'); # 成绩获取 + }); + diff --git a/app/chengji/view/index/biaolu.html b/app/chengji/view/index/biaolu.html deleted file mode 100644 index eee99938..00000000 --- a/app/chengji/view/index/biaolu.html +++ /dev/null @@ -1,141 +0,0 @@ -{extend name=".././view/create.html" /} - -{block name="form"} - -
- 表格录入 -
- -
-
-
-
-
1、载成绩采集表
-
- - -
-
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - -
-
-
- {volist name="$list.data.nianji" id="vo"} - -
- -
- {php} - if($key==0){ - $nianji = $vo['id']; - }else{ - $nianji = $nianji.','.$vo['id']; - } - {/php} - {/volist} -
- -
- -
-
- - - - - - - - - - - - - - - -
-
-
- -
-
-
2、上传成绩
-
-

-

-
-
- -
-
- - -
-
-
-
-
-
- - -
-
- - -{/block} - -{block name="myjs"} - -{/block} - diff --git a/app/chengji/view/index/biaoqian.html b/app/chengji/view/luru/biaolu.html similarity index 92% rename from app/chengji/view/index/biaoqian.html rename to app/chengji/view/luru/biaolu.html index f174d44b..bad6e492 100644 --- a/app/chengji/view/index/biaoqian.html +++ b/app/chengji/view/luru/biaolu.html @@ -107,37 +107,18 @@ -
-
-
-
-
-
- 3、查看已录成绩 -
-
-
- 这里是表格 -
-
-
-
-
-
- 这是底线 + + {/block} {block name="myjs"} diff --git a/app/chengji/view/luru/index.html b/app/chengji/view/luru/index.html new file mode 100644 index 00000000..1fc391d5 --- /dev/null +++ b/app/chengji/view/luru/index.html @@ -0,0 +1,133 @@ + +{extend name=".././view/list.html" /} +{block name="jsset"} + +{/block} +{block name="nav"} + + 成绩采集 + 已录成绩 + +{/block} +{block name="search"} +
+ +
+ +
+
+
+ +
+ {php} $category = getCategory('课题立项类型');{/php} + + + {volist name="category" id="vo"} + + {/volist} +
+
+
+ +
+ {php} $school = schlist('区级','其它级'); {/php} + {volist name="school" id="vo"} + + {/volist} +
+
+{/block} +{block name="table"} +
+{/block} +{block name="myjs"} + + + + + + +{/block} \ No newline at end of file diff --git a/app/chengji/view/index/malu.html b/app/chengji/view/luru/malu.html similarity index 98% rename from app/chengji/view/index/malu.html rename to app/chengji/view/luru/malu.html index 57f74ebe..69f6e655 100644 --- a/app/chengji/view/index/malu.html +++ b/app/chengji/view/luru/malu.html @@ -49,7 +49,7 @@ // 查询并显示学生信息 $.ajax({ type: 'POST', - url: "/chengji/index/read", + url: "/chengji/luru/read", data:{ val:$('#saoma').val() }, @@ -82,7 +82,7 @@ // 查询并显示学生信息 $.ajax({ type: 'PUT', - url: "/chengji/index/malusave", + url: "/chengji/luru/malusave", data:{ subject_id:$('#subject_id').val() ,kaohao_id:$('#kaohao_id').val() diff --git a/app/common.php b/app/common.php index 020c1847..b27ccd12 100644 --- a/app/common.php +++ b/app/common.php @@ -328,7 +328,7 @@ function array_cover( $cover = array(), $covered = array() ) function kaoshiDate($kaoshiid,$str='enddate') { $ks = new app\kaoshi\model\Kaoshi; - $enddate = $ks->where('id',$kaoshiid)->value('enddate'); + $enddate = $ks->where('id',$kaoshiid)->value($str); $thistime = time(); if( $thistime > $enddate ) diff --git a/app/index/view/index/welcome.html b/app/index/view/index/welcome.html index bdc524fe..0b45ef38 100644 --- a/app/index/view/index/welcome.html +++ b/app/index/view/index/welcome.html @@ -101,7 +101,7 @@ - 新版正式上线了!前端改成X-admin,后端代码重构,看着更舒服使用更顺手。下载后会有意外收获哦~ + {$list.webtitle}{$list.version}正式上线了!重构表格录入界面,增加成绩统计速度,细化下载表格格式。下载后会有意外收获哦~ diff --git a/app/login/view/index/shangma_log.html b/app/login/view/index/shangma_log.html index 6e2d2e30..9f5190bb 100644 --- a/app/login/view/index/shangma_log.html +++ b/app/login/view/index/shangma_log.html @@ -35,6 +35,25 @@
    +
  • + +
    +

    2020-01-12

    +

    + 将与表格录入相关功能整合到同一个页面。 +
    + 美化导出表格格式,有3个学科参加考试可以直接打印汇总表。 +
    + 取消上传成绩表格成功提示,避免因没有单击“批传”而出现成绩没有导入的情况。 +
    + 修复已知错误。 +
    + 增加统计成绩时的加载动画,避免多次重复提交。 +
    + 将成绩录入相关操作放到独立控制中 +

    +
    +
  • @@ -50,7 +69,6 @@

    2020-01-02

    升级ThinkPHP到6.0.1 -

  • diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index 524e92a4..f162eb6c 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -27,8 +27,9 @@ class Rule extends Seeder ['id'=>9,'title'=>'课题管理','name' =>'keti','paixu' =>7,'ismenu' =>1,'font' =>'','status'=>0], // 二级菜单 // 成绩采集 - ['id'=>101,'title'=>'扫码录入','name'=>'chengji/Index/malu','paixu'=>1,'ismenu' =>1,'pid' =>1,'url'=>'/chengji/index/malu',], - ['id'=>102,'title'=>'表格录入','name'=>'chengji/Index/biaolu','paixu'=>2,'ismenu' =>1,'pid' =>1,'url'=>'/chengji/index/biaolu',], + ['id'=>101,'title'=>'扫码录入','name'=>'chengji/luru/malu','paixu'=>1,'ismenu' =>1,'pid' =>1,'url'=>'/chengji/luru/malu',], + ['id'=>102,'title'=>'表格录入','name'=>'chengji/luru/biaolu','paixu'=>2,'ismenu' =>1,'pid' =>1,'url'=>'/chengji/luru/biaolu',], + ['id'=>103,'title'=>'已录列表','name'=>'chengji/luru/index','paixu'=>2,'ismenu' =>1,'pid' =>1,'url'=>'/chengji/luru',], // 成绩统计 ['id'=>201,'title'=>'班级成绩','name'=>'tongji/Index/banji','paixu'=>1,'ismenu' =>1,'pid' =>2,'url'=>'/tongji',], // 考试管理 @@ -75,12 +76,12 @@ class Rule extends Seeder // 扫码录入 - ['title'=>'扫码查询','name'=>'Chengji/Index/read','paixu' =>1,'pid'=>101,'id'=>1000000], - ['title'=>'扫码保存','name'=>'Chengji/Index/malusave','paixu' =>2,'pid'=>101], + ['title'=>'扫码查询','name'=>'Chengji/Luru/read','paixu' =>1,'pid'=>101,'id'=>1000000], + ['title'=>'扫码保存','name'=>'Chengji/Luru/malusave','paixu' =>2,'pid'=>101], // 表格录入 - ['title'=>'表格保存','name'=>'Chengji/Index/saveAll','paixu' =>3,'pid'=>102], - ['title'=>'表格上传','name'=>'Chengji/Index/upload','paixu' =>4,'pid'=>102], - ['title'=>'成绩更新','name'=>'Chengji/Index/update','paixu' =>5,'pid'=>102], + ['title'=>'表格保存','name'=>'Chengji/Luru/saveAll','paixu' =>3,'pid'=>102], + ['title'=>'表格上传','name'=>'Chengji/Luru/upload','paixu' =>4,'pid'=>102], + ['title'=>'成绩更新','name'=>'Chengji/Luru/update','paixu' =>5,'pid'=>102], // 考试管理