12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- /**
- * Created by 上海互教教育科技有限公司.
- * User: 刘红伟
- * Date: 2016/7/19
- * Email: 454303753@qq.com
- * File:CMSOrder.php
- */
- class CMSOrderPay extends CActiveRecord{
- public function getDbConnection() {
- return Yii::app()->db251;
- }
- public static function model($className = __CLASS__){
- return parent::model($className);
- }
- public function tableName(){
- return "order_pay";
- }
- public function primaryKey(){
- return array('id');
- }
- public function getPageList($school_id){
- $data = array();
- $criteria = new CDbCriteria();
- $criteria->select = 't.*,t2.pay_money,t2.pay_time';
- $criteria->join = ' join order_pay t2 on t.id=t2.order_id'; //连接表
- $criteria->addCondition('t.school_id=:school_id');
- $criteria->params[':school_id'] = $school_id;
- $total = $this->count($criteria);
- $pager = new CPagination($total);
- $criteria->order = 't.id desc';
-
- $pager->pageSize = 12;
- $pager->applyLimit($criteria);
- $data['result'] = $this->findAll($criteria);
- $data['page'] = $pager;
- $data['page_total'] = $total;
-
- return $data;
- }
- public function getPageByOrderIdList($school_id,$order_ids=array(),$status=-1){
- $data = array();
- $criteria = new CDbCriteria();
- $criteria->addCondition('school_id=:school_id');
- $criteria->params[':school_id'] = $school_id;
- if($order_ids)
- {
- $criteria->addInCondition('id',$order_ids);
- }
- if($status>-1)
- {
- $criteria->addCondition('status=:status');
- $criteria->params[':status'] = $status;
- }
- $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;
- }
- public function getOrderPay($order_ids=array(),$status=1){
- $criteria = new CDbCriteria();
- if($order_ids)
- {
- $criteria->addInCondition('order_id',$order_ids);
- }
- // $criteria->addCondition('order_id',$order_ids);
- return $this->findAll($criteria);
- }
- }
|