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); } }