|
- <?php
-
- /**
- * Created by PhpStorm.
- * User: fuhc
- * Date: 2017/4/14
- * Time: 14:00
- */
-
- require_once "Api/ApiBase.php";
- require_once "Lib/Action/HTUpdateOrderLevelLib.class.php";
-
- class ModifyHTOrderLevel extends ApiBase
- {
- var $updateOrderLib;
-
- function __construct()
- {
- parent::__construct();
- $this->updateOrderLib = new HTUpdateOrderLevelLib();
- }
-
- function echoJson($data)
- {
- echo json_encode($data);
- }
-
- //输出json
- function outJson()
- {
- $op = $this->_request('op');
- $data = call_user_func(array(__CLASS__, $op));
- $this->echoJson($data);
- }
- //1.入住需求
- //1.1修改入住需求
- function orderUpdateCheckIn()
- {
- $user_id = $this->login_user_id;
- $this->_request('hotel_id');
- $hotel_id = $this->_request('hotel_id');
- $room_type = $this->_request('room_type');
- $org_id = $this->_request('org_id');
- $org_num = $this->_request('org_num');
- $room_list = $this->_request('room_list');
- $room_count = $this->_request('room_count'); //用于写日志时的间夜数-前端传处理较为简单
- $cus_list = $this->_request('cus_list');
- $checkin_time = $this->_request('checkin_time');
- $start_date = $this->_request('start_date');
- $end_date = $this->_request('end_date');
- $if_cancel = $this->_request('if_cancel');
- $order_id = $this->_request('order_id');
- $benefit = $this->_request('benefit');
- $total_commission = $this->_request('total_commission');
- $param = array(
- "user_id" => $user_id,
- "hotel_id" => $hotel_id,
- "room_type" => $room_type,
- "org_id" => $org_id,
- "org_num" => $org_num,
- "room_list" => $room_list,
- "room_count"=>$room_count,
- "cus_list" => $cus_list,
- "checkin_time" => $checkin_time,
- "start_date"=>$start_date,
- "end_date"=>$end_date,
- "if_cancel" => $if_cancel,
- "order_id" => $order_id,
- "benefit" => $benefit,
- "total_commission" => $total_commission,
- );
- $data = $this->updateOrderLib->orderUpdateCheckIn($param);
- return $data;
- }
-
- //1.1.1获取库存
- function stockGetList()
- {
- $start_date = $this->_request('start_date');
- $end_date = $this->_request('end_date');
- $hotel_id = $this->_request('hotel_id');
- $parent_room_type = $this->_request('parent_room_type');
- $room_type = $this->_request('room_type');
- $org_id = $this->_request('org_id');
- $nullP = ifNullParam(array($start_date, $end_date, $hotel_id, $parent_room_type, $room_type, $org_id));
- if ($nullP['code'] != "0") return $nullP;
- $param = array(
- "start_date" => $start_date,
- "end_date" => $end_date,
- "hotel_id" => $hotel_id,
- "parent_room_type" => $parent_room_type,
- "room_type" => $room_type,
- "org_id" => $org_id
- );
- $data = $this->updateOrderLib->stockGetList($param);
- return $data;
- }
-
- //1.2修改销售价
- function orderUpdateXSJ()
- {
- $order_id = $this->_request('order_id');
- $user_id = $this->login_user_id;
- $room_list = $this->_request('room_list');
- $room_list = json_decode($room_list, true);
- if (count($room_list) <= 0) return array("code" => "0", "info" => "没有改动!");
- if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
- // $cus_list = [["run_date"=>"2017-01-26","order_price"=>"305"]];
- $param = array(
- "order_id" => $order_id,
- "user_id" => $user_id,
- "room_list" => $room_list
- );
-
- $data = $this->updateOrderLib->orderUpdateXSJ($param);
- return $data;
- }
-
- //1.3修改采购价
- function orderUpdateCGJ()
- {
- $order_id = $this->_request('order_id');
- $user_id = $this->login_user_id;
- $cus_list = $this->_request('cus_list');
- $cus_list = json_decode($cus_list, true);
- if (count($cus_list) <= 0) return array("code" => "0", "info" => "没有改动!");
- if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
- // $cus_list = [["run_date"=>"2017-01-26","order_price"=>"305"]];
- $param = array(
- "order_id" => $order_id,
- "user_id" => $user_id,
- "cus_list" => $cus_list
- );
- $data = $this->updateOrderLib->orderUpdateCGJ($param);
- return $data;
- }
-
-
- //修改客人信息
- function customerUpdate()
- {
- $order_id = $this->_request('order_id');
- if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
- $customer_name = $this->_request('customer_name');
- $customer_mobile = $this->_request('customer_mobile');
- $user_id = $this->login_user_id;
- $param = array(
- "order_id" => $order_id,
- "customer_name" => trim($customer_name),
- "customer_mobile" => trim($customer_mobile),
- "user_id" => $user_id
- );
- $rowset = $this->updateOrderLib->customerUpdate($param);
- return $rowset;
- }
-
- //新增订单备注
- function commentAdd()
- {
-
- $order_id = $this->_request('order_id');
- $comment_type = $this->_request('comment_type');
- $comment_txt = $this->_request('comment_txt');
- $user_id = $this->login_user_id;
- // 0:内部 1:外部
- if (!in_array($comment_type, array("0", "1"))) return array("code" => "20", "info" => "备注类型应为内部或公共!");
- if ("" == trim($comment_txt)) return array("code" => "17", "info" => "您还没有输入备注信息!");
- if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
- $param = array(
- "order_id" => $order_id,
- "comment_type" => $comment_type,
- "comment_txt" => $comment_txt,
- "user_id" => $user_id
- );
- $rowset = $this->updateOrderLib->commentAdd($param);
- return $rowset;
- }
-
- //删除订单备注
- function commentDel()
- {
- $order_id = $this->_request('order_id');
- $comment_id = $this->_request('comment_id');
- $user_id = $this->login_user_id;
- if ('' == trim($order_id)) return array("code" => "16", "info" => "缺少订单号!");
- if ('' == trim($comment_id)) return array("code" => "17", "info" => "缺少订单备注id!");
- $param = array(
- "order_id" => $order_id,
- "comment_id" => $comment_id,
- "user_id" => $user_id
- );
- $rowset = $this->updateOrderLib->commentDel($param);
- return $rowset;
- }
-
- }
-
- $obj = new ModifyHTOrderLevel();
- $obj->outJson();
|