From 9f8ca37dd70a60cd6decc62784d9362bda62c734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Mon, 3 Dec 2018 16:41:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=90=E7=BB=A9=E5=92=8C?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/chengji/controller/Index.php | 31 ++++- application/chengji/controller/Tongji.php | 4 - application/chengji/model/Chengji.php | 15 ++- application/chengji/view/index/biaolu.html | 2 +- .../chengji/view/index/chengjilist.html | 5 +- application/chengji/view/index/edit.html | 90 ++++++++++++++ application/chengji/view/index/malu.html | 2 +- application/kaoshi/controller/Index.php | 4 +- .../kaoshi/view/more_action/index.html | 4 +- application/renshi/controller/Student.php | 75 +++++++----- application/renshi/model/Student.php | 57 ++++++--- .../renshi/view/student/create_all.html | 2 +- application/renshi/view/student/index.html | 110 +++++++++++++++++- route/chengji.php | 2 +- 14 files changed, 337 insertions(+), 66 deletions(-) create mode 100644 application/chengji/view/index/edit.html diff --git a/application/chengji/controller/Index.php b/application/chengji/controller/Index.php index 437029a7..5888b14c 100644 --- a/application/chengji/controller/Index.php +++ b/application/chengji/controller/Index.php @@ -37,8 +37,35 @@ class Index extends Base empty($cj) ? $data = ['val' => 0] : $data = ['val' => 1,'defen'=>$cj->$zd]; return json($data); + } + + public function edit($id) + { + // 获取该学生成绩信息 + $cj = Chengji::where('id',$id)->append(['cj_student.xingming'])->find(); + // 模板赋值 + $cj->title = $cj->cjKaoshi->title; + $this->assign('list',$cj); + // 渲染 + return $this->fetch(); + } + + + public function update($id) + { + // 获取表单数据 + $list = request()->param(); + + // 更新成绩 + $data = Chengji::update($list); + + // 判断返回内容 + $data ? $data=['msg'=>'录入成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回更新结果 + return $data; } @@ -56,11 +83,11 @@ class Index extends Base $zdname = $subject[$list['ziduan']][1]; $stuinfo = Chengji::where('id',$list['id']) ->field('id,school,student,banji,'.$zd) - // ->append(['banjiname']) + ->append(['cj_school.jiancheng','cj_banji.title','cj_student.xingming']) ->find(); $stuinfo['zdname'] = $zdname; $stuinfo['zdstr'] = $zd; - return json($stuinfo->visible(['student','school','banji',$zd,'zdstr','zdname'])); + return json($stuinfo->visible(['cj_student.xingming','cj_school.jiancheng','cj_banji.title',$zd,'zdstr','zdname'])); } diff --git a/application/chengji/controller/Tongji.php b/application/chengji/controller/Tongji.php index 0bc0e41e..a7d117d9 100644 --- a/application/chengji/controller/Tongji.php +++ b/application/chengji/controller/Tongji.php @@ -16,10 +16,6 @@ class Tongji extends Base // 根据考试号和年级获取考试成绩 $cjlist = $cj->searchNianji(1,'一年级'); - - - - $tj = new \app\chengji\model\Tongji(); $yuwen = $cjlist->column('yuwen'); dump($yuwen); diff --git a/application/chengji/model/Chengji.php b/application/chengji/model/Chengji.php index 136b7db2..649ed0dc 100644 --- a/application/chengji/model/Chengji.php +++ b/application/chengji/model/Chengji.php @@ -69,9 +69,14 @@ class Chengji extends Base // 满分 public function cjManfen() { - return $this->belongsTo('\app\kaoshi\model\KaoshiSubject','kaoshi','kaoshiid'); + return $this->hasMany('\app\kaoshi\model\KaoshiSubject','kaoshiid','kaoshi'); } + // 考试关联 + public function cjKaoshi() + { + return $this->belongsTo('\app\kaoshi\model\Kaoshi','kaoshi','id'); + } @@ -141,16 +146,16 @@ class Chengji extends Base $data = $this->scope('kaoshi',$kaoshiid) - ->when($schoolid!='',function($query) use($schoolid){ + ->when(!empty($schoolid),function($query) use($schoolid){ $query->where('school','in',$schoolid); }) - ->when($nianji!='',function($query) use($nianji){ + ->when(!empty($nianji),function($query) use($nianji){ $query->where('nianji','in',$nianji); }) - ->when($banji!='',function($query) use($banji){ + ->when(!empty($banji),function($query) use($banji){ $query->where('banji','in',$banji); }) - ->when($search!='',function($query) use($search){ + ->when(!empty($searc),function($query) use($search){ $query->where('student','in',function ($q) use($search){ $q->name('student')->where('xingming','like','%'.$search.'%')->field('id'); }); diff --git a/application/chengji/view/index/biaolu.html b/application/chengji/view/index/biaolu.html index 7bc9d402..d16eff21 100644 --- a/application/chengji/view/index/biaolu.html +++ b/application/chengji/view/index/biaolu.html @@ -80,7 +80,7 @@ }, fileNumLimit: 1, // 上传文件数 - fileSizeLimit:51200, + fileSizeLimit:2*1021*1024, }); uploader.on( 'fileQueued', function( file ) { var $li = $( diff --git a/application/chengji/view/index/chengjilist.html b/application/chengji/view/index/chengjilist.html index 4b86727e..104dbaa8 100644 --- a/application/chengji/view/index/chengjilist.html +++ b/application/chengji/view/index/chengjilist.html @@ -34,7 +34,8 @@ $school = $school->searchMany('校级','校级'); {/php}
-
{foreach $school as $key=>$vo } +
+ {foreach $school as $key=>$vo }