public function actionIndex() { //查询最新的五条订单 $Omodel=new Order(); $fiveorders = $Omodel->findAll(array('select'=>'id,name,departure,trackcode,createtime,status','condition'=>'updatetime<>0','order'=>'createtime desc','limit'=>'10')); //查询最新五条留言 $fivemesgs = Contactyou::model()->findAll(array('select'=>'id,last,first,gender,phone,createtime,flag','order'=>'createtime desc','limit'=>'10')); //查询最新的五条注册用户 $fivemembers = Member::model()->findAll(array('select'=>'id,name,email,tel,gender,createtime','order'=>'createtime desc','limit'=>'10')); //查询最新的五条出团信息 $now = time(); $calArr = Travelcalendar::model()->findAll(array('condition'=>"date>=$now and enabled=1",'order'=>'date asc','limit'=>'10')); //查询最新评论 $fivereviews = Travelreviews::model()->findAll(array('select'=>'id,tid,mid,content,createtime','order'=>'createtime desc','limit'=>'10')); $this->render('index',array( 'fiveorders'=>$fiveorders, 'fivemesgs'=>$fivemesgs, 'fivemembers'=>$fivemembers, 'calArr'=>$calArr, 'fivereviews'=>$fivereviews, )); }
private function loadModel($id) { $model= Contactyou::model()->findByPk($id); if($model===null) throw new CHttpException(404,'The requested page does not exist.'); return $model; }