修改成绩和学生查询
This commit is contained in:
1 parent
165b6ec734
commit
9f8ca37dd7
14 files changed
+337
-66
No files matched your search
@@ -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']));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,10 +16,6 @@ class Tongji extends Base
|
||||
// 根据考试号和年级获取考试成绩
|
||||
$cjlist = $cj->searchNianji(1,'一年级');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$tj = new \app\chengji\model\Tongji();
|
||||
$yuwen = $cjlist->column('yuwen');
|
||||
dump($yuwen);
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
Loaded 3 of 14 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user