SExamRestore.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * @author: CeeFee
  4. * @description: 考试
  5. */
  6. class SExamRestore extends MyActiveRecord {
  7. public static function model($className = __CLASS__)
  8. {
  9. return parent::model($className);
  10. }
  11. public function tableName()
  12. {
  13. return 'exam_restore';
  14. }
  15. public function getList($examName,$page,$pageLimit){
  16. $result=array();
  17. $where =" is_del = 0 ";
  18. if($examName){
  19. $where.=" And exam_name like '%".$examName."%' ";
  20. }
  21. $connect = $this->getDbConnection();
  22. $dataCount = $connect->createCommand()
  23. ->from('exam_restore')
  24. ->where($where)
  25. ->query()
  26. ->count();
  27. $result['totalCount']=$dataCount;
  28. $result['pageTotal']=ceil($dataCount/$pageLimit);
  29. $offset=($page-1)*$pageLimit;
  30. $data=$connect->createCommand()
  31. ->from('exam_restore')
  32. ->where($where)
  33. ->offset($offset)
  34. ->limit($pageLimit)
  35. ->order('create_time desc')
  36. ->query()
  37. ->readAll();
  38. $result['data']=$data;
  39. return $result;
  40. }
  41. }