|
- <?php
- require_once "Api/ApiBase.php";
- require_once "Lib/Action/MakeHotelOrder.class.php";
- require_once "Common/Function.php";
-
- /**
- * Created by PhpStorm.
- * User: luocj
- * Date: 2016/9/29
- * Time: 17:11
- */
- class MakeHTOrder extends ApiBase
- {
- //取渠道列表与下订单列表
- function orgList()
- {
- $obj = new MakeHotelOrder;
- $data = $obj->getOrgList();
- return $data;
- }
-
- // function orderList()
- // {
- // $start_date = isset($_POST['start_date']) ? $_POST['start_date'] : (isset($_GET['start_date']) ? $_GET['start_date'] : "");
- // $end_date = isset($_POST['end_date']) ? $_POST['end_date'] : (isset($_GET['end_date']) ? $_GET['end_date'] : "");
- // $hotel_id = isset($_POST['hotel_id']) ? $_POST['hotel_id'] : (isset($_GET['hotel_id']) ? $_GET['hotel_id'] : "");
- // $room_type = isset($_POST['room_type']) ? $_POST['room_type'] : (isset($_GET['room_type']) ? $_GET['room_type'] : "");
- // $org_id = isset($_POST['org_id']) ? $_POST['org_id'] : (isset($_GET['org_id']) ? $_GET['org_id'] : "");
- // $obj = new MakeHotelOrder;
- // $data = $obj->getRoomStock($start_date, $end_date, $hotel_id, $room_type, $org_id);
- //
- // 294,1,4,'2016-12-05','2016-12-08'
- //// $data = $obj->getOrderList('2016-11-25', '2016-11-29', 283, 2, 4);
- // //177分销 308按销售百分比
- // foreach ($data['order_list'] as &$v) {
- // if ($v['sale_type'] = 177) {
- // $price = $v['fenxiaoprice'];
- // if ($v['commision_flag'] = 1) {
- // if ($v['back_commision_method'] = 308) {
- // $commission = $price * $v['back_percent'] * 0.01;
- // } else {
- // $commission = $v['back_value'];
- // }
- // $profit = $price - $commission - $v['base_price'];
- // }
- // } else {
- // $price = $v['lingshouprice'];
- // if ($v['commision_flag'] = 1) {
- // if ($v['back_commision_method'] = 308) {
- // $commission = $price * $v['back_percent'] * 0.01;
- // } else {
- // $commission = $v['back_value'];
- // }
- // $profit = $price - $commission - $v['base_price'];
- // }
- // }
- // $v['commission'] = $commission;
- // $v['price'] = $price;
- // $v['profit'] = $profit;
- //
- // }
- // return $data;
- // }
- function stockList()
- {
- $start_date = isset($_POST['start_date']) ? $_POST['start_date'] : (isset($_GET['start_date']) ? $_GET['start_date'] : "");
- $end_date = isset($_POST['end_date']) ? $_POST['end_date'] : (isset($_GET['end_date']) ? $_GET['end_date'] : "");
- $hotel_id = isset($_POST['hotel_id']) ? $_POST['hotel_id'] : (isset($_GET['hotel_id']) ? $_GET['hotel_id'] : "");
- $parent_room_type = isset($_POST['parent_room_type']) ? $_POST['parent_room_type'] : (isset($_GET['parent_room_type']) ? $_GET['parent_room_type'] : "");
- $room_type = isset($_POST['room_type']) ? $_POST['room_type'] : (isset($_GET['room_type']) ? $_GET['room_type'] : "");
- $org_id = isset($_POST['org_id']) ? $_POST['org_id'] : (isset($_GET['org_id']) ? $_GET['org_id'] : "");
- $obj = new MakeHotelOrder;
- $data = $obj->getRoomStock($hotel_id,$parent_room_type,$room_type, $org_id,$start_date,$end_date);
- // $data = $obj->getRoomStock(294, 1, 4, '2016-12-05', '2016-12-08');
- return $data;
-
- }
-
- function makeOrder()
- {
- $user_id = $this->login_user_id;
- $hotel_id = isset($_POST['hotel_id']) ? $_POST['hotel_id'] : (isset($_GET['hotel_id']) ? $_GET['hotel_id'] : "");
- $room_type = isset($_POST['room_type']) ? $_POST['room_type'] : (isset($_GET['room_type']) ? $_GET['room_type'] : "");
- $org_id = isset($_POST['org_id']) ? $_POST['org_id'] : (isset($_GET['org_id']) ? $_GET['org_id'] : "");
- $org_num = isset($_POST['org_num']) ? $_POST['org_num'] : (isset($_GET['org_num']) ? $_GET['org_num'] : "");
- $room_list = isset($_POST['room_list']) ? $_POST['room_list'] : (isset($_GET['room_list']) ? $_GET['room_list'] : "");
- $cus_list = isset($_POST['cus_list']) ? $_POST['cus_list'] : (isset($_GET['cus_list']) ? $_GET['cus_list'] : "");
- $checkin_time = isset($_POST['checkin_time']) ? $_POST['checkin_time'] : (isset($_GET['checkin_time']) ? $_GET['checkin_time'] : "");
- $if_cancel = isset($_REQUEST['if_cancel']) ? $_REQUEST['if_cancel']:'0';
- $order_id = isset($_REQUEST['order_id']) ? $_REQUEST['order_id']:'0';
- $benefit = isset($_REQUEST['benefit']) ? $_REQUEST['benefit']:'';
- $total_commission=isset($_REQUEST['total_commission']) ? $_REQUEST['total_commission']:'';
- $MakeOrder = new MakeHotelOrder();
- $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);
-
- return $data;
- }
-
-
- }
-
- $op = isset($_POST['op']) ? $_POST['op'] : (isset($_GET['op']) ? $_GET['op'] : "");
- $data = array();
- $data['code'] = "0";
- $data['info'] = "";
- if ($op == "") {
- $data['code'] = "5";
- $data['info'] = "缺少op参数";
- echo json_encode($data);
- exit();
- }
- $obj = new MakeHTOrder();
- if ($op == "org_list") {
- $data = $obj->orgList();
- echo json_encode($data);
- } else if ($op == "make_order") {
- $data = $obj->makeOrder();
- echo json_encode($data);
- } else if ($op == "order_list") {
- $data = $obj->stockList();
- echo json_encode($data);
- }
-
|