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.
 
 
 
 

151 lines
4.2 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../Common/Mysql.php';
  7. if (ALLOW_ORIGIN)
  8. header("Access-Control-Allow-Origin:*");
  9. $method = isset($_GET['method']) ? (empty($_GET['method']) ? '' : $_GET['method']) : '';
  10. $user_id = getUserId();
  11. if ($user_id == false) {
  12. echo json_encode(array("code" => 1, "info" => "用户未登录"));
  13. exit ;
  14. }
  15. $order_id = isset($_GET['order_id']) ? $_GET['order_id'] : '';
  16. if ($order_id == "") {
  17. $data['code'] = "-1";
  18. $data['info'] = "缺少参数";
  19. echo json_encode($data);
  20. exit();
  21. }
  22. $pdo = conn();
  23. switch($method) {
  24. case "getOrderDetail" :
  25. $sql = "CALL HT_GET_ORDER_DETAIL(" . $user_id . "," . $order_id . ")";
  26. if (is_object($pdo)) {
  27. $result = $pdo -> query($sql);
  28. $re_da = array();
  29. do {
  30. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  31. // if ($rowset) {
  32. $re_da[] = $rowset;
  33. // }
  34. } while($result->nextRowset());
  35. $data['code'] = "0";
  36. $data['info'] = "";
  37. if (!$re_da) {
  38. $data['code'] = "-1";
  39. $data['info'] = "没有查询到结果";
  40. if (is_array($data)) {
  41. echo json_encode($data);
  42. exit();
  43. }
  44. }
  45. if (empty($re_da[0])) {
  46. $re_da[0] = array();
  47. $data['order_detail'] = $re_da[0];
  48. } else {
  49. $data['order_detail'] = $re_da[0];
  50. //"千岛湖润和建国度假酒店 豪华湖景大床房,2016-06-01,2|双床房,2016-06-02,3"
  51. $desc_date = $re_da[0][0]['order_desc'];
  52. $first_arr = explode("|", $desc_date);
  53. $final = "";
  54. $start = $first_arr[0];
  55. $arr_len = count($first_arr);
  56. if ($arr_len > 0) {
  57. $start = explode(",", $first_arr[0]);
  58. $end = explode(",", $first_arr[$arr_len - 1]);
  59. $final = $start[1] . " - " . $end[1];
  60. }
  61. $data['order_detail'][0]['all_day'] = (string)count($re_da[1]);
  62. $data['order_detail'][0]['check_in_date'] = $final;
  63. $data['order_detail'][0]['start_date'] = $start[1];
  64. $data['order_detail'][0]['end_date'] = $end[1];
  65. }
  66. if(isset($re_da[1])){
  67. $data['detail_date_arr'] = $re_da[1];
  68. }else{
  69. $data['detail_date_arr']=array();
  70. }
  71. if(isset($re_da[2])){
  72. $data['order_status'] = $re_da[2];
  73. }else{
  74. $data['order_status']=array();
  75. }
  76. }
  77. // $data['detail_date_arr'][0]['base_price_balance']=(string)$re_da[1][0]['base_price'];
  78. break;
  79. case "getOrderRemark" :
  80. $sql = "CALL HT_GET_ORDER_COMMENT(" . $user_id . "," . $order_id . ")";
  81. writeLog("fuhc----ht_get_order_detail_method=getOrderRemark" . $sql);
  82. if (is_object($pdo)) {
  83. $result = $pdo -> query($sql);
  84. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  85. $data['code'] = "0";
  86. $data['info'] = "";
  87. $data['order_remark_arr'] = $rowset;
  88. }
  89. break;
  90. case "getOrderSendMessage" :
  91. $sql = "CALL HT_GET_ORDER_SEND_MESSAGE(" . $user_id . "," . $order_id . ")";
  92. if (is_object($pdo)) {
  93. $result = $pdo -> query($sql);
  94. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  95. if (!$rowset) {
  96. $data['code'] = "-1";
  97. $data['info'] = "没有查询到结果";
  98. if (is_array($data)) {
  99. echo json_encode($data);
  100. exit();
  101. }
  102. }
  103. $data['code'] = "0";
  104. $data['info'] = "";
  105. $data['order_send_message_arr'] = $rowset;
  106. }
  107. break;
  108. case "getOrderRefund" :
  109. //订单退单的信息
  110. $sql = "select
  111. A.ORDER_ID as order_id,
  112. A.REFUND_AMOUNT as refund_amount,
  113. A.ORG_BACK as org_back,
  114. A.REASON as reason,
  115. A.CREATE_TIME as pay_time,
  116. C.PAY_TYPE_ID_1 as pay_type_id_1,
  117. D.TYPE_NAME as type_name
  118. from order_ht_apply_bounce as A inner join order_pay_main as B on B.ORDER_ID=A.ORDER_ID
  119. inner join order_pay_detail as C on C.PAY_MAIN_ID=B.ID
  120. inner join dict_type as D on D.ID=C.PAY_TYPE_ID_1
  121. where A.order_id=" . $order_id . " and A.CANCEL_FLAG=0 group by A.ORDER_ID order by A.CREATE_TIME desc
  122. ;";
  123. if (is_object($pdo)) {
  124. $result = $pdo -> query($sql);
  125. $rowset = $result -> fetchAll(PdO::FETCH_ASSOC);
  126. if (!$rowset) {
  127. $data['code'] = "-1";
  128. $data['info'] = "没有查询到结果";
  129. if (is_array($data)) {
  130. echo json_encode($data);
  131. exit();
  132. }
  133. }
  134. $data['code'] = "0";
  135. $data['info'] = "";
  136. $data['order_refund'] = $rowset;
  137. }
  138. break;
  139. default :
  140. $data['code'] = "-1";
  141. $data['info'] = "缺少method参数";
  142. break;
  143. }
  144. if (is_array($data)) {
  145. echo json_encode($data);
  146. }
  147. exit();
  148. ?>