|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- //Author:fuhc
- //Date:20160924
- //修改基础房型
-
-
- require_once "Api/ApiBase.php";
- require_once "Lib/Action/HTBaseRoom.class.php";
-
-
- class UpdateBaseRm extends ApiBase{
-
-
- // 修改基础 房型
- function updateBaseRoom(){
- $stock_type=isset($_POST['stock_type'])?$_POST['stock_type']:(isset($_GET['stock_type'])?$_GET['stock_type']:""); // 不为空
- $base_price=isset($_POST['base_price'])?$_POST['base_price']:(isset($_GET['base_price'])?$_GET['base_price']:""); // 不为空
- $total_count=isset($_POST['total_count'])?$_POST['total_count']:(isset($_GET['total_count'])?$_GET['total_count']:""); // 不为空
- $run_date=isset($_POST['run_date'])?$_POST['run_date']:(isset($_GET['run_date'])?$_GET['run_date']:""); // 不为空
- $room_type=isset($_POST['room_type'])?$_POST['room_type']:(isset($_GET['room_type'])?$_GET['room_type']:""); // 不为空
- $hotel_id=isset($_POST['hotel_id'])?$_POST['hotel_id']:(isset($_GET['hotel_id'])?$_GET['hotel_id']:""); // 不为空
- $user_id=$this->login_user_id;
- if(empty($user_id) || empty($stock_type)
- || empty($base_price) || empty($total_count)
- || empty($run_date) || empty($room_type)
- || empty($hotel_id)){
- $data['code']="16";
- $data['info']="错误的请求参数";
- return $data;
- }
- $Model=array(
- "user_id"=>$user_id,
- "stock_type"=>$stock_type,
- "base_price"=>$base_price,
- "total_count"=>$total_count,
- "run_date"=>$run_date,
- "room_type"=>$room_type,
- "hotel_id"=>$hotel_id
- );
- $baseRoom=new HTBaseRoom;
- $data=$baseRoom->updateBaseRoom($Model);
- return $data;
- }
- // 修改采购价及库存
- function updateStockPrice(){
- $user_id = $this->login_user_id;
- $hotel_id=isset($_POST['hotel_id'])?$_POST['hotel_id']:(isset($_GET['hotel_id'])?$_GET['hotel_id']:""); // 不为空
- $room_info=isset($_POST['room_info'])?$_POST['room_info']:(isset($_GET['room_info'])?$_GET['room_info']:""); // 不为空
-
- if(empty($hotel_id) || empty($room_info)){
- $data['code']="16";
- $data['info']="错误的请求参数";
- return $data;
- }
- $baseRoom=new HTBaseRoom;
- $data=$baseRoom->updateStockPrice($user_id,$hotel_id,$room_info);
- 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();
- }
- $update = new UpdateBaseRm();
- if($op=="upbase"){
- $data=$update->updateBaseRoom();
- }else if($op=="upstockprice"){
- $data=$update->updateStockPrice();
- }
- echo json_encode($data);
|