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.
 
 
 
 

125 lines
5.6 KiB

  1. <?php
  2. require_once "Api/ApiBase.php";
  3. require_once "Lib/Action/MakeHotelOrder.class.php";
  4. require_once "Common/Function.php";
  5. /**
  6. * Created by PhpStorm.
  7. * User: luocj
  8. * Date: 2016/9/29
  9. * Time: 17:11
  10. */
  11. class MakeHTOrder extends ApiBase
  12. {
  13. //取渠道列表与下订单列表
  14. function orgList()
  15. {
  16. $obj = new MakeHotelOrder;
  17. $data = $obj->getOrgList();
  18. return $data;
  19. }
  20. // function orderList()
  21. // {
  22. // $start_date = isset($_POST['start_date']) ? $_POST['start_date'] : (isset($_GET['start_date']) ? $_GET['start_date'] : "");
  23. // $end_date = isset($_POST['end_date']) ? $_POST['end_date'] : (isset($_GET['end_date']) ? $_GET['end_date'] : "");
  24. // $hotel_id = isset($_POST['hotel_id']) ? $_POST['hotel_id'] : (isset($_GET['hotel_id']) ? $_GET['hotel_id'] : "");
  25. // $room_type = isset($_POST['room_type']) ? $_POST['room_type'] : (isset($_GET['room_type']) ? $_GET['room_type'] : "");
  26. // $org_id = isset($_POST['org_id']) ? $_POST['org_id'] : (isset($_GET['org_id']) ? $_GET['org_id'] : "");
  27. // $obj = new MakeHotelOrder;
  28. // $data = $obj->getRoomStock($start_date, $end_date, $hotel_id, $room_type, $org_id);
  29. //
  30. // 294,1,4,'2016-12-05','2016-12-08'
  31. //// $data = $obj->getOrderList('2016-11-25', '2016-11-29', 283, 2, 4);
  32. // //177分销 308按销售百分比
  33. // foreach ($data['order_list'] as &$v) {
  34. // if ($v['sale_type'] = 177) {
  35. // $price = $v['fenxiaoprice'];
  36. // if ($v['commision_flag'] = 1) {
  37. // if ($v['back_commision_method'] = 308) {
  38. // $commission = $price * $v['back_percent'] * 0.01;
  39. // } else {
  40. // $commission = $v['back_value'];
  41. // }
  42. // $profit = $price - $commission - $v['base_price'];
  43. // }
  44. // } else {
  45. // $price = $v['lingshouprice'];
  46. // if ($v['commision_flag'] = 1) {
  47. // if ($v['back_commision_method'] = 308) {
  48. // $commission = $price * $v['back_percent'] * 0.01;
  49. // } else {
  50. // $commission = $v['back_value'];
  51. // }
  52. // $profit = $price - $commission - $v['base_price'];
  53. // }
  54. // }
  55. // $v['commission'] = $commission;
  56. // $v['price'] = $price;
  57. // $v['profit'] = $profit;
  58. //
  59. // }
  60. // return $data;
  61. // }
  62. function stockList()
  63. {
  64. $start_date = isset($_POST['start_date']) ? $_POST['start_date'] : (isset($_GET['start_date']) ? $_GET['start_date'] : "");
  65. $end_date = isset($_POST['end_date']) ? $_POST['end_date'] : (isset($_GET['end_date']) ? $_GET['end_date'] : "");
  66. $hotel_id = isset($_POST['hotel_id']) ? $_POST['hotel_id'] : (isset($_GET['hotel_id']) ? $_GET['hotel_id'] : "");
  67. $parent_room_type = isset($_POST['parent_room_type']) ? $_POST['parent_room_type'] : (isset($_GET['parent_room_type']) ? $_GET['parent_room_type'] : "");
  68. $room_type = isset($_POST['room_type']) ? $_POST['room_type'] : (isset($_GET['room_type']) ? $_GET['room_type'] : "");
  69. $org_id = isset($_POST['org_id']) ? $_POST['org_id'] : (isset($_GET['org_id']) ? $_GET['org_id'] : "");
  70. $obj = new MakeHotelOrder;
  71. $data = $obj->getRoomStock($hotel_id,$parent_room_type,$room_type, $org_id,$start_date,$end_date);
  72. // $data = $obj->getRoomStock(294, 1, 4, '2016-12-05', '2016-12-08');
  73. return $data;
  74. }
  75. function makeOrder()
  76. {
  77. $user_id = $this->login_user_id;
  78. $hotel_id = isset($_POST['hotel_id']) ? $_POST['hotel_id'] : (isset($_GET['hotel_id']) ? $_GET['hotel_id'] : "");
  79. $room_type = isset($_POST['room_type']) ? $_POST['room_type'] : (isset($_GET['room_type']) ? $_GET['room_type'] : "");
  80. $org_id = isset($_POST['org_id']) ? $_POST['org_id'] : (isset($_GET['org_id']) ? $_GET['org_id'] : "");
  81. $org_num = isset($_POST['org_num']) ? $_POST['org_num'] : (isset($_GET['org_num']) ? $_GET['org_num'] : "");
  82. $room_list = isset($_POST['room_list']) ? $_POST['room_list'] : (isset($_GET['room_list']) ? $_GET['room_list'] : "");
  83. $cus_list = isset($_POST['cus_list']) ? $_POST['cus_list'] : (isset($_GET['cus_list']) ? $_GET['cus_list'] : "");
  84. $checkin_time = isset($_POST['checkin_time']) ? $_POST['checkin_time'] : (isset($_GET['checkin_time']) ? $_GET['checkin_time'] : "");
  85. $if_cancel = isset($_REQUEST['if_cancel']) ? $_REQUEST['if_cancel']:'0';
  86. $order_id = isset($_REQUEST['order_id']) ? $_REQUEST['order_id']:'0';
  87. $benefit = isset($_REQUEST['benefit']) ? $_REQUEST['benefit']:'';
  88. $total_commission=isset($_REQUEST['total_commission']) ? $_REQUEST['total_commission']:'';
  89. $MakeOrder = new MakeHotelOrder();
  90. $data = $MakeOrder->makeOrderList($user_id, $hotel_id, $room_type, $org_id, $org_num, $room_list, $cus_list, $checkin_time,$if_cancel,$benefit,$total_commission,$order_id);
  91. return $data;
  92. }
  93. }
  94. $op = isset($_POST['op']) ? $_POST['op'] : (isset($_GET['op']) ? $_GET['op'] : "");
  95. $data = array();
  96. $data['code'] = "0";
  97. $data['info'] = "";
  98. if ($op == "") {
  99. $data['code'] = "5";
  100. $data['info'] = "缺少op参数";
  101. echo json_encode($data);
  102. exit();
  103. }
  104. $obj = new MakeHTOrder();
  105. if ($op == "org_list") {
  106. $data = $obj->orgList();
  107. echo json_encode($data);
  108. } else if ($op == "make_order") {
  109. $data = $obj->makeOrder();
  110. echo json_encode($data);
  111. } else if ($op == "order_list") {
  112. $data = $obj->stockList();
  113. echo json_encode($data);
  114. }