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, )); }
public function actionCustom() { //判断是否有旅游产品ID参数过来 if(!isset($_GET['id'])){ $this->render('404',array('msg'=>'哈哈..您还没有选择旅游线路哦!')); exit; } //接收参数 $tid = intval($_GET['id']);//旅游信息表自增ID //分配旅游信息 $travel = $this->loadModel($tid); //访问人数增加1 $travel->views = $travel->views+1; $travel->save(false); //分配产品图片 $picture = TravelImg::model()->findAll(array( 'select'=>'path', 'condition'=>"tid=$tid", 'order'=>'createtime desc', 'limit'=>5, )); //分配当日行程 $today = Travalday::model()->findAll(array( 'condition'=>"tid=$tid", 'order'=>'daynumber asc', )); //分配各项提示 $tips = TravelTips::model()->find(array( 'condition'=>"tid=$tid", )); //分配该产品所有今天之后的出团信息 $now = time(); $tuans = Travelcalendar::model()->findAll(array( 'select'=>'id,tid,trackcode,aduit_price,date,number,enabled', 'condition'=>"tid=$tid and date>=$now", 'order'=>'date asc', )); //该页面当前的出团日期 $Calcount = 0;//这个团号下的已经支付的剩余人数 $sales = null;//特卖信息 $saleflag = false;//判断是否来自特卖,或者是否为合法特卖 if(isset($_GET['gd'])){ $cal_id = intval($_GET['gd']); $tuanfirstcal = Travelcalendar::model()->find(array( 'select'=>'id,trackcode,date,number', 'condition'=>"id=$cal_id and tid=$tid", )); if($tuanfirstcal==null){ $this->render('404',array('msg'=>'哈哈..该旅游路线这天不出团哦,请选择其它日期吧!')); exit; } $tempCount = $this->getSurplusCount($cal_id); $Calcount = ($travel->number)-$tempCount; //判断是否为特卖页面而来 if(isset($_GET['f']) && ($_GET['f']=='sale' || $_GET['f']=='disc')){ $sales = $this->isSale($cal_id); if($sales){ $saleflag = true; } } }else{ $tuanfirstcal = Travelcalendar::model()->find(array( 'select'=>'id,trackcode,date,number', 'condition'=>"tid=$tid and date>=$now", )); if($tuanfirstcal!=null){ $tempCount = $this->getSurplusCount($tuanfirstcal->id); $Calcount = ($travel->number)-$tempCount; } } /*SEO信息*/ $this->seo_title = $travel->seo_title; $this->seo_keyword = $travel->seo_keyword; $this->seo_description = $travel->seo_description; /* //将Travel表ID和Calendar表ID暂时存在session中 Yii::app()->session['tid'] = $tid; Yii::app()->session['tname'] = $travel->title; Yii::app()->session['tday'] = $travel->daynumber; Yii::app()->session['cid'] = $tuanfirstcal==null?0:$tuanfirstcal->id; */ //输出四件猜你喜欢产品 $cai = Youlike::model()->findAll(array( 'select'=>'othertid', 'condition'=>"tid=$travel->id", 'limit'=>4, )); //查询评论 $reviews = Travelreviews::model()->findAll(array('select'=>'mid,departure,content,praise','condition'=>"tid=$tid")); $this->render('custom',array( 'picture'=>$picture, 'today'=>$today, 'travel'=>$travel, 'tips'=>$tips, 'tuans'=>$tuans, 'tuanfirstcal'=>$tuanfirstcal, 'Calcount'=>$Calcount, 'cai'=>$cai, 'sales'=>$sales, 'saleflag'=>$saleflag, 'now'=>$now, 'reviews'=>$reviews, )); }
public function isHasComments($oid,$departure) { $count = Travelreviews::model()->find(array('select'=>'departure','condition'=>"oid=$oid")); if($count){ return 1;//已经评论过了 }else{ if($departure >= time()){ return 2;//还没未出发,不显示评论按钮 }else{ return 3;//可以评论了 } } }
public function actionCommentsview($id) { $model = Travelreviews::model()->find(array('condition'=>"$id=$id")); $praise = json_decode($model->praise); $this->render('commentsview',array( 'model'=>$model, 'praise'=>$praise, )); }