STopicUse.php 669 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * @author: CeeFee
  4. * @description: 考试
  5. */
  6. class STopicUse extends MyActiveRecord
  7. {
  8. public static function model($className = __CLASS__)
  9. {
  10. return parent::model($className);
  11. }
  12. public function tableName()
  13. {
  14. return 'topic_use';
  15. }
  16. public function getTopicUses($topicIds)
  17. {
  18. $criteria = new CDbCriteria();
  19. $criteria->addInCondition('topic_id', $topicIds);
  20. $criteria->addCondition('`mode` = 1');
  21. $criteria->order = 'topic_id ASC';
  22. $result = array();
  23. $query = getAttributes($this->findAll($criteria));
  24. if ($query)
  25. {
  26. foreach ($query AS $k => $v)
  27. {
  28. $result[$v['topic_id']][] = $v;
  29. }
  30. }
  31. return $result;
  32. }
  33. }