public static function getLine($params) { $default = array('row' => 10, 'limit' => 0, 'type' => 'top', 'flag' => 'new'); $params = array_merge($default, $params); extract($params); //获取最新线路 if ($flag == 'new') { $sql = "select a.* from sline_line a order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'byorder') { $sql = "select a.* from sline_line a left join sline_allorderlist b on (a.id=b.aid and b.typeid=1) where ishidden=0 order by ifnull(b.displayorder,9999) asc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } } $list = DB::query(1, $sql)->execute()->as_array(); foreach ($list as $key => $value) { $list[$key]['title'] = $list[$key]['title']; $list[$key]['url'] = $GLOBALS['cfg_cmspath'] . 'lines/show/id/' . $list[$key]['id']; $list[$key]['litpic'] = !empty($list[$key]['litpic']) ? $list[$key]['litpic'] : Common::getDefaultImage(); $list[$key]['satisfyscore'] = !empty($list[$key]['satisfyscore']) ? $list[$key]['satisfyscore'] : mt_rand(92, 96) . '%'; $list[$key]['lineprice'] = Model_Line::getMinPrice($list[$key]['id']); } return $list; }
public function action_city() { $kindid = $this->params['id']; //当前目地的信息 $row = ORM::factory('destinations')->where("id={$kindid}")->find()->as_array(); $tempic = trim($row['piclist'], ','); if (empty($tempic)) { $row['pic_arr'] = array(); } else { $temarr = explode(",", trim($row['piclist'], ',')); foreach ($temarr as $key => $value) { $row['pic_arr'][$key] = explode("||", $value); } } //数据统计(攻略,线路,酒店,租车,门票,相册,团购) $Tjarr = array(); $Tjarr['lines'] = ORM::factory('line')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['article'] = ORM::factory('article')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['hotel'] = ORM::factory('hotel')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['car'] = ORM::factory('car')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['spot'] = ORM::factory('spot')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['photo'] = ORM::factory('photo')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); $Tjarr['tuan'] = ORM::factory('tuan')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->count_all(); //推荐数据调用 //文章(有图片的跟没有图片的) $articlelist1 = ORM::factory('article')->where("litpic is not NULL and litpic<>'' and find_in_set(" . $kindid . ",kindlist) and ishidden=1")->order_by("modtime", 'desc')->limit(4)->get_all(); $articlelist2 = ORM::factory('article')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=1")->order_by("modtime", 'desc')->limit(3)->get_all(); //去掉html标记 if (!empty($articlelist2)) { foreach ($articlelist2 as $key => $value) { $articlelist2[$key]['content'] = Common::cutstr_html($value['content'], 30); } } //推荐线路,租车,酒店,门票,景区 $lineslist = ORM::factory('line')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->order_by("modtime", 'desc')->limit(4)->get_all(); $carlist = ORM::factory('car')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->order_by("modtime", 'desc')->limit(4)->get_all(); $hotellist = ORM::factory('hotel')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->order_by("modtime", 'asc')->limit(4)->get_all(); $spotlist = ORM::factory('spot')->where("find_in_set(" . $kindid . ",kindlist) and ishidden=0")->order_by("modtime", 'asc')->limit(4)->get_all(); $photolist = ORM::factory('photo')->where("litpic is not NULL and litpic<>'' and find_in_set(" . $kindid . ",kindlist) and ishidden=1")->order_by("modtime", 'asc')->limit(4)->get_all(); //做一个初始标记,前台好设为选定状态(线路1,租车2,酒店3,门票4) $sts = 4; if (!empty($spotlist)) { $sts = 4; } if (!empty($hotellist)) { $sts = 3; } if (!empty($carlist)) { $sts = 2; } if (!empty($lineslist)) { $sts = 1; foreach ($lineslist as $key => $line) { $lineslist[$key]['lineprice'] = Model_Line::getMinPrice($line['id']); } } $row['title'] = !empty($row['seotitle']) ? $row['seotitle'] : $row['kindname']; //数据压入 $this->assign('row', $row); $this->assign('tj', $Tjarr); $this->assign('sts', $sts); $this->assign('articlarr1', $articlelist1); $this->assign('articlarr2', $articlelist2); $this->assign('lineslist', $lineslist); $this->assign('carlist', $carlist); $this->assign('hotellist', $hotellist); $this->assign('spotlist', $spotlist); $this->assign('photolist', $photolist); $this->display('mdd/mdd'); }
public function action_create() { $lineid = $this->params['id']; /*if(!isset($GLOBALS['userinfo']['mid'])) { $forwardurl = URL::site('lines/create/id/'.$lineid); $this->request->redirect('user/login?forwardurl='.$forwardurl); }*/ $row = ORM::factory('line')->where("id={$lineid}")->find()->as_array(); if (empty($row['litpic'])) { $row['litpic'] = Common::getDefaultImage(); } $row['lineprice'] = Model_Line::getMinPrice($row['id']); $suit = ORM::factory('line_suit')->where("lineid={$lineid}")->get_all(); $dayBeforeNum = empty($row['linebefore']) ? 0 : $row['linebefore']; //价格开始时间,从今天开始,最近30条价格信息 $BeginDate = strtotime(date("Y-m-d")) + $dayBeforeNum * 24 * 60 * 60; //套餐价格 if (!empty($suit)) { foreach ($suit as $key => $value) { $price_arr = ORM::factory('line_suit_price')->where("suitid=" . $value['id'] . " and day>{$BeginDate} and adultprice>0")->order_by('day', 'asc')->limit('0,90')->get_all(); if (empty($price_arr)) { $suit[$key]['price_arr'] = array(); } else { foreach ($price_arr as $ke => $va) { $price_arr[$ke]['dayid'] = $va['day']; $price_arr[$ke]['day'] = date("Y-m-d", $va['day']); $price_arr[$ke]['suitid'] = $va['suitid']; } $suit[$key]['price_arr'] = $price_arr; } } } //var_dump($suit[0]['price_arr']); $this->assign('row', $row); $this->assign('suit', $suit); $this->display('lines/select'); }