123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- /**
- * @author: CeeFee
- * @description: 考试
- */
- class AStudentScanTask extends BusinessActiveRecord {
- public static function model($className = __CLASS__){
- return parent::model($className);
- }
- public function tableName(){
- return "assist_student_scan_task";
- }
- public function primaryKey(){
- return array('task_id');
- }
- //读取任务类别
- public function getTaskTypesByExamGroupId($examGroupId){
- if(!$examGroupId){
- return null;
- }
- $selectSql="(select task_id,task_type from assist_student_scan_task where task_type=1 and exam_group_id='{$examGroupId}' limit 1)
- union
- (select task_id,task_type from assist_student_scan_task where task_type=2 and exam_group_id='{$examGroupId}' limit 1)
- union
- (select task_id,task_type from assist_student_scan_task where task_type=3 and exam_group_id='{$examGroupId}' limit 1)
- union
- (select task_id,task_type from assist_student_scan_task where task_type=4 and exam_group_id='{$examGroupId}' limit 1) ";
- $data=$this->getDbConnection()->createCommand($selectSql)->queryAll();
- $taskType=array(
- 1=>'组卷--Word',
- 2=>"组卷--在线答题卡",
- 3=>'第三方--切割模板',
- 4=>'第三方--在线答题卡'
- );
- $result=array();
- if($data){
- foreach ($data as $val){
- $result[$val['task_type']]=$taskType[$val['task_type']];
- }
- }
- return $result;
- }
- //查询任务数量
- public function getTaskCount($examGroupId){
- if(!$examGroupId){
- return null;
- }
- $sql="select task_id,status from assist_student_scan_task where exam_group_id='{$examGroupId}'";
- $data=$this->getDbConnection()->createCommand($sql)->queryAll();
- $result=array();
- $result['total']=count($data);
- $result['surplus']=0;
- $result['processed']=0;
- if($data){
- foreach($data as $val){
- if($val['status']==1){
- $result['processed']++;
- }else{
- $result['surplus']++;
- }
- }
- }
- return $result;
- }
- }
|