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.
 
 
 
 

77 lines
2.5 KiB

  1. <?php
  2. //Author:fuhc
  3. //Date:20160924
  4. //修改基础房型
  5. require_once "Api/ApiBase.php";
  6. require_once "Lib/Action/HTBaseRoom.class.php";
  7. class UpdateBaseRm extends ApiBase{
  8. // 修改基础 房型
  9. function updateBaseRoom(){
  10. $stock_type=isset($_POST['stock_type'])?$_POST['stock_type']:(isset($_GET['stock_type'])?$_GET['stock_type']:""); // 不为空
  11. $base_price=isset($_POST['base_price'])?$_POST['base_price']:(isset($_GET['base_price'])?$_GET['base_price']:""); // 不为空
  12. $total_count=isset($_POST['total_count'])?$_POST['total_count']:(isset($_GET['total_count'])?$_GET['total_count']:""); // 不为空
  13. $run_date=isset($_POST['run_date'])?$_POST['run_date']:(isset($_GET['run_date'])?$_GET['run_date']:""); // 不为空
  14. $room_type=isset($_POST['room_type'])?$_POST['room_type']:(isset($_GET['room_type'])?$_GET['room_type']:""); // 不为空
  15. $hotel_id=isset($_POST['hotel_id'])?$_POST['hotel_id']:(isset($_GET['hotel_id'])?$_GET['hotel_id']:""); // 不为空
  16. $user_id=$this->login_user_id;
  17. if(empty($user_id) || empty($stock_type)
  18. || empty($base_price) || empty($total_count)
  19. || empty($run_date) || empty($room_type)
  20. || empty($hotel_id)){
  21. $data['code']="16";
  22. $data['info']="错误的请求参数";
  23. return $data;
  24. }
  25. $Model=array(
  26. "user_id"=>$user_id,
  27. "stock_type"=>$stock_type,
  28. "base_price"=>$base_price,
  29. "total_count"=>$total_count,
  30. "run_date"=>$run_date,
  31. "room_type"=>$room_type,
  32. "hotel_id"=>$hotel_id
  33. );
  34. $baseRoom=new HTBaseRoom;
  35. $data=$baseRoom->updateBaseRoom($Model);
  36. return $data;
  37. }
  38. // 修改采购价及库存
  39. function updateStockPrice(){
  40. $user_id = $this->login_user_id;
  41. $hotel_id=isset($_POST['hotel_id'])?$_POST['hotel_id']:(isset($_GET['hotel_id'])?$_GET['hotel_id']:""); // 不为空
  42. $room_info=isset($_POST['room_info'])?$_POST['room_info']:(isset($_GET['room_info'])?$_GET['room_info']:""); // 不为空
  43. if(empty($hotel_id) || empty($room_info)){
  44. $data['code']="16";
  45. $data['info']="错误的请求参数";
  46. return $data;
  47. }
  48. $baseRoom=new HTBaseRoom;
  49. $data=$baseRoom->updateStockPrice($user_id,$hotel_id,$room_info);
  50. return $data;
  51. }
  52. }
  53. $op=isset($_POST['op'])?$_POST['op']:(isset($_GET['op'])?$_GET['op']:""); // 不为空
  54. $data=array();
  55. $data['code']="0";
  56. $data['info']="";
  57. if($op==""){
  58. $data['code']="5";
  59. $data['info']="op操作参数异常";
  60. echo json_encode($data);
  61. exit();
  62. }
  63. $update = new UpdateBaseRm();
  64. if($op=="upbase"){
  65. $data=$update->updateBaseRoom();
  66. }else if($op=="upstockprice"){
  67. $data=$update->updateStockPrice();
  68. }
  69. echo json_encode($data);