获取教师成绩
This commit is contained in:
1 parent
0461d71ca4
commit
fabe9325c4
6 files changed
+639
-18
No files matched your search
@@ -63,18 +63,7 @@ class Bjtongji extends AdminBase
|
||||
// 统计成绩
|
||||
$btj = new BTJ;
|
||||
$data = $btj->search($src);
|
||||
|
||||
// 获取记录总数
|
||||
$cnt = count($data);
|
||||
// 截取当前页数据
|
||||
$data = array_slice($data, ($src['page'] - 1) * $src['limit'], $src['limit']);
|
||||
// 重组返回内容
|
||||
$data = [
|
||||
'code'=> 0 , // ajax请求次数,作为标识符
|
||||
'msg'=>"", // 获取到的结果数(每页显示数量)
|
||||
'count'=>$cnt, // 符合条件的总数据量
|
||||
'data'=>$data, //获取到的数据结果
|
||||
];
|
||||
$data = reSetArray($data, $src);
|
||||
|
||||
return json($data);
|
||||
}
|
||||
|
||||
@@ -331,15 +331,20 @@ class TongjiBj extends BaseModel
|
||||
,'subject_id' => array()
|
||||
,'school_id' => ''
|
||||
,'ruxuenian' => ''
|
||||
,'teacher_id' => ''
|
||||
);
|
||||
$src = array_cover($srcfrom, $src);
|
||||
$src['banji_id'] = strToarray($src['banji_id']);
|
||||
$src['subject_id'] = strToarray($src['subject_id']);
|
||||
$src['teacher_id'] = strToarray($src['teacher_id']);
|
||||
|
||||
$data = $this->where('kaoshi_id', $src['kaoshi_id'])
|
||||
->when(count($src['banji_id']) > 0, function ($query) use($src) {
|
||||
$query->where('banji_id', 'in', $src['banji_id']);
|
||||
})
|
||||
->when(count($src['teacher_id']) > 0, function ($query) use($src) {
|
||||
$query->where('teacher_id', 'in', $src['teacher_id']);
|
||||
})
|
||||
->where('banji_id', 'in', function ($query) use($src) {
|
||||
$query->name('banji')
|
||||
->when(strlen($src['school_id']) > 0, function ($q) use ($src) {
|
||||
@@ -361,6 +366,72 @@ class TongjiBj extends BaseModel
|
||||
}
|
||||
|
||||
|
||||
// 查询与指定教师相关的所有考试成绩
|
||||
public function searchTeacher($srcfrom)
|
||||
{
|
||||
// 初始化参数
|
||||
$src = array(
|
||||
'xueqi_id' => ''
|
||||
,'category_id' => array()
|
||||
,'subject_id' => array()
|
||||
,'teacher_id' => 0
|
||||
,'bfdate' => ''
|
||||
,'enddate' => ''
|
||||
);
|
||||
$src = array_cover($srcfrom, $src);
|
||||
$src['xueqi_id'] = strToarray($src['xueqi_id']);
|
||||
$src['subject_id'] = strToarray($src['subject_id']);
|
||||
$src['category_id'] = strToarray($src['category_id']);
|
||||
|
||||
if(isset($srcfrom['bfdate']) && strlen($srcfrom['bfdate'])>0)
|
||||
{
|
||||
$src['bfdate'] = $srcfrom['bfdate'];
|
||||
}else{
|
||||
$src['bfdate'] = date("Y-m-d",strtotime("-1 year"));
|
||||
}
|
||||
|
||||
if(isset($srcfrom['enddate']) && strlen($srcfrom['enddate'])>0)
|
||||
{
|
||||
$src['enddate'] = $srcfrom['enddate'];
|
||||
}else{
|
||||
$src['enddate'] = date("Y-m-d",strtotime("+1 day"));
|
||||
}
|
||||
|
||||
$data = $this->where('teacher_id', $src['teacher_id'])
|
||||
->where('subject_id', '<>', 0)
|
||||
->when(count($src['subject_id']) > 0, function ($query) use($src) {
|
||||
$query->where('subject_id', 'in', $src['subject_id']);
|
||||
})
|
||||
->where('kaoshi_id', 'in', function ($query) use($src) {
|
||||
$query->name('kaoshi')
|
||||
->whereTime('bfdate|enddate', 'between', [$src['bfdate'], $src['enddate']])
|
||||
->when(count($src['xueqi_id'])>0, function ($q) use($src) {
|
||||
$q->where('xueqi_id', 'in', function ($w) use($src) {
|
||||
$w->name('xueqi')
|
||||
->where('category_id', 'in', $src['xueqi_id'])
|
||||
->field('id');
|
||||
});
|
||||
})
|
||||
->when(count($src['category_id'])>0, function ($q) use($src) {
|
||||
$q->where('category_id', 'in', $src['category_id']);
|
||||
})
|
||||
->field('id');
|
||||
})
|
||||
->with([
|
||||
'bjSubject' => function ($query) {
|
||||
$query->field('id, title, jiancheng');
|
||||
}
|
||||
,'bjKaoshi' => function ($query) {
|
||||
$query->field('id, title, enddate');
|
||||
}
|
||||
])
|
||||
->append(['banjiTitle'])
|
||||
->select();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
// 查询任课教师
|
||||
public function renke($srcfrom)
|
||||
{
|
||||
|
||||
@@ -41,8 +41,12 @@ class Index extends TeacherSearchBase
|
||||
,'font' => ''
|
||||
,'authCid' => [
|
||||
[
|
||||
'title' => '成绩查询一'
|
||||
,'url' => ''
|
||||
'title' => '班级成绩'
|
||||
,'url' => '/teachersearchchengji/index/banji'
|
||||
]
|
||||
, [
|
||||
'title' => '学生成绩'
|
||||
,'url' => '/teachersearchchengji/index/databanji'
|
||||
]
|
||||
]
|
||||
]
|
||||
@@ -121,9 +125,8 @@ class Index extends TeacherSearchBase
|
||||
|
||||
|
||||
// 学生查询页首页
|
||||
public function read($kaohao_id)
|
||||
public function read($teacher_id)
|
||||
{
|
||||
halt('aa');
|
||||
$kh = new \app\kaohao\model\Kaohao;
|
||||
$khInfo = $kh->where('id', $kaohao_id)
|
||||
->with([
|
||||
@@ -203,4 +206,50 @@ class Index extends TeacherSearchBase
|
||||
// 返回信息
|
||||
return json($data);
|
||||
}
|
||||
|
||||
|
||||
// 班级成绩列表
|
||||
public function banji()
|
||||
{
|
||||
$teacher_id = session('teacher.userid');
|
||||
$list['teacher_id'] = $teacher_id;
|
||||
|
||||
$sbj = new \app\teach\model\Subject;
|
||||
$list['subject'] = $sbj->kaoshi();
|
||||
|
||||
// 设置要给模板赋值的信息
|
||||
$list['webtitle'] = '班级成绩列表';
|
||||
$list['dataurl'] = '/teachersearchchengji/index/banjidata';
|
||||
|
||||
// 模板赋值
|
||||
$this->view->assign('list', $list);
|
||||
|
||||
// 渲染模板
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
// 获取班级成绩数据
|
||||
public function ajaxDataBanji()
|
||||
{
|
||||
// 获取参数
|
||||
$src = $this->request
|
||||
->only([
|
||||
'page' => '1'
|
||||
,'limit' => '10'
|
||||
,'teacher_id' => ''
|
||||
,'xueqi_id' => ''
|
||||
,'category_id' => array() # 考试类型
|
||||
,'subject_id' => array()
|
||||
,'bfdate' => ''
|
||||
,'enddate' => ''
|
||||
], 'POST');
|
||||
|
||||
// 统计成绩
|
||||
$btj = new \app\chengji\model\TongjiBj;
|
||||
$data = $btj->searchTeacher($src);
|
||||
$data = reSetObject($data, $src);
|
||||
|
||||
return json($data);
|
||||
}
|
||||
}
|
||||
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user