SPaperTopicLarge.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @author: CeeFee
  4. * @description: 考试
  5. */
  6. class SPaperTopicLarge extends MyActiveRecord
  7. {
  8. public static function model($className = __CLASS__)
  9. {
  10. return parent::model($className);
  11. }
  12. public function tableName()
  13. {
  14. return 'paper_topic_large';
  15. }
  16. /**
  17. * 获取试卷大题题信息
  18. * @param $paperId
  19. * @return array
  20. */
  21. public function getPaperLargeTopicInfo($paperId){
  22. $sql = "select large_topic_id,logic_type,logic_type_second,method_ids from ".$this->tableName()." where paper_id = {$paperId}";
  23. $info = $this->getCommandBuilder()->createSqlCommand($sql)->queryAll();
  24. $logicType = array();
  25. $largeTopicMethod = array();
  26. if($info){
  27. foreach($info as $value){
  28. if($value['logic_type_second'] > 0){
  29. $value['logic_type'] .= '_'.$value['logic_type_second'];
  30. }
  31. $logicType[$value['large_topic_id']] = $value['logic_type'];
  32. $largeTopicMethod[$value['large_topic_id']] = explode(',',$value['method_ids']);
  33. }
  34. unset($info);
  35. }
  36. return array($logicType,$largeTopicMethod);
  37. }
  38. }