|
- <?php
- /*
- Author:ZSQ
- Compeny:Spiders Travel
- */
- require_once '../Common/Mysql.php';
-
- header("Access-Control-Allow-Origin:*");
-
- $keywords=isset($_GET['keywords'])?$_GET['keywords']:'';
- $isonsale=isset($_GET['saleStyle'])?$_GET['saleStyle']:'';
- $currpage=isset($_GET['currpage'])?(empty($_GET['currpage'])?1:$_GET['currpage']):1;
- $pagesize=isset($_GET['pagesize'])?(empty($_GET['pagesize'])?1:$_GET['pagesize']):1;
- $user_id=getUserId();
- if ($user_id ===false){
- echo json_encode(array("errcode"=>1,"errinfo"=>"用户未登录"));
- exit;
- }
-
-
- $pdo=conn();
- $sql="CALL HT_GET_SEARCH_LIST_BYKEWORDS('".$keywords."',{$isonsale},".$currpage.",".$pagesize.")";
- $result=$pdo->query($sql);
- $data=array();
- do{
- $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
- if($rowset){
- $data[]=$rowset;
- }
- }while ($result->nextRowset());
- //print_r($data);
- $common_array = $data[1];
- $extra_array = array();
- foreach( $data[2] as $temp_info ) {
- $parent_id = $temp_info['parentID'];
- $proid=$temp_info['pro_id'];
- if( !isset($extra_array[$parent_id])) {
- $extra_array[$parent_id] = array();
- }
- $extra_array[$parent_id][] = $temp_info;
- }
-
- $jason_array = array();
- $jason_array["code"] = "0";
- $jason_array["info"] = "";
- $jason_array["totalNum"] = $data[0][0]["totalNum"];
- $jason_array["parent"] = array();
- foreach( $common_array as $common_key => $common_info ) {
- $extra_info = isset($extra_array[$common_info['PROPERTY']]) ? $extra_array[$common_info['PROPERTY']] : array();
- $jason_parent_info = array();
- $jason_parent_info["hotelName"] = $common_info["RES_NAME"];
- $jason_parent_info["hotelId"] = $common_info["PROPERTY"];
- $jason_parent_info["children"] = $extra_info;
- $jason_array["parent"][] = $jason_parent_info;
- }
- echo json_encode($jason_array);
-
- exit();
|