You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

73 lines
2.1 KiB

  1. <?php
  2. /*
  3. Author:ZhangSQ
  4. Compeny:Spiders Travel
  5. Updater:fuhc
  6. updatedate:20160815
  7. */
  8. require_once '../Common/Mysql.php';
  9. header("Access-Control-Allow-Origin:*");
  10. //$USER_ID=isset($_GET['user_id'])?$_GET['user_id']:'';
  11. $productId=isset($_GET['productId'])?$_GET['productId']:'';
  12. $user_id=getUserId();
  13. if ($user_id ===false){
  14. echo json_encode(array("code"=>"1","info"=>"用户未登录"));
  15. exit;
  16. }
  17. $pdo=conn();
  18. $sql="CALL HT_GET_HOTELINFO_BY_PRO_ID('".$productId."')";
  19. $result=$pdo->query($sql);
  20. $data=array();
  21. do{
  22. $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
  23. if($rowset){
  24. $data[]=$rowset;
  25. }
  26. }while ($result->nextRowset());
  27. $count=count($data);
  28. if($count==2){
  29. $json=array("code"=>"0","info"=>"");
  30. $json['applierId']=isset($data[0][0]['applierId'])?$data[0][0]['applierId']:"";
  31. $json['produID']=isset($data[0][0]['produID'])?$data[0][0]['produID']:"";
  32. $json['productName']=isset($data[0][0]['productName'])?$data[0][0]['productName']:"";
  33. $json['hotelName']=isset($data[0][0]['RES_NAME'])?$data[0][0]['RES_NAME']:"";
  34. $json['hotelAddress']=isset($data[0][0]['address'])?$data[0][0]['address']:"";
  35. $json['is_onsale']=isset($data[0][0]['IS_ONSALE'])?$data[0][0]['IS_ONSALE']:"";
  36. $json['applier']=isset($data[0][0]['ORG_NAME'])?$data[0][0]['ORG_NAME']:"";
  37. $json['hotelType']=isset($data[0][0]['hotelStylePro'])?$data[0][0]['hotelStylePro']:"";
  38. $json['hotel_ID']=isset($data[0][0]['hotelId'])?$data[0][0]['hotelId']:"";
  39. foreach($data[1] as $v){
  40. switch ($v['TYPE_ID'])
  41. {
  42. case "184":
  43. $json['bedType']=$v['PROPERTY'];
  44. break;
  45. case "185":
  46. $json['breakfast']=$v['PROPERTY'];
  47. break;
  48. case "186":
  49. $json['ifaddBed']=$v['PROPERTY'];
  50. break;
  51. case "189":
  52. $json['payStyle']=$v['PROPERTY'];
  53. break;
  54. case "191":
  55. $json['payTime']=$v['PROPERTY'];
  56. break;
  57. case "192":
  58. $json['affirmStyle']=$v['PROPERTY'];
  59. break;
  60. default:
  61. $json['overSale']=$v['PROPERTY'];
  62. }
  63. }
  64. echo json_encode($json);
  65. }
  66. else{
  67. echo json_encode(array("code"=>0,"info"=>"","productInfo"=>""));
  68. }
  69. exit();