SSemester.php 1012 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @author: CeeFee
  4. * @description: 学期
  5. */
  6. class SSemester extends ModelA {
  7. public function __construct()
  8. {
  9. parent::__construct();
  10. }
  11. public function getCurrentSemester()
  12. {
  13. return $this->conn->createQuery()
  14. ->from('semester')
  15. ->where("status = '1'")
  16. ->limit(1)
  17. ->query()
  18. ->read();
  19. }
  20. public function getSemester($semid){
  21. return $this->conn->createQuery()
  22. ->from('semester')
  23. ->where("semester_id = {$semid}")
  24. ->limit(1)
  25. ->query()
  26. ->read();
  27. }
  28. public function getCodeByExamId($examId){
  29. $code = 0;
  30. $sql = "select s.status,s.refer_code from exam e join semester s on e.semester_id = s.semester_id where e.exam_id = '{$examId}'";
  31. $data = $this->conn->createQuery($sql)->queryRow();
  32. if($data && $data['status'] != 1){
  33. $code = $data['refer_code']?$data['refer_code']:0;
  34. }
  35. return $code;
  36. }
  37. }