public function actionIndex() { $travelsM = new Travel; //分配焦点图到页面 $focusmap = $this->getPictureFormImg(6,3); //分配特色团到页面(这里的特色团是flag标记为 1 的产品信息) $teseTuan = $travelsM->findAll(array( 'select'=>'id,title,current_audlt_price', 'condition'=>'flag=1 and enabled=1', 'order'=>'sort desc', 'limit'=>15, )); //分配15个排序最靠前的旅游产品 作为 热门路线 $hottravels = $travelsM->findAll(array( 'select'=>'id,title', 'condition'=>'enabled=1', 'order'=>'sort desc', 'limit'=>15, )); //输出还未结束的特卖信息 $CalModel = new Travelcalendar; $criteria=new CDbCriteria; $criteria->select = "id,tid,aduit_price,date"; $criteria->addCondition('enabled=1'); $criteria->addCondition('flag=1'); $now = time(); $criteria->addCondition("stoptime>$now"); $criteria->order = "starttime asc,updatetime desc"; $count=$CalModel->count($criteria); $pages=new CPagination($count); $pages->pageSize=5; $pages->applyLimit($criteria); $cals = $CalModel->findAll($criteria); $this->render('index',array( 'teseTuan'=>$teseTuan, 'hottravels'=>$hottravels, 'focusmap'=>$focusmap, 'pages'=>$pages, 'travels'=>$cals, )); }
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, )); }
protected function getDeparture($id) { $model = Travelcalendar::model()->find(array( 'select'=>'date', 'condition'=>"id=$id", )); return $model; }
public function isStartOrStop($cid) { $now = time(); $model = Travelcalendar::model()->findByPK($cid,array('select'=>'flag,aduit_price,childen_price')); if($model){ if($model->flag == 0){//非特卖 return false; }elseif($model->flag == 1){//秒杀 if($model->stoptime<$now || $model->starttime>$now){ return false; } }else{//优惠 return $model; } }else{ return false; } return $model; }
public function actionIndex() { /* //检查是否进行了前一步(即是否有选择路线) $sessionid = Yii::app()->session['sid'];//Yii::app()->session->sessionID; $tempModel = $this->checkSessionId($sessionid); if(!$tempModel){ $this->render('404',array('msg'=>'您还没选择参团路线,快去选择吧!')); exit; } */ ////////////////////////////////////// //以后还要做一个参数过滤的函数,过滤该参数 $code = $this->checkKParm(); $orderModel = $this->getOrderByRandCode($code); //如果没有该订单,说明没有通过一步步预定,非法操作 if(!$orderModel){ $this->redirect('/tuan'); exit; } $tid = $orderModel->tid; $cal_id = $orderModel->cal_id; $aduit = $orderModel->aduit;//成人数 $child = $orderModel->child;//儿童数 $model = $this->getOneTravelByPk($tid); if($model === null){ $this->render('404',array('msg'=>'抱歉,没有该团或该团刚被管理员删除!')); exit; } //计算成人和儿童分别的总价格 $model->aduit_price = ($orderModel->aduit_price) * $aduit; $model->childen_price = ($orderModel->chilend_price ) * $child; //查找该产品对于该出发日期的信息 $cals = Travelcalendar::model()->find(array( 'select'=>'id,trackcode,date', 'condition'=>"tid=$tid and id = $cal_id", )); if($cals === null){ $this->render('404',array('msg'=>'抱歉,暂时没有该出团日期')); exit; } //分配房型 $housetype = Housetype::model()->findAll(array( 'select'=>'id,name,aduit,child,aduit_price,chilend_price', 'condition'=>"tid=$tid", )); /*SEO信息*/ $this->seo_title = '填写订单-'.$model->seo_title; $this->seo_keyword = $model->seo_keyword; $this->seo_description = $model->seo_description; //获取第一张缩略图由于显示 $fistThumb = TravelImg::model()->find(array('select'=>'path','condition'=>"tid=$tid")); $this->render('index',array( 'model'=>$model, 'aduit'=>$aduit, 'child'=>$child, 'id'=>$tid, 'cals'=>$cals, 'housetype'=>$housetype, 'fistThumb'=>$fistThumb, 'code'=>$code, 'aduitprice'=>$orderModel->aduit_price, 'childprice'=>$orderModel->chilend_price, )); }
public function getTuanNumber($id) { $model = Travelcalendar::model()->find(array('select'=>'trackcode','condition'=>"id=$id")); return $model->trackcode; }
private function getTuanCode($cid) { $model = Travelcalendar::model()->find(array( 'select'=>'trackcode', 'condition'=>"id=$cid" )); return $model->trackcode; }
public function getRecentdeparture($tid) { $now = time(); $recentdate = Travelcalendar::model()->find(array( 'select'=>'date', 'condition'=>"tid=$tid and date>$now", )); if($recentdate){ return date('Y-m-d',$recentdate['date']); }else{ return 0; } // }
public function actiononeTuan() { $CModel = new Order; $criteria=new CDbCriteria; //构造条件 if(isset($_POST['type'])){ switch ($_POST['type']){ case 1://按线路名称查询 $criteria->compare('name',$_POST['accunt'],true);break; case 2://按团组编号查询 if(!empty($_POST['accunt'])){ $code = $_POST['accunt']; $myarr = Travelcalendar::model()->find(array('select'=>'id','condition'=>"trackcode like '%$code%'")); $myarr?$criteria->addCondition("cal_id=$myarr->id"):$criteria->addCondition("cal_id=0"); } break; case 3: if(!empty($_POST['start'])){ $code = strtotime($_POST['start']); $criteria->addCondition("departure>=$code");//查询不成立 } if(!empty($_POST['stop'])){ $code = strtotime($_POST['stop']); $criteria->addCondition("departure<=$code");//查询不成立 } break; } } $criteria->addCondition("updatetime<>0"); //分页 $count=$CModel->count($criteria); $pages=new CPagination($count); $pages->pageSize=15; $pages->applyLimit($criteria); $calArr = $CModel->findAll($criteria); $this->render('oneTuan',array( 'calArr'=>$calArr, 'pages'=>$pages, )); }
private function isExistCalender($tid,$departure) { $dep = strtotime($departure); $cal = Travelcalendar::model()->count(array( 'condition'=>"tid=$tid and date=$dep", )); if($cal){ return true; }else{ return false; } }