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.

AddChildRoom.php 2.8 KiB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. //Author:fuhc
  3. //Date:20160921
  4. // 新增子房型
  5. require_once "Api/ApiBase.php";
  6. require_once "Lib/Action/HTChildRoom.class.php";
  7. class AddChildRoom extends ApiBase{
  8. // 新增子房型
  9. function addChildrenRm(){
  10. $user_id = $this->login_user_id;
  11. $hotel_id=isset($_POST['hotel_id'])?$_POST['hotel_id']:(isset($_GET['hotel_id'])?$_GET['hotel_id']:""); // 不为空
  12. $parent_room_type=isset($_POST['parent_room_type'])?$_POST['parent_room_type']:(isset($_GET['parent_room_type'])?$_GET['parent_room_type']:""); // 不为空
  13. $start_date=isset($_POST['start_date'])?$_POST['start_date']:(isset($_GET['start_date'])?$_GET['start_date']:""); // 不为空
  14. $end_date=isset($_POST['end_date'])?$_POST['end_date']:(isset($_GET['end_date'])?$_GET['end_date']:""); // 不为空
  15. $week_day=isset($_POST['week_day'])?$_POST['week_day']:(isset($_GET['week_day'])?$_GET['week_day']:""); // 不为空
  16. $price_buyout=isset($_POST['price_buyout'])?$_POST['price_buyout']:(isset($_GET['price_buyout'])?$_GET['price_buyout']:""); // 不为空
  17. $price_reserve=isset($_POST['price_reserve'])?$_POST['price_reserve']:(isset($_GET['price_reserve'])?$_GET['price_reserve']:""); // 不为空
  18. $price_inquiry=isset($_POST['price_inquiry'])?$_POST['price_inquiry']:(isset($_GET['price_inquiry'])?$_GET['price_inquiry']:""); // 不为空
  19. $person_limit=isset($_POST['person_limit'])?$_POST['person_limit']:(isset($_GET['person_limit'])?$_GET['person_limit']:""); // 不为空
  20. $breakfast=isset($_POST['breakfast'])?$_POST['breakfast']:(isset($_GET['breakfast'])?$_GET['breakfast']:""); // 不为空
  21. $room_name=isset($_POST['room_name'])?$_POST['room_name']:(isset($_GET['room_name'])?$_GET['room_name']:""); // 不为空
  22. if(empty($hotel_id) || empty($start_date)
  23. || empty($end_date) || empty($week_day)
  24. || ($price_buyout==''&&$price_reserve==''&&$price_inquiry=='')
  25. || (empty($person_limit) || $person_limit<=0)
  26. || empty($breakfast) || empty($room_name)){
  27. $data['code']="16";
  28. $data['info']="错误的请求参数";
  29. return $data;
  30. }
  31. $roomModel=array();
  32. $roomModel['user_id']=$user_id;
  33. $roomModel['hotel_id']=$hotel_id;
  34. $roomModel['parent_room_type']=$parent_room_type;
  35. $roomModel['start_date']=$start_date;
  36. $roomModel['end_date']=$end_date;
  37. $roomModel['week_day']=$week_day;
  38. $roomModel['run_status']=1;
  39. $roomModel['price_buyout']=$price_buyout;
  40. $roomModel['price_reserve']=$price_reserve;
  41. $roomModel['price_inquiry']=$price_inquiry;
  42. $roomModel['person_limit']=$person_limit;
  43. $roomModel['breakfast']=$breakfast;
  44. $roomModel['room_name']=$room_name;
  45. $addChildRoom = new HTChildRoom;
  46. $data=$addChildRoom->addChildRoom($roomModel);
  47. return $data;
  48. }
  49. }
  50. $addChildRoom = new addChildRoom;
  51. $data=$addChildRoom->addChildrenRm();
  52. echo json_encode($data);