|
- <?php
- /*
- Author:ZhangSQ
- Compeny:Spiders Travel
- Updater:fuhc
- updatedate:20160815
- */
- require_once '../Common/Mysql.php';
-
- header("Access-Control-Allow-Origin:*");
- //$USER_ID=isset($_GET['user_id'])?$_GET['user_id']:'';
- $productId=isset($_GET['productId'])?$_GET['productId']:'';
- $user_id=getUserId();
- if ($user_id ===false){
- echo json_encode(array("code"=>"1","info"=>"用户未登录"));
- exit;
- }
-
- $pdo=conn();
- $sql="CALL HT_GET_HOTELINFO_BY_PRO_ID('".$productId."')";
- $result=$pdo->query($sql);
- $data=array();
- do{
- $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
- if($rowset){
- $data[]=$rowset;
- }
- }while ($result->nextRowset());
- $count=count($data);
-
- if($count==2){
- $json=array("code"=>"0","info"=>"");
- $json['applierId']=isset($data[0][0]['applierId'])?$data[0][0]['applierId']:"";
- $json['produID']=isset($data[0][0]['produID'])?$data[0][0]['produID']:"";
- $json['productName']=isset($data[0][0]['productName'])?$data[0][0]['productName']:"";
- $json['hotelName']=isset($data[0][0]['RES_NAME'])?$data[0][0]['RES_NAME']:"";
- $json['hotelAddress']=isset($data[0][0]['address'])?$data[0][0]['address']:"";
- $json['is_onsale']=isset($data[0][0]['IS_ONSALE'])?$data[0][0]['IS_ONSALE']:"";
- $json['applier']=isset($data[0][0]['ORG_NAME'])?$data[0][0]['ORG_NAME']:"";
- $json['hotelType']=isset($data[0][0]['hotelStylePro'])?$data[0][0]['hotelStylePro']:"";
- $json['hotel_ID']=isset($data[0][0]['hotelId'])?$data[0][0]['hotelId']:"";
- foreach($data[1] as $v){
- switch ($v['TYPE_ID'])
- {
-
- case "184":
- $json['bedType']=$v['PROPERTY'];
- break;
- case "185":
- $json['breakfast']=$v['PROPERTY'];
- break;
- case "186":
- $json['ifaddBed']=$v['PROPERTY'];
- break;
- case "189":
- $json['payStyle']=$v['PROPERTY'];
- break;
- case "191":
- $json['payTime']=$v['PROPERTY'];
- break;
- case "192":
- $json['affirmStyle']=$v['PROPERTY'];
- break;
- default:
- $json['overSale']=$v['PROPERTY'];
- }
- }
- echo json_encode($json);
- }
- else{
- echo json_encode(array("code"=>0,"info"=>"","productInfo"=>""));
- }
- exit();
|