12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- /**
- * @author: Rick Guo
- * @brief: 学校管理器
- */
- class AssistSchoolManager extends AssistModel {
- public $coachId;
- public $coach;
- public $coachRole;
- public $role;
- function __construct($schoolId){
- parent::__construct($schoolId);
- }
- //查询考试上传学生数量
- public function getStudentCountByExamGroupId($examGroupId,$hasFeedback=0){
- if(!$examGroupId){
- return null;
- }
- $result=array();
- $result['total']=0; //总数
- $result['is_feedback']=0; // 已扫描
- $result['is_del']=0; //缺考
- $result['abnormal']=0; //异常总量
- $result['complete']=0; //完成数量
- $result['surplus']=0; //剩余量
- $sql="select exam_id from exam where exam_group_id='{$examGroupId}'";
- $data=$this->sConn->createCommand($sql)->queryAll();
- $examIds=array();
- if($data){
- if($hasFeedback){
- foreach ($data as $val){
- $examIds[]=$val['exam_id'];
- }
- $studentSql="select student_id,is_feedback,is_del from student_paper_relation where exam_id in(".implode(',',$examIds).")";
- $studentData=$this->sConn->createCommand($studentSql)->queryAll();
- if($studentData){
- foreach ($studentData as $val){
- if($val['is_feedback']==1){
- $result['is_feedback']++;
- }
- if($val['is_del']==1){
- $result['is_del']++;
- }else{
- $result['total']++;
- }
- }
- }
- }
- $abnormalSql="select status from assist_student_scan_task where exam_group_id = '{$examGroupId}'";
- $abnormalData=$this->conn->createCommand($abnormalSql)->queryAll();
- if($abnormalData){
- $result['abnormal']=count($abnormalData);
- foreach ($abnormalData as $val){
- if($val['status']==0){
- $result['surplus']++;
- }
- if($val['status']==1){
- $result['complete']++;
- }
- }
- }
- }
- return $result;
- }
- //查询待处理数据
- public function getSurplusDataByExamGroupId($examGroupId){
- $abnormalSql="select status,task_id,`data` from assist_student_scan_task where exam_group_id = '{$examGroupId}' and status=0";
- $abnormalData=$this->conn->createCommand($abnormalSql)->queryAll();
- $result=array();
- if($abnormalData){
- foreach ($abnormalData as $val){
- $result[]=array(
- 'task_id'=>$val['task_id'],
- 'student'=>$val['data']
- );
- }
- }
- return $result;
- }
- }
|