db251; } public static function model($className = __CLASS__){ return parent::model($className); } public function tableName(){ return "order"; } public function primaryKey(){ return array('id'); } public function getPageList($school_id,$classify){ $data = array(); $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->addCondition('t.school_id=:school_id'); $criteria->params[':school_id'] = $school_id; if(is_array($classify)){ $criteria->addInCondition('t.classify',$classify); }else{ $criteria->addCondition('t.classify=:classify'); $criteria->params[':classify'] = $classify; } // $criteria->params[':classify'] = $classify; $criteria->addCondition('(type=1 or type=0 and `status`=1)'); $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,$classify,$order_ids=array(),$status=-1,$type=0){ $data = array(); $criteria = new CDbCriteria(); $criteria->addCondition('school_id=:school_id'); $criteria->params[':school_id'] = $school_id; if($status>-1) { $criteria->addCondition('status=:status'); $criteria->params[':status'] = $status; } if(!is_array($classify)){ $criteria->addCondition('classify=:classify'); $criteria->params[':classify'] = $classify; }else{ $criteria->addInCondition('classify',$classify); } if($order_ids){ $criteria->addInCondition('id',$order_ids); } if($type>=0){ $criteria->addCondition('type=:type'); $criteria->params[':type'] = $type; } $criteria->addCondition('(type=1 or type=0 and `status`=1)'); $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 getOrderInfo($orderid){ $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->addCondition('id=:id'); $criteria->params[':id'] = $orderid; return $this->find($criteria); } public function getBackOrder($orderid){ $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->addCondition('original_order_id=:id'); $criteria->params[':id'] = $orderid; return $this->findAll($criteria); } }