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,
		));
	}
Beispiel #2
0
	private function loadModel($id)
	{
		$model= Contactyou::model()->findByPk($id);
		if($model===null)
			throw new CHttpException(404,'The requested page does not exist.');
		return $model;
	}
Beispiel #3
0
	public function actioncontactyou()
	{
		if($_POST['Contactyou']){
			if(empty($_POST['Contactyou']['last'])||empty($_POST['Contactyou']['first'])||empty($_POST['Contactyou']['phone'])||empty($_POST['Contactyou']['gender'])){
				Yii::app()->user->setFlash('alertmsg','姓,名,性别,电话必须填写!');
			}else{
				$model = new Contactyou;
				$model->last = strip_tags($_POST['Contactyou']['last']);
				$model->first = strip_tags($_POST['Contactyou']['first']);
				$model->gender = strip_tags($_POST['Contactyou']['gender']);
				$model->phone = strip_tags($_POST['Contactyou']['phone']);
				$model->content = strip_tags($_POST['Contactyou']['content']);
				$model->createtime = time();
				if($model->save(false)){
					Yii::app()->user->setFlash('alertmsg','提交成功,我们会尽快跟您联系,谢谢!');
				}else{
					Yii::app()->user->setFlash('alertmsg','提交失败,请重试!');
				}
			}
		}
		$this->redirect($this->createUrl('/custom'));
	}