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.
 
 
 
 

132 lines
6.0 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. //酒店订单状态修改 ,确认、支付、通知、安排
  7. require_once __DIR__ . '/../Common/Mysql.php';
  8. //if (ALLOW_ORIGIN)
  9. header("Access-Control-Allow-Origin:*");
  10. print_r($_POST);exit();
  11. $order_id = isset($_GET['order_id']) ? $_GET['order_id'] : '';
  12. $msg_sql = "CALL HT_GET_MESSAGE_TEMPLATE(" . $order_id . ");";
  13. $msg_pdo = conn();
  14. $msg_result = $msg_pdo -> query($msg_sql);
  15. $msg_re_da = array();
  16. do {
  17. $msg_rowset = $msg_result -> fetchAll(PDO::FETCH_ASSOC);
  18. if ($msg_rowset) {
  19. $msg_re_da[] = $msg_rowset;
  20. }
  21. } while($msg_result->nextRowset());
  22. $data['code'] = "0";
  23. $data['info'] = "";
  24. if (!$msg_re_da) {
  25. $data['code'] = "-1";
  26. $data['info'] = "没有查询到结果";
  27. if (is_array($data)) {
  28. echo json_encode($data);
  29. exit();
  30. }
  31. }
  32. $data['message_info'] = isset($msg_re_da[1]) ? $msg_re_da[1] : array();
  33. if (!isset($msg_re_da[1])) {
  34. return;
  35. }
  36. print_r($msg_re_da);
  37. $data['days'] = $msg_re_da[0][0]['days'];
  38. $data['all_price'] = $msg_re_da[0][0]['all_price'];
  39. $data['message_info'] = $msg_re_da[1];
  40. $json_obj = json_decode(json_encode($data), TRUE);
  41. $message_info = $json_obj['message_info'];
  42. //$msg_customer_name=$message_info[0]['customer_name'];//用户姓名---因和上面的name一样所以就可以不用这个
  43. $name=$message_info[0]['customer_name'];
  44. //入住日期-主订单的入住日期=子订单第一个的日期
  45. $check_in_date = $message_info[0]['check_in_date'];
  46. //产品名称-所有日期的产品名称相同
  47. $prod_name = $message_info[0]['prod_name'];
  48. $ht_rooms = $message_info[0]['ht_rooms'];
  49. //酒店间数 -1表示没有
  50. for ($i = 0, $m = count($message_info); $i < $m; $i++) {
  51. $tm_day = $message_info[$i]['ht_rooms'];
  52. if ($ht_rooms == $tm_day) {
  53. continue;
  54. } else {
  55. $ht_rooms = "-1";
  56. break;
  57. }
  58. }
  59. $days = $json_obj['days'];
  60. //预订天数
  61. $all_price = $json_obj['all_price'];
  62. //总价格
  63. $breakfast = $message_info[0]['breakfast'];
  64. //早餐
  65. for ($i = 0, $m = count($message_info); $i < $m; $i++) {
  66. $tm_breakfast = $message_info[$i]['breakfast'];
  67. if ($breakfast == $tm_breakfast) {
  68. continue;
  69. } else {
  70. $breakfast = "-1";
  71. break;
  72. }
  73. }
  74. $content = "";$breakfast="-1";$ht_rooms="-1";
  75. $order_status="148";
  76. //判断order_status的值
  77. if ($order_status == "145") {//待支付
  78. //$content="【蜘蛛出行】{用户姓名}预订的{入住日期}{产品名称},{酒店间数}间{预订天数}晚,总价{订单总价}({早餐}),订单已生成,请尽快支付以免影响您的出行。";
  79. $content = "{customer_name}预订的{check_in_date}{prod_name},{ht_rooms}间{days}晚,总价{order_price}({breakfast}),订单已生成,请尽快支付以免影响您的出行。";
  80. } else if ($order_status == "198") {//待确定
  81. //【蜘蛛出行】已支付,待确认:{用户姓名}预订的{入住日期}{产品名称},{酒店间数}间{预订天数}晚,总价{订单总价}({早餐}),房间将在2小时内确认,请耐心等待确认信息。
  82. $content = "已支付,待确认:{customer_name}预订的{check_in_date}{prod_name},{ht_rooms}间{days}晚,总价{order_price}({breakfast}),房间将在2小时内确认,请耐心等待确认信息。";
  83. } else if ($order_status == "199") {//待通知
  84. //【蜘蛛出行】已确认:{用户姓名}预订的{入住日期}{产品名称},{酒店间数}间{预订天数}晚,总价{订单总价}({早餐}),已安排房间。
  85. $content = "已确认:{customer_name}预订的{check_in_date}{prod_name},{ht_rooms}间{days}晚,总价{order_price}({breakfast}),已安排房间。";
  86. } else if ($order_status == "201") {//退改中
  87. //【蜘蛛出行】{用户姓名}预订的{入住日期}{产品名称},{酒店间数}间{预订天数}晚,总价{订单总价}({早餐}),酒店方确认当日无房,正在安排退款,请耐心等待。联系客服:021-33280578。
  88. $content = "{customer_name}预订的{check_in_date}{prod_name},{ht_rooms}间{days}晚,总价{order_price}({breakfast}),酒店方确认当日无房,正在安排退款,请耐心等待。联系客服:021-33280578。";
  89. } else if ($order_status == "238") {//已退单
  90. //【蜘蛛出行】退款成功:{用户姓名}预订的{入住日期}{产品名称},{酒店间数}间{预订天数}晚,总价{订单总价}({早餐}),酒店方确认当日无房,已成功退款,请留意银行相关退款信息。联系客服:021-33280578。
  91. $content = "退款成功:{customer_name}预订的{check_in_date}{prod_name},{ht_rooms}间{days}晚,总价{order_price}({breakfast}),酒店方确认当日无房,已成功退款,请留意银行相关退款信息。联系客服:021-33280578。";
  92. } else if ($order_status == "148") {
  93. //【蜘蛛出行】已取消:{用户姓名}预订的{入住日期}{产品名称},{酒店间数}间{预订天数}晚,总价{订单总价}({早餐}),已取消。联系客服:021-33280578。
  94. $content = "已取消:{customer_name}预订的{check_in_date}{prod_name},{ht_rooms}间{days}晚,总价{order_price}({breakfast}),已取消。联系客服:021-33280578。";
  95. } else {
  96. $content = "短信模板错误---严重错误:500当前状态" + $order_status;
  97. }
  98. $content = str_replace("{customer_name}", $name, $content);
  99. $content = str_replace("{check_in_date}", $check_in_date, $content);
  100. $content = str_replace("{prod_name}", $prod_name, $content);
  101. //判断房间数是否该显示
  102. if ($ht_rooms != "-1") {
  103. $content = str_replace("{ht_rooms}", $ht_rooms, $content);
  104. } else {
  105. $content = str_replace("{ht_rooms}间", "", $content);
  106. }
  107. $content = str_replace("{days}", $days, $content);
  108. $content = str_replace("{order_price}", $all_price, $content);
  109. //判断早餐是否该显示
  110. if ($breakfast != "-1") {
  111. $content = str_replace("{breakfast}", $breakfast, $content);
  112. } else {
  113. $content = str_replace("({breakfast})", "", $content);
  114. }
  115. echo $content;exit();
  116. writeLog("短信模板" + $content);
  117. if (is_array($rowset[0])) {
  118. writeLog("hotel_order_status.php HT_ORDER_STATUS_MODIFY()::" . json_encode($rowset[0]));
  119. echo json_encode($rowset[0]);
  120. }
  121. exit ;