123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * Created by 上海互教教育科技有限公司.
- * User: li
- * QQ : 454303753
- * Date: 2022/11/20 0020
- * Time: 下午 13:52
- */
- class SStudentAnswerCardOnline extends MyActiveRecord{
- public static function model($className = __CLASS__){
- return parent::model($className);
- }
- public function tableName(){
- return 'student_answer_card_online';
- }
- public function getTimeByExamId($examIds){
- if(!$examIds || !is_array($examIds)){
- return false;
- }
- $sql="SELECT count(*) as count,class_id,create_time from (SELECT class_id,create_time FROM `student_answer_card_online` where exam_id in(".implode(',',$examIds).") and answer_card_online_created=1 order by create_time desc) t GROUP BY class_id";
- $data=$this->getDbConnection()->createCommand($sql)->queryAll();
- return $data;
- }
- public function getCountByExamId($examId){
- if(!$examId ){
- return false;
- }
- $sql="select count(*) as count from student_answer_card_online where exam_id='".$examId."' and answer_card_online_created=1";
- $data=$this->getDbConnection()->createCommand($sql)->queryRow();
- return $data;
- }
- public function countStudentCreateCount($examIds){
- if(!$examIds || !is_array($examIds)){
- return false;
- }
- $sql="select count(*) as count from student_answer_card_online where exam_id in(".implode(',',$examIds).") and answer_card_online_created=1";
- $data=$this->getDbConnection()->createCommand($sql)->queryRow();
- if($data){
- return $data[0];
- }else{
- return 0;
- }
- }
- }
|