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.
 
 
 
 

199 lines
6.8 KiB

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: fuhc
  5. * Date: 2017/4/14
  6. * Time: 14:00
  7. */
  8. require_once "Api/ApiBase.php";
  9. require_once "Lib/Action/HTUpdateOrderLevelLib.class.php";
  10. class ModifyHTOrderLevel extends ApiBase
  11. {
  12. var $updateOrderLib;
  13. function __construct()
  14. {
  15. parent::__construct();
  16. $this->updateOrderLib = new HTUpdateOrderLevelLib();
  17. }
  18. function echoJson($data)
  19. {
  20. echo json_encode($data);
  21. }
  22. //输出json
  23. function outJson()
  24. {
  25. $op = $this->_request('op');
  26. $data = call_user_func(array(__CLASS__, $op));
  27. $this->echoJson($data);
  28. }
  29. //1.入住需求
  30. //1.1修改入住需求
  31. function orderUpdateCheckIn()
  32. {
  33. $user_id = $this->login_user_id;
  34. $this->_request('hotel_id');
  35. $hotel_id = $this->_request('hotel_id');
  36. $room_type = $this->_request('room_type');
  37. $org_id = $this->_request('org_id');
  38. $org_num = $this->_request('org_num');
  39. $room_list = $this->_request('room_list');
  40. $room_count = $this->_request('room_count'); //用于写日志时的间夜数-前端传处理较为简单
  41. $cus_list = $this->_request('cus_list');
  42. $checkin_time = $this->_request('checkin_time');
  43. $start_date = $this->_request('start_date');
  44. $end_date = $this->_request('end_date');
  45. $if_cancel = $this->_request('if_cancel');
  46. $order_id = $this->_request('order_id');
  47. $benefit = $this->_request('benefit');
  48. $total_commission = $this->_request('total_commission');
  49. $param = array(
  50. "user_id" => $user_id,
  51. "hotel_id" => $hotel_id,
  52. "room_type" => $room_type,
  53. "org_id" => $org_id,
  54. "org_num" => $org_num,
  55. "room_list" => $room_list,
  56. "room_count"=>$room_count,
  57. "cus_list" => $cus_list,
  58. "checkin_time" => $checkin_time,
  59. "start_date"=>$start_date,
  60. "end_date"=>$end_date,
  61. "if_cancel" => $if_cancel,
  62. "order_id" => $order_id,
  63. "benefit" => $benefit,
  64. "total_commission" => $total_commission,
  65. );
  66. $data = $this->updateOrderLib->orderUpdateCheckIn($param);
  67. return $data;
  68. }
  69. //1.1.1获取库存
  70. function stockGetList()
  71. {
  72. $start_date = $this->_request('start_date');
  73. $end_date = $this->_request('end_date');
  74. $hotel_id = $this->_request('hotel_id');
  75. $parent_room_type = $this->_request('parent_room_type');
  76. $room_type = $this->_request('room_type');
  77. $org_id = $this->_request('org_id');
  78. $nullP = ifNullParam(array($start_date, $end_date, $hotel_id, $parent_room_type, $room_type, $org_id));
  79. if ($nullP['code'] != "0") return $nullP;
  80. $param = array(
  81. "start_date" => $start_date,
  82. "end_date" => $end_date,
  83. "hotel_id" => $hotel_id,
  84. "parent_room_type" => $parent_room_type,
  85. "room_type" => $room_type,
  86. "org_id" => $org_id
  87. );
  88. $data = $this->updateOrderLib->stockGetList($param);
  89. return $data;
  90. }
  91. //1.2修改销售价
  92. function orderUpdateXSJ()
  93. {
  94. $order_id = $this->_request('order_id');
  95. $user_id = $this->login_user_id;
  96. $room_list = $this->_request('room_list');
  97. $room_list = json_decode($room_list, true);
  98. if (count($room_list) <= 0) return array("code" => "0", "info" => "没有改动!");
  99. if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
  100. // $cus_list = [["run_date"=>"2017-01-26","order_price"=>"305"]];
  101. $param = array(
  102. "order_id" => $order_id,
  103. "user_id" => $user_id,
  104. "room_list" => $room_list
  105. );
  106. $data = $this->updateOrderLib->orderUpdateXSJ($param);
  107. return $data;
  108. }
  109. //1.3修改采购价
  110. function orderUpdateCGJ()
  111. {
  112. $order_id = $this->_request('order_id');
  113. $user_id = $this->login_user_id;
  114. $cus_list = $this->_request('cus_list');
  115. $cus_list = json_decode($cus_list, true);
  116. if (count($cus_list) <= 0) return array("code" => "0", "info" => "没有改动!");
  117. if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
  118. // $cus_list = [["run_date"=>"2017-01-26","order_price"=>"305"]];
  119. $param = array(
  120. "order_id" => $order_id,
  121. "user_id" => $user_id,
  122. "cus_list" => $cus_list
  123. );
  124. $data = $this->updateOrderLib->orderUpdateCGJ($param);
  125. return $data;
  126. }
  127. //修改客人信息
  128. function customerUpdate()
  129. {
  130. $order_id = $this->_request('order_id');
  131. if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
  132. $customer_name = $this->_request('customer_name');
  133. $customer_mobile = $this->_request('customer_mobile');
  134. $user_id = $this->login_user_id;
  135. $param = array(
  136. "order_id" => $order_id,
  137. "customer_name" => trim($customer_name),
  138. "customer_mobile" => trim($customer_mobile),
  139. "user_id" => $user_id
  140. );
  141. $rowset = $this->updateOrderLib->customerUpdate($param);
  142. return $rowset;
  143. }
  144. //新增订单备注
  145. function commentAdd()
  146. {
  147. $order_id = $this->_request('order_id');
  148. $comment_type = $this->_request('comment_type');
  149. $comment_txt = $this->_request('comment_txt');
  150. $user_id = $this->login_user_id;
  151. // 0:内部 1:外部
  152. if (!in_array($comment_type, array("0", "1"))) return array("code" => "20", "info" => "备注类型应为内部或公共!");
  153. if ("" == trim($comment_txt)) return array("code" => "17", "info" => "您还没有输入备注信息!");
  154. if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
  155. $param = array(
  156. "order_id" => $order_id,
  157. "comment_type" => $comment_type,
  158. "comment_txt" => $comment_txt,
  159. "user_id" => $user_id
  160. );
  161. $rowset = $this->updateOrderLib->commentAdd($param);
  162. return $rowset;
  163. }
  164. //删除订单备注
  165. function commentDel()
  166. {
  167. $order_id = $this->_request('order_id');
  168. $comment_id = $this->_request('comment_id');
  169. $user_id = $this->login_user_id;
  170. if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
  171. if ('' == trim($comment_id)) return array("code" => "17", "info" => "缺少订单备注id!");
  172. $param = array(
  173. "order_id" => $order_id,
  174. "comment_id" => $comment_id,
  175. "user_id" => $user_id
  176. );
  177. $rowset = $this->updateOrderLib->commentDel($param);
  178. return $rowset;
  179. }
  180. }
  181. $obj = new ModifyHTOrderLevel();
  182. $obj->outJson();