protected function oneThumb($tid) { $thumb = TravelImg::model()->find(array('select'=>'path','condition'=>"tid=$tid")); if($thumb){ return $thumb->path; } return "/assets/index/images/default_first.png"; }
protected function getFirestThumbByPk($id) { $fistPicture = Yii::app()->cache->get('firstPicture'.$id); if($fistPicture===false){ $fistThumb = TravelImg::model()->find(array('select'=>'path','condition'=>"tid=$id")); if($fistThumb==null){ return "/assets/index/images/logo.jpg"; }else{ $fistPicture = $fistThumb->path; Yii::app()->cache->set('firstPicture'.$id,$fistPicture,3600*24); } } return $fistPicture; }
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 actionShare() { $id=intval($_GET['id']); $model = $this->loadModel($id); //获取第一次相册图片作为微博分享图片 $firstPic = "/assets/index/images/logo.jpg"; $firstPicModel = TravelImg::model()->find(array('select'=>'path','condition'=>"tid=$model->id")); if($firstPicModel!=null){ $firstPic = $firstPicModel->path; } $this->render('share',array( 'model'=>$model, 'firstPic'=>$firstPic, )); }