addCondition('exam_group_id=:exam_group_id'); $criteria->params[':exam_group_id']=$ExamGroupId; $data = getAttributes($this->findAll($criteria)); if($data){ foreach ($data as $val){ $result[$val['template_type']]=$val; } } return $result; } /** * 获取多个答案和题上传完成的组id * @param $examGroupIds * @return array */ public function getMulUploadGroupId($examGroupIds){ $group_ids = array(); if($examGroupIds){ $sql = "SELECT exam_group_id,topic_upload,answer_upload,template_type FROM third_multi_template where exam_group_id in (".implode(',',$examGroupIds).") "; $upload_info = $this->queryAll($sql); $rs = array(); if($upload_info){ foreach($upload_info as $v){ if(!isset($rs[$v['exam_group_id']])){ $rs[$v['exam_group_id']] = 0; } if($v['template_type'] == 1){ if($v['topic_upload'] == 1){ $rs[$v['exam_group_id']]++; } }elseif($v['template_type'] == 2){ if($v['answer_upload'] == 1){ $rs[$v['exam_group_id']]++; } } } unset($upload_info); } if($rs){ foreach($rs as $gId => $v){ if($v == 2){ $group_ids[] = $gId; } } } } return $group_ids; } }