CMSOrderClazz.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Created by 上海互教教育科技有限公司.
  4. * User: 刘红伟
  5. * Date: 2016/7/19
  6. * Email: 454303753@qq.com
  7. * File:CMSOrder.php
  8. */
  9. class CMSOrderClazz extends CActiveRecord{
  10. public function getDbConnection() {
  11. return Yii::app()->db251;
  12. }
  13. public static function model($className = __CLASS__){
  14. return parent::model($className);
  15. }
  16. public function tableName(){
  17. return "order_clazz";
  18. }
  19. public function primaryKey(){
  20. return array('id');
  21. }
  22. public function getOrderIDByClassId($class_id='')
  23. {
  24. $criteria = new CDbCriteria();
  25. if($class_id)
  26. {
  27. $criteria->addCondition('clazz_id=:clazz_id');
  28. $criteria->params[':clazz_id'] = $class_id;
  29. }
  30. $data = $this->findAll($criteria);
  31. if($data)
  32. {
  33. return $data;
  34. }
  35. return false;
  36. }
  37. public function getOrderIDInClassId($class_ids=array())
  38. {
  39. $criteria = new CDbCriteria();
  40. if($class_ids)
  41. {
  42. $criteria->addInCondition('clazz_id ',$class_ids);
  43. // $criteria->params[':clazz_id'] = implode(",", $class_ids);
  44. }
  45. $data = $this->findAll($criteria);
  46. if($data)
  47. {
  48. return $data;
  49. }
  50. return false;
  51. }
  52. }