fetchAll($sql); if ($result === false) { return Util::returnArrEr('获取首页周边游列表失败!'); } else { return Util::returnArrSu('', $result); } } /** * Function Description:获取首页顶部图片列表 * Function Name: getRecom * * @return array * * @author 娄梦宁 */ public function getRecom() { $sql = '' . "SELECT IMG_URL AS img, IMG_JUMP_URL AS toUrl, IMG_REMARK as title FROM base_img WHERE cancel_flag = 0 AND img_type = 373 AND PRODUCT_ID = 0 ORDER BY seq_id desc "; $result = $this->fetchAll($sql); if (count($result) == 0) { return Util::returnArrEr('获取首页顶部图片列表失败!'); } else { return Util::returnArrSu('', $result); } } /** * Function Description:获取迪士尼接驳列表 * Function Name: getDsn * * @return array * * @author 娄梦宁 */ public function getDsn() { $linestr = $this->getAlldsnjb(); $sql = '' . "SELECT MAX(start_minutes) - MIN(START_minutes) AS bus_time, substring_index(line_name, '-', 1) AS dsnstart, substring_index(line_name, '-' ,- 1) AS dsnend, CUS_PRICE AS price, c.start_station_area_id as start_id, c.end_station_area_id as end_id FROM opera_station a LEFT JOIN opera_line b ON a.line_id = b.line_id LEFT JOIN opera_tickets c ON a.line_id = c.line_id WHERE c.SEAT_TYPE = 72 and b.line_type=256 AND c.HUMAN_TYPE in (159,334) AND a.line_id IN ($linestr) GROUP BY a.line_id order by DISP_ORDER desc limit 2 "; $result = $this->fetchAll($sql); $sql1 = ''.'select cus_price from opera_tickets where LINE_ID = 451804 limit 1'; $result1 = $this ->fetchOne($sql1); $result[0]['bus_time'] = '50'; $result[0]['dsnend'] = '上海迪士尼'; $result[0]['end_id'] = '100437'; $result[0]['start_id'] = '100457'; $result[0]['price'] = $result1; $result[0]['dsnstart'] = '上海佘山茂御臻品之选酒店'; if ($result === false) { return Util::returnArrEr('获取迪士尼接驳列表失败!'); } else { foreach ($result as $key => $val) { $result[$key]['bus_time'] = $this->minstr($result[$key]['bus_time']); } return Util::returnArrSu('', $result); } } /** * Function Description:获取景区直通列表 * Function Name: getScenic * * @return array * * @author 娄梦宁 */ public function getScenic() { $linestr = $this->getAlljqzt(); $sql = '' . " SELECT a.line_name AS zname, b.IMG_URL AS img, b.product_id AS pro_id, MAX(start_minutes) - MIN(START_minutes) AS bus_time, a.line_describe AS car_type, round(d.CUS_PRICE) AS price, d.start_station_area_id as start_id, d.end_station_area_id as end_id, a.DISP_ORDER as ifRecommend FROM opera_line a LEFT JOIN base_img b ON a.line_id = b.product_id LEFT JOIN opera_station c ON a.line_id = c.line_id INNER JOIN opera_tickets d ON d.line_id = a.line_id WHERE a.line_id IN ($linestr) AND a.cancel_flag = 0 AND b.cancel_flag = 0 AND c.cancel_flag = 0 AND d.cancel_flag = 0 AND d.SEAT_TYPE = 72 AND d.HUMAN_TYPE in (159,334) GROUP BY a.line_id order by DISP_ORDER desc"; $result = $this->fetchAll($sql); if ($result === false) { return Util::returnArrEr('获取景区直通列表失败!'); } else { foreach ($result as $key => $val) { $result[$key]['bus_time'] = $this->minstr($result[$key]['bus_time']); $result[$key]['car_type'] = "豪华大巴"; } return Util::returnArrSu('', $result); } } /** * Function Description:获取所有景区直通线路,返回英文逗号分隔的线路集合 * Function Name: getAlljqzt * * * @author 娄梦宁 */ public function getAlljqzt() { $arr = new BaseService(); $area = $arr->getPoiInfoArr(); $area = $area['poi_group'][318]; $str = ''; foreach ($area as $val) { $a = $val['start_area']; $b = $val['end_area']; $str .= " (START_STATION_AREA_ID=$a and END_STATION_AREA_ID=$b) or"; } $str = rtrim($str, 'or'); $sql = '' . "select DISTINCT line_id from opera_tickets where $str and cancel_flag=0"; $result = $this->fetchAll($sql); $linestr = ''; foreach ($result as $val) { $linestr .= $val['line_id'] . ','; } $linestr = rtrim($linestr, ','); return $linestr; } /** * Function Description:获取所有迪士尼接驳,返回英文逗号分隔的线路集合 * Function Name: getAlljqzt * * * @author 娄梦宁 */ public function getAlldsnjb() { $arr = new BaseService(); $area = $arr->getPoiInfoArr(); $area = $area['poi_group'][379]; $str = ''; foreach ($area as $val) { $a = $val['start_area']; $b = $val['end_area']; $str .= " (START_STATION_AREA_ID=$a and END_STATION_AREA_ID=$b) or"; } $str = rtrim($str, 'or'); $sql = '' . "select DISTINCT line_id from opera_tickets where $str and cancel_flag=0"; $result = $this->fetchAll($sql); $linestr = ''; foreach ($result as $val) { $linestr .= $val['line_id'] . ','; } $linestr = rtrim($linestr, ','); return $linestr; } /** * Des:分钟转换 字符串 类似2小时30分钟 * Name: minstr * @param $minutes * @return int|string * @author 娄梦宁 */ public function minstr($minutes) { if ($minutes < 0) { $result = 0; } elseif ($minutes < 60) { $result = $minutes . "分钟"; } else { $hours = floor($minutes / 60); $minunt = $minutes % 60; if ($minunt != 0) { $result = $hours . "时" . $minunt . "分"; } else { $result = $hours . "小时"; } } return $result; } }