SStudentAnswerCardOnline.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Created by 上海互教教育科技有限公司.
  4. * User: li
  5. * QQ : 454303753
  6. * Date: 2022/11/20 0020
  7. * Time: 下午 13:52
  8. */
  9. class SStudentAnswerCardOnline extends MyActiveRecord{
  10. public static function model($className = __CLASS__){
  11. return parent::model($className);
  12. }
  13. public function tableName(){
  14. return 'student_answer_card_online';
  15. }
  16. public function getTimeByExamId($examIds){
  17. if(!$examIds || !is_array($examIds)){
  18. return false;
  19. }
  20. $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";
  21. $data=$this->getDbConnection()->createCommand($sql)->queryAll();
  22. return $data;
  23. }
  24. public function getCountByExamId($examId){
  25. if(!$examId ){
  26. return false;
  27. }
  28. $sql="select count(*) as count from student_answer_card_online where exam_id='".$examId."' and answer_card_online_created=1";
  29. $data=$this->getDbConnection()->createCommand($sql)->queryRow();
  30. return $data;
  31. }
  32. public function countStudentCreateCount($examIds){
  33. if(!$examIds || !is_array($examIds)){
  34. return false;
  35. }
  36. $sql="select count(*) as count from student_answer_card_online where exam_id in(".implode(',',$examIds).") and answer_card_online_created=1";
  37. $data=$this->getDbConnection()->createCommand($sql)->queryRow();
  38. if($data){
  39. return $data[0];
  40. }else{
  41. return 0;
  42. }
  43. }
  44. }