addAction = new HTHotelProductAction; $this->provCityLinkAction = new ProvinceCityLinkAction; $this->childRoom = new HTChildRoom; } // 检索酒店 function fuzzySearch() { $key_word = isset($_REQUEST['key_word']) ? $_REQUEST['key_word'] : ""; // 允许为空 $area_id = isset($_REQUEST['area_id']) ? $_REQUEST['area_id'] : "0"; // 允许为空 if ($area_id == "" || 0 == $area_id) { $data = $this->addAction->getInfo($key_word); } else { $data = $this->addAction->fuzzySearchHotel($key_word, $area_id); } return $data; } ////根据查询条件 查出满足固定酒店和基础房型的并且没有库存的数据 如果有就不能删 function deletebaseroom() { $baseroomname = $_REQUEST['baseroomname']; $hotel_id = $_REQUEST['hotel_id']; @$baseroomid = $this->childRoom->getBaseroomId($baseroomname); @$res_id = $baseroomid[0]['res_id']; $info = $this->childRoom->getRoomName($res_id, $hotel_id); if ($info['code'] == 1) { $data['code'] = 1; $data['info'] = '参数错误'; return $data; } else { if ($info['rowset']) { $data['code'] = 0; $data['mes'] = 0; $data['info'] = '有库存数据,不能删除'; // var_dump($data); } else { $data['code'] = 1; $data['mes'] = 1; $data['info'] = '无库存,可以删除'; } } return $data; } // 查询房型 function getRoomByHotel() { $hotel_id = isset($_REQUEST['hotel_id']) ? $_REQUEST['hotel_id'] : ""; // 不允许为空 $data = array(); if (empty($hotel_id)) { $data['code'] = "16"; $data['info'] = "错误的请求参数"; return $data; } $roomList = $this->childRoom->getRoomByHotel($hotel_id); $data = $roomList; return $data; } // 省市联动 function getProvinceCity() { $area_id = $area_id = isset($_REQUEST['area_id']) ? $_REQUEST['area_id'] : "0"; //默认为0 if (empty($area_id)) { $area_id = "0"; } $data = $this->provCityLinkAction->getProvinceCity($area_id); return $data; } // 添加酒店产品 function addHotelProduct() { $user_id = $this->login_user_id; // var_dump($user_id);exit(); $hotel_id = isset($_REQUEST['hotel_id']) ? $_REQUEST['hotel_id'] : ""; //不为空//为空 $earliest_checkin_time = isset($_REQUEST['earliest_checkin_time']) ? $_REQUEST['earliest_checkin_time'] : ""; //为空 $supplier_id = isset($_REQUEST['supplier_id']) ? $_REQUEST['supplier_id'] : ""; //不为空 $confirm_from = isset($_REQUEST['confirm_from']) ? $_REQUEST['confirm_from'] : ""; //不为空 $procurement = isset($_REQUEST['procurement']) ? $_REQUEST['procurement'] : ""; //不为空 $principal = isset($_REQUEST['principal']) ? $_REQUEST['principal'] : ""; $status = $_REQUEST['status']; if (empty($hotel_id) && $hotel_id != "0") { $data['code'] = "16"; $data['info'] = "错误的请求参数"; return $data; } // foreach($room_type_sale as $char){ // if($char!="," || "") // } $hotel_model = array( "user_id" => $user_id, "hotel_id" => $hotel_id, "earliest_checkin_time" => $earliest_checkin_time, "supplier_id" => $supplier_id, "confirm_from" => $confirm_from, "procurement" => $procurement, 'principal' => $principal, "status" => $status ); $data = $this->addAction->addHotelProduct($hotel_model); return $data; } //得到供应商和发单主体 function getSupplierConfirm() { $supplierobj = new SupplierAction; $supplierList = $supplierobj->getHotelSupplierList(); $data['code'] = $supplierList['code']; $data['info'] = $supplierList['info']; if ($data['code'] != "0") { return $data; } $data['supplier_list'] = $supplierList['supplier_list']; $confirmobj = new ConfirmFromOrg; $confirmOrgList = $confirmobj->getConfirmOrgList(); $data['code'] = $confirmOrgList['code']; $data['info'] = $confirmOrgList['info']; $data['confirm_org_list'] = $confirmOrgList['confirm_org_list']; return $data; } //供应商的采购人 function getPurchaseNameBySupplier() { $supplier_id = isset($_REQUEST['supplier_id']) ? $_REQUEST['supplier_id'] : ""; // 不为空 if (empty($supplier_id) && $supplier_id != "0") { $data['code'] = "16"; $data['info'] = "错误的请求参数"; return $data; } $supplierobj = new SupplierAction; $purchaseNames = $supplierobj->getPurchaseNameBySupplier($supplier_id); $data = $purchaseNames; return $data; } } // 接口 $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : ''; $addHotel = new AddHotelProd(); $data = array(); $data['code'] = "0"; $data['info'] = ""; if (empty($op)) { $data['code'] = "5"; $data['info'] = "op操作参数异常"; echo json_encode($data); exit(); } if ($op == "fuzzy") { //检索酒店 $data = $addHotel->fuzzySearch(); } else if ($op == "room") { // $data = $addHotel->getRoomByHotel(); } else if ($op == "provinceCity") { $data = $addHotel->getProvinceCity(); } else if ($op == "add") { $data = $addHotel->addHotelProduct(); } else if ($op == "supplier-confirm") { $data = $addHotel->getSupplierConfirm(); } else if ($op == "deletebaseroom") { $data = $addHotel->deletebaseroom(); } else if ($op == "selpurchase") { $data = $addHotel->getPurchaseNameBySupplier(); } else { $data['code'] = "5"; $data['info'] = "op操作参数异常"; echo json_encode($data); exit(); } echo json_encode($data);