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 }