public function autoGetSpot($content, $lineid, $day) { $sql = "select a.id,a.aid,a.title,a.litpic,a.webid from #@__spot as a where a.litpic !='' or a.piclist !='' group by a.title"; $arr = ORM::factory('spot')->where("litpic !='' or piclist !=''")->group_by('title')->get_all(); $keysarrs = $picsarr = $idsarr = $orderarr = array(); foreach ($arr as $row) { array_push($keysarrs, $row['shortname']); array_push($picsarr, $row['litpic']); array_push($idsarr, $row['id']); array_push($orderarr, $row['displayorder']); } $k = 0; $num = count($keysarrs); $out = array(); for ($i = 0; $i < $num; $i++) { if (Common::checkStr($content, trim($keysarrs[$i]))) { $litpic = empty($picsarr[$i]) ? Common::getDefaultImage() : $picsarr[$i]; $spotid = $idsarr[$i]; $spotname = $keysarrs[$i]; $autoid = $this->insertDaySpot($lineid, $spotname, $litpic, $day, $spotid); if ($autoid) { $out[] = array('title' => $spotname, 'spotid' => $spotid, 'autoid' => $autoid); } } $k++; } return $out; }
public function action_pinlun() { $articleid = $this->params['id']; $typeid = $this->params['typeid']; $action = $this->params['action']; $page = $this->params['page']; $table_arr = array('1' => 'line', '2' => 'hotel', '3' => 'car', '5' => 'spot', '8' => 'visa', '13' => 'tuan'); $module = $table_arr[$typeid]; $row = ORM::factory($module)->where("id={$articleid}")->find()->as_array(); $row['score'] = Model_Comment::getScore($articleid, $typeid); $row['commentnum'] = Model_Comment::getPinLunCount($articleid, $typeid); $page = $page ? $page : 1; $pagesize = 10; $offset = ($page - 1) * $pagesize; $sql = "select * from sline_comment where articleid='{$articleid}' and typeid='{$typeid}' limit {$offset},{$pagesize}"; $pl = DB::query(1, $sql)->execute()->as_array(); foreach ($pl as $key => $v) { $score = $pl[$key]['score1'] * 20; $memberinfo = Common::getMemberInfo($v['memberid']); $pl[$key]['memberico'] = $memberinfo['litpic'] ? $memberinfo['litpic'] : Common::getDefaultImage(); $pl[$key]['membername'] = $memberinfo['nickname']; $pl[$key]['membercore'] = $score . '%'; } if ($action == 'ajax') { echo json_encode($pl); exit; } $this->assign('pinlunlist', $pl); $this->assign('info', $row); $this->assign('typeid', $typeid); $this->display('public/pinlun'); }
public static function getHotel($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_hotel a order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'byorder') { $sql = "select a.* from sline_hotel a left join sline_allorderlist b on (a.id=b.aid and b.typeid=2) 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'] . 'hotels/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) . '%'; } return $list; }
public function action_create() { $id = $this->params['id']; /* if(!isset($GLOBALS['userinfo']['mid'])) { $forwardurl = URL::site('cars/create/id/'.$id); $this->request->redirect('user/login?forwardurl='.$forwardurl); }*/ //详细信息 $sql = "SELECT min(b.adultprice) as carprice FROM sline_car a LEFT JOIN sline_car_suit_price b ON (b.carid = {$id} and b.adultprice!=0) WHERE a.ishidden=0 GROUP BY a.id ORDER BY a.displayorder ASC LIMIT 1"; $query = DB::query(Database::SELECT, $sql); $list = $query->execute()->as_array(); $row = ORM::factory('car')->where("id={$id}")->find()->as_array(); if (empty($row['litpic'])) { $row['litpic'] = Common::getDefaultImage(); } //车型套餐信息 $room = ORM::factory('car_suit')->where("carid={$id}")->order_by('displayorder', 'asc')->get_all(); //价格开始时间,从今天开始,最近30条信息 $BeginDate = strtotime(date("Y-m-d")); if (!empty($room)) { foreach ($room as $key => $value) { if (empty($value['unit'])) { $room[$key]['unit'] = '辆'; } $temprice = ORM::factory('car_suit_price')->where("suitid=" . $value['id'] . " and day>={$BeginDate}")->order_by('day', 'asc')->limit('0,90')->get_all(); if (empty($temprice)) { $room[$key]['price_arr'] = array(); } else { foreach ($temprice as $ke => $va) { $temprice[$ke]['dayid'] = $va['day']; $temprice[$ke]['day'] = date("Y-m-d", $va['day']); } $room[$key]['price_arr'] = $temprice; } } } $this->assign('list', $list); $this->assign('row', $row); $this->assign('room', $room); $this->display('cars/select'); }
public function action_list() { $action = $this->params['action']; $kindid = $this->params['kindid'] ? $this->params['kindid'] : 0; $attrid = $this->params['attrid'] ? $this->params['attrid'] : 0; $page = $this->params['page'] ? $this->params['page'] : 1; $typeid = 6; $w = "a.ishidden=0"; $w .= empty($kindid) ? '' : " and find_in_set({$kindid},a.kindlist)"; $w .= empty($attrid) ? '' : " and find_in_set({$attrid},a.attrid)"; //排序 $orderby = empty($order) ? 'order by a.modtime desc' : "order by a.modtime {$order}"; //当前页数信息 $page = empty($page) ? '1' : $page; //每页记录数 $pagesize = 10; //开始记录数字 $starnum = ($page - 1) * $pagesize; //结速记录数字 $endnum = $pagesize; $limit = $starnum . ',' . $endnum; /*if(empty($kindid)) { $sql="select a.* from sline_photo as a left join sline_allorderlist b on (a.id=b.aid and b.typeid=$typeid) where $w $orderby limit $limit"; } else { $sql="select a.* from sline_article as a left join sline_kindorderlist as b on (b.classid=$kindid and a.id=b.aid and b.typeid=$typeid) where $w $orderby limit $limit"; }*/ $sql = "select a.* from sline_photo as a left join sline_allorderlist b on (a.id=b.aid and b.typeid={$typeid}) where {$w} {$orderby} limit {$limit}"; $list = DB::query(Database::SELECT, $sql)->execute()->as_array(); foreach ($list as $key => $v) { $litpic = $list[$key]['litpic']; $list[$key]['litpic'] = empty($litpic) ? Common::getDefaultImage() : $litpic; } if ($action == "ajax") { echo json_encode($list); exit; } //目的地列表 if (empty($kindid)) { $pid = 0; $kindname = "目的地"; $sqlkind = "select b.id,b.kindname from sline_photo_kindlist as a left join sline_destinations b on (a.kindid=b.id) where b.pid=0 and b.isopen=1 order by a.displayorder asc"; $kindlist = DB::query(Database::SELECT, $sqlkind)->execute()->as_array(); //最顶级目的地 } else { $pidkind = ORM::factory('destinations')->where("id={$kindid}")->find()->as_array(); $kindname = $pidkind['kindname']; $pid = $kindid; $sqlkind = "select b.id,b.kindname from sline_photo_kindlist as a left join sline_destinations b on (a.kindid=b.id) where b.pid=" . $kindid . " and b.isopen=1 order by a.displayorder asc"; $kindlist = DB::query(Database::SELECT, $sqlkind)->execute()->as_array(); if (empty($kindlist)) { $sqlkind = "select b.id,b.kindname from sline_photo_kindlist as a left join sline_destinations b on (a.kindid=b.id) where b.pid=" . intval($pidkind['pid']) . " and b.isopen=1 order by a.displayorder asc"; $kindlist = DB::query(Database::SELECT, $sqlkind)->execute()->as_array(); } } //属性列表 if (empty($attrid)) { $attrname = '类别'; } else { $thisattr = ORM::factory('photo_attr')->where("id={$attrid}")->find()->as_array(); $attrname = $thisattr['attrname']; } $attrlist = ORM::factory('photo_attr')->where("pid!=0 and isopen=1")->order_by("displayorder", "ASC")->get_all(); //列表传递 $this->assign('kindlist', $kindlist); $this->assign('attrlist', $attrlist); //参数传递 $this->assign('kindid', $kindid); $this->assign('attrid', $attrid); $this->assign('kindname', $kindname); $this->assign('attrname', $attrname); $this->assign('list', $list); $this->display('photo/search'); }
public function action_create() { $id = $this->params['id']; /* if(!isset($GLOBALS['userinfo']['mid'])) { $forwardurl = URL::site('hotels/create/id/'.$id); $this->request->redirect('user/login?forwardurl='.$forwardurl); }*/ //详细信息 $row = ORM::factory('hotel')->where("id={$id}")->find()->as_array(); if (empty($row['litpic'])) { $row['litpic'] = Common::getDefaultImage(); } //房型信息 $room = ORM::factory('hotel_room')->where("hotelid={$id}")->order_by('displayorder', 'asc')->get_all(); //价格开始时间,从今天开始,最近30条信息 $BeginDate = strtotime(date("Y-m-d")); if (!empty($room)) { foreach ($room as $key => $value) { switch ($value['breakfirst']) { case '含': $room[$key]['breakfast'] = '含餐'; break; case '不含': $room[$key]['breakfast'] = '不含餐'; break; default: $room[$key]['breakfast'] = $value['breakfirst']; break; } switch ($value['computer']) { case '含': $room[$key]['computer'] = '有宽带'; break; case '不含': $room[$key]['computer'] = '无宽带'; break; default: $room[$key]['computer'] = $value['computer']; break; } $temprice = ORM::factory('hotel_room_price')->where("suitid=" . $value['id'] . " and day>={$BeginDate}")->order_by('day', 'asc')->limit('0,90')->get_all(); if (empty($temprice)) { $room[$key]['price_arr'] = array(); } else { foreach ($temprice as $ke => $va) { $temprice[$ke]['dayid'] = $va['day']; $temprice[$ke]['day'] = date("Y-m-d", $va['day']); } $room[$key]['price_arr'] = $temprice; } } } $this->assign('row', $row); $this->assign('room', $room); $this->display('hotels/select'); }
public function action_order() { $id = $this->params['id']; /*if(!isset($GLOBALS['userinfo']['mid'])) { $forwardurl = URL::site('visa/order/id/'.$id); $this->request->redirect('user/login?forwardurl='.$forwardurl); }*/ //详细信息 $info = ORM::factory('visa')->where("id={$id}")->find()->as_array(); if (empty($info['litpic'])) { $info['litpic'] = Common::getDefaultImage(); } $this->assign('info', $info); $this->display('visa/order'); }
public function action_show() { $id = $this->params['id']; //详细信息 $row = ORM::factory('article')->where("id={$id}")->find()->as_array(); if (empty($row['litpic'])) { $row['litpic'] = Common::getDefaultImage(); } //print_r($row); $this->assign('row', $row); $this->display('raider/show'); }
public function action_create() { $lineid = $this->params['id']; /*if(!isset($GLOBALS['userinfo']['mid'])) { $forwardurl = URL::site('spot/create/id/'.$lineid); $this->request->redirect('user/login?forwardurl='.$forwardurl); }*/ $row = ORM::factory('spot')->where("id={$lineid}")->find()->as_array(); if (empty($row['litpic'])) { $row['litpic'] = Common::getDefaultImage(); } $suit = ORM::factory('spot_ticket')->where("spotid={$lineid}")->get_all(); foreach ($suit as $key => $value) { $suit[$key]['tickettype'] = ORM::factory('spot_ticket_type', $value['tickettypeid'])->get('kindname'); } $this->assign('row', $row); $this->assign('suit', $suit); $this->display('spot/select'); }
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'); }