123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- /**
- * Created by 上海互教教育科技有限公司.
- * User: 刘红伟
- * Date: 2016/7/19
- * Email: 454303753@qq.com
- * File:CMSOrderStudent.php
- */
- class CMSOrderStudent extends CActiveRecord
- {
- public function getDbConnection()
- {
- return Yii::app()->db251;
- }
- public static function model($className = __CLASS__)
- {
- return parent::model($className);
- }
- public function tableName()
- {
- return "order_student";
- }
- public function getOrderIDByClassId($class_id='',$student_id='')
- {
- $criteria = new CDbCriteria();
- if($class_id!="-1")
- {
- $criteria->addCondition('clazz_id=:clazz_id');
- $criteria->params[':clazz_id'] = $class_id;
- }
- if($student_id!="-1")
- {
- $criteria->addCondition('student_id=:student_id');
- $criteria->params[':student_id'] = $student_id;
- }
- $data = $this->findAll($criteria);
-
- if($data)
- {
- return $data;
- }
- return false;
- }
-
- public function getOrderIDInClassId($class_ids=array(),$student_id='')
- {
- $criteria = new CDbCriteria();
- if($class_ids)
- {
-
- $criteria->addInCondition('clazz_id ',$class_ids);
- // $criteria->params[':clazz_id'] = implode(",", $class_ids);
- }
-
- if($student_id!=-1)
- {
- $criteria->addCondition('student_id=:student_id');
- $criteria->params[':student_id'] = $student_id;
- }
- $data = $this->findAll($criteria);
-
- if($data)
- {
- return $data;
- }
- return false;
- }
- public function getPageList($school_id){
- $data = array();
- $criteria = new CDbCriteria();
- $criteria->addCondition('order_id=:order_id');
- $criteria->params[':school_id'] = $school_id;
- $total = $this->count($criteria);
- $pager = new CPagination($total);
- $criteria->order = 'id desc';
- $pager->pageSize = 12;
- $pager->applyLimit($criteria);
- $data['result'] = $this->findAll($criteria);
- $data['page'] = $pager;
- $data['page_total'] = $total;
- return $data;
- }
- }
|