Module: hotel

酒店预订

Classes

Hotel
HotelBenefit
HotelBooking
HotelFilter
HotelRate
HotelRateRule
HotelRoom

Methods


<static> book(header [, params], body)

post 预订

Parameters:
Name Type Argument Description
header module:request.YHeader

Http request header

params object <optional>

Http request query string parameters

Properties
Name Type Argument Default Description
mode string <optional>
sync

模式。由于预订可能需要耗费较长时间,为了提升用户体验可以通过异步机制来分批获取订单和预订结果

  • sync 同步响应所有数据
  • async 异步获取预订结果
body object

Http request body

Properties
Name Type Argument Description
preferred module:common.Preferred <optional>

首选设置

user module:common.User <optional>

预订人

booking module:hotel.HotelBooking

酒店预订信息

payment Payment <optional>

支付信息

Since:
  • 1.0.0
Returns:
Type
bookResponse

<static> rateCalendar(header, body)

post 获取价格方案日历,每日价格。

Parameters:
Name Type Description
header module:request.YHeader

Http request header

body object

Http request body

Properties
Name Type Argument Description
preferred module:common.Preferred <optional>

首选设置

stay module:common.Stay

入住信息

hotel module:hotel.Hotel

酒店

rate module:hotel.HotelRate

价格方案

Since:
  • 1.0.0
Returns:
Type
rateCalendarResponse

<static> rateRule(header, body)

post 获取价格方案及规则。获取更准确的价格明细,务必在用户下单前向用户展示。

  • E.g. 部分酒店住三付二(第一天 1200,第二天 1200,第三天免费),在 rates 接口可能会获得 800, 800, 800 的价格明细,在 rateRule 接口可以获得准确的 1200, 1200, 0 价格明细
Parameters:
Name Type Description
header module:request.YHeader

Http request header

body object

Http request body

Properties
Name Type Argument Description
preferred module:common.Preferred <optional>

首选设置

stay module:common.Stay

入住信息

hotel module:hotel.Hotel

酒店

rate module:hotel.HotelRate

价格方案

Since:
  • 1.0.0
Returns:
Type
rateRuleResponse

<static> rates(header [, params], body)

post 获取酒店详细房型及价格方案

Parameters:
Name Type Argument Description
header module:request.YHeader

Http request header

params object <optional>

Http request query string parameters

Properties
Name Type Argument Default Description
mode string <optional>
sync

模式。由于获取所有 rates 可能需要耗费较长时间,为了提升用户体验可以通过异步机制来分批获取首页 rates 和所有 rates

  • sync 同步响应所有数据
  • asyncPaging 推荐,异步获取所有 rates。同步响应首页 rates 和 asyncJobId,通过 asyncJobId 异步获取次页 rates,逐页获取直至 asyncJobId 为空
body object

Http request body

Properties
Name Type Argument Description
preferred module:common.Preferred <optional>

首选设置

stay module:common.Stay

入住信息

hotel module:hotel.Hotel

酒店

Since:
  • 1.0.0
Returns:
Type
ratesResponse

<static> search(header [, params], body)

post 搜索酒店及价格

Parameters:
Name Type Argument Description
header module:request.YHeader

Http request header

params object <optional>

Http request query string parameters

Properties
Name Type Argument Default Description
mode string <optional>
sync

模式。由于获取价格可能需要耗费较长时间,为了提升用户体验可以通过异步机制来分批获取基础数据和价格

  • sync 同步响应所有数据
  • async 推荐,异步获取价格。同步响应基础数据(不含 minStayPrice)和 asyncJobId,通过 asyncJobId 异步获取 minStayPrice
body object

Http request body

Properties
Name Type Argument Default Description
preferred module:common.Preferred <optional>

首选设置

stay module:common.Stay

入住信息

filter module:hotel.HotelFilter

筛选条件

sort string <optional>
byRecommendation

排序方式

  • byRecommendation 按系统推荐排序
  • byMinStayPrice 按最低价格升序。由于价格是实时向供应商查询,该排序会导致查询性能明显下降
  • byMinStayPriceDescending 按最低价格倒序。由于价格是实时向供应商查询,该排序会导致查询性能明显下降
  • byDistance 按距离远近排序,仅在传入 filter.geospatial 时有效
  • bySearch 按搜索关键字匹配度排序,传入 filter.search 时有效
paging module:common.Paging <optional>

页码信息

Since:
  • 1.0.0
See:
Returns:
Type
searchResponse

Type Definitions


bookResponse

Type:
  • object
Properties:
Name Type Argument Description
err module:common.Error <optional>

错误信息

order Order

订单

Since:
  • 1.0.0

rateCalendarResponse

Type:
  • object
Properties:
Name Type Argument Description
err module:common.Error <optional>

错误信息

rates Array.<module:hotel.HotelRate>

价格方案

Since:
  • 1.0.0

rateRuleResponse

Type:
  • object
Properties:
Name Type Argument Description
err module:common.Error <optional>

错误信息

rate module:hotel.HotelRate

价格方案,仅包含 price, priceDetail 节点。此时的数据相较 rates 接口返回的数据更准确。

rateRule module:hotel.HotelRateRule

价格方案规则

Since:
  • 1.0.0

ratesResponse

Type:
  • object
Properties:
Name Type Argument Description
err module:common.Error <optional>

错误信息

rooms Array.<module:hotel.HotelRoom>

房型

asyncJobId string <optional>

异步任务 id。为空时表示没有更多 rates 需要通过异步获取

Since:
  • 1.0.0

searchResponse

Type:
  • object
Properties:
Name Type Argument Description
err module:common.Error <optional>

错误信息

paging module:common.Paging

页码信息

hotels Array.<module:hotel.Hotel>

酒店

asyncJobId string <optional>

异步任务 id

Since:
  • 1.0.0