# 商家管理
# API-3.2.4 可配送商家
POST /order/takeaway/merchants/supported
接口類型 | 請求接口 |
用途 | - 查詢在用戶當前位置,支持配送的商家。 - 請參考如何使用派店接口 |
# 請求參數
名稱 | 類型 | 是否必須 | 默認值 | 說明 | 備註 |
---|---|---|---|---|---|
profile | string | N | "" | 品牌標記 | - 只有在指定定制化對接時才需要輸入 - 有需要時由 Zeek 提供參數值 |
user_address | string(255) | N * | - | 用戶地址 | 參考如何傳入用戶位置和地址 |
user_location | string | Y * | - | 用戶位置座標 | 參考如何傳入用戶位置和地址 |
例子:
{
"auth": {
// 驗證字段
},
"data": {
"meta":{
// 語言和地區設定
},
"profile" : "abc-brand",
"user_location": "22.3902837102,114.0042115195"
}
}
# 返回結果
名稱 | 類型 | 說明 | 備註 |
---|---|---|---|
merchants | array | 商家 | 返回一至多個商家。當沒有商家時,返回空值 [] 。 |
merchants[].merchant_id | int | Zeek 平台的商家ID | |
merchants[].client_merchant_id | string | 對接方系統的商家 ID | |
merchants[].prediction.quote_time | int | 預計完成時間 | 單位:分鐘 |
merchants[].prediction.quote_time_range | string | 預計完成時間範圍 | - 例子:"30-40" |
status | int | 搜尋商家結果的狀態 | 0 : 成功返回可配送商家 101 : 沒有可配送的商家102 : 用戶當前位置沒有可配送商家 103 : 正在商家結束營業緩衝時間,無法配送104 : 超出最大預計完成時間,無法配送 |
例子:
{
"error": 0,
"data": {
"merchants" : [
{
"merchant_id" : 123,
"client_merchant_id" : "STORE-123",
"prediction" : {
"quote_time": 90,
"quote_time_range": "90-120"
}
}
],
"status": 0
}
}
# API-3.1.4 更新商家狀態
POST /order/takeaway/merchants/status
**接口類型 | 請求接口 |
用途 | - 更新商家狀態,例如開放時間、開放狀態等等。 - 系統只會在 API-3.2.4 可配送商家 和 API-3.2.1 商家是否可配送 接口篩選商家時檢查商家狀態。 - 在使用API-3.3.1 訂單創建 接口時,不論商家狀態如何,也可以創建訂單。 - 請參考如何使用派店接口 |
# 請求參數
名稱 | 類型 | 是否必須 | 默認值 | 說明 | 備註 |
---|---|---|---|---|---|
client_merchant_id | string | Y | - | 對接方系統的店鋪ID | |
update_type | string | Y | - | 更新類別 | 以下類別的其中一個:business_regular_time : 更新平常營業時間business_temporary_time : 更新臨時營業時間business_status : 更新營業狀態 |
business_regular_time | array | N | - | 平常營業時間 | 只適用於 update_type 為 business_regular_time 時 |
business_temporary_time | array | N | - | 臨時營業時間 | 只適用於 update_type 為 business_temporary_time 時 |
business_status | int | N | - | 營業狀態 | 只適用於 update_type 為 business_status 時。 0 : 休息中、1 : 營業中(沒有默認值,必需傳0 或1 ) |
business_regular_time
的格式 :
名稱 | 類型 | 是否必須 | 默認值 | 說明 | 備註 |
---|---|---|---|---|---|
day_of_week | int | Y | - | 在星期中的日數 | 必須是其中之一:1 : Sunday2 : Monday3 : Tuesday4 : Wednesday5 : Thursday6 : Friday7 : Saturday |
whole_day_status | string | N | "" | 整天營業狀態 | open : 整天營業close : 整天不營業 |
start_time | string | N* | - | 開始時間 | - 當沒有傳入whole_day_status 時,本參數是必須的。- 例如: "09:30" |
end_time | string | N* | - | 結束時間 | - 當沒有傳入whole_day_status 時,本參數是必須的。- 例如: "09:30" |
business_temporary_time
的格式 :
名稱 | 類型 | 是否必須 | 默認值 | 說明 | 備註 |
---|---|---|---|---|---|
start_time | string | Y | - | 開始時間 | - 24小時制 - 例如: "2019-02-01 09:30" |
end_time | string | Y | - | 結束時間 | - 24小時制 - 例如: "2019-02-01 09:30" |
例子:
{
"auth": {
// 驗證字段
},
"data": {
"meta":{
// 語言和地區設定
},
"client_merchant_id": "STORE-123",
"update_type" : "business_temporary_time",
"business_temporary_time": [
{
"start_time" : "2019-01-01 10:00",
"end_time": "2019-01-01 22:00"
},
{
"start_time" : "2019-01-02 10:00",
"end_time": "2019-01-02 15:00"
}
],
"business_status": 1
}
}
# 請求使用範例
# 更新營業狀態
更新商家的營業狀態為休息中:
{
"auth": {
// 驗證字段
},
"data": {
"meta":{
// 語言和地區設定
},
"client_merchant_id": "STORE-123",
"update_type" : "business_status",
"business_status": 0
}
}
# 更新平常營業時間
business_regular_time
的更新請求,會把該商家從周一到週日的營夜時間都更新。注意:必須傳入周一至周日的所有數值。
舉例說,如果請求參數是:
{
"auth": {
// 驗證字段
},
"data": {
"meta":{
// 語言和地區設定
},
"client_merchant_id": "STORE-123",
"update_type" : "business_regular_time",
"business_regular_time" : [
{
"day_of_week" : 1,
"whole_day_status" : "open"
},
{
"day_of_week" : 2,
"start_time" : "09:00",
"end_time" : "23:59"
},
{
"day_of_week" : 3,
"start_time" : "00:00",
"end_time" : "01:00"
},
{
"day_of_week" : 3,
"start_time" : "09:00",
"end_time" : "21:00"
},
{
"day_of_week" : 4,
"whole_day_status" : "close"
},
{
"day_of_week" : 5,
"whole_day_status" : "close"
},
{
"day_of_week" : 6,
"whole_day_status" : "close"
},
{
"day_of_week" : 7,
"whole_day_status" : "close"
},
]
}
}
那麼,這商家的營業時間就被更新為以下時間,直到下次更新 :
週日 : 全天
週一 : 09:00 - 23:59
週二 : 00:00 - 01:00, 09:00 - 21:00
週三 : 不營業
週四 : 不營業
週五 : 不營業
週六 : 不營業
# 更新平常營業時間,把設定所有時間為關店
在特殊情況下,若需要把店的平常營業時間設定為整週關閉的話,需要把whole_day_status
設定為 "close"
。 注意:必須傳入周一至周日的所有數值。
這樣,請求參數是:
{
"auth": {
// 驗證字段
},
"data": {
"meta":{
// 語言和地區設定
},
"client_merchant_id": "STORE-123",
"update_type" : "business_regular_time",
"business_regular_time" : [
{
"day_of_week" : 1,
"whole_day_status" : "close"
},
{
"day_of_week" : 2,
"whole_day_status" : "close"
},
{
"day_of_week" : 3,
"whole_day_status" : "close"
},
{
"day_of_week" : 4,
"whole_day_status" : "close"
},
{
"day_of_week" : 5,
"whole_day_status" : "close"
},
{
"day_of_week" : 6,
"whole_day_status" : "close"
},
{
"day_of_week" : 7,
"whole_day_status" : "close"
},
]
}
}
# 更新臨時營業時間
營業時間 business_temporary_time
以 array 格式來輸入,從這個接口接口輸入的時間段,將會取代原來在系統裡配置內指定日子的時間段。
例子,商家本來的營業時間是"每天早上9 時到下午9 時",如果輸入的business_temporary_time
是:
{
"auth": {
// 驗證字段
},
"data": {
"meta":{
// 語言和地區設定
},
"client_merchant_id": "STORE-123",
"update_type" : "business_temporary_time",
"business_temporary_time" : [
{
"start_time" : "2019-02-14 10:00", // 2019-02-14 早上 10 時到晚上 12 時
"end_time" : "2019-02-14 23:00"
}
]
}
}
那麼商家在 2019-02-14 這一天的營業時間就會改為"早上 10 時到下午 11 時",本來的時間配置就被取代。
注意:接口不支持跨日的時間段輸入,每個時間段必需要是在同一天內。
所以,在以上的例子,如果在2019-02-15 的營業時間需要改為從早上10 時到當天晚上1 時的話,則需要輸入2019-02-16 整天的時間段,就是:
{
"auth": {
// 驗證字段
},
"data": {
"meta":{
// 語言和地區設定
},
"client_merchant_id": "STORE-123",
"update_type" : "business_temporary_time",
"business_temporary_time" : [
{
"start_time" : "2019-02-15 10:00", // 2019-02-15 早上 10 時到晚上 12 時
"end_time" : "2019-02-15 23:59"
},
{
"start_time" : "2019-02-16 00:00", // 2019-02-16 晚上 12 時到 1時
"end_time" : "2019-02-16 00:59"
},
{
"start_time" : "2019-02-16 09:00", // 2019-02-16 本來的營業時間
"end_time" : "2019-02-16 08:59"
}
]
}
}
如果不輸入 2019-02-16 09:00
到 2019-02-16 08:59
這個時間段的話,那麼 2019-02-16 的營業時間只有在 晚上 12 時到 1時 這一段。
# 返回結果
{
"error": 0
}
# API-3.1.5 更新所有商家營業緩衝時間
POST /order/takeaway/merchants/business_buffer_time
接口類型 | 請求接口 |
用途 | - 更新旗下所有商家的營業緩衝時間。 - 請參考如何使用派店接口 |
這裡的 buffer time 影響 API-3.2.4 可配送商家 返回商家的時間判斷。舉例說,某商家的營業時間為 10am - 10pm,而這裡輸入的 end_buffer_time
為 30 (分鐘)。那麼,當再 10am - 9:30pm 這個時間段內調用 API-3.1.4 接口時,會返回這個商家,在 9:30pm 以後則不會返會這個商家。
# 請求參數
名稱 | 類型 | 是否必須 | 默認值 | 說明 | 備註 |
---|---|---|---|---|---|
end_buffer_time | int | Y | - | 在結束營業前的緩衝時間 | 單位:分鐘 |
例子:
{
"auth": {
// 驗證字段
},
"data": {
"meta":{
// 語言和地區設定
},
"end_buffer_time": 30
}
}
# Response
{
"error": 0
}
# API-3.2.1 商家是否可配送
POST /order/takeaway/isdistributable
接口類型 | 請求接口 |
用途 | - 查詢用戶是否在商家的配送範圍內 - 請參考如何使用派店接口 |
# 請求參數
名稱 | 類型 | 是否必須 | 默認值 | 說明 | 備註 |
---|---|---|---|---|---|
client_merchant_id | string | Y | - | 對接方系統的店鋪ID | |
user_address | string(255) | N * | - | 用戶地址 | 請參考如何傳入用戶位置和地址 |
user_location | string | Y * | - | 用戶位置坐標 | 請參考如何傳入用戶位置和地址 |
例子:
{
"auth": {
// 驗證字段
},
"data": {
"meta":{
// 語言和地區設定
},
"profile":"abc-brand",
"client_merchant_id": "STORE-123",
"user_location": "22.3902837102,114.0042115195"
}
}
# 返回結果
名稱 | 類型 | 說明 | 備註 |
---|---|---|---|
distributable | int | 商家是否可以配送 | 1 : 可以配送0 : 不可以配送 |
例子:
{
"error": 0,
"data": {
"distributable": 1
}
}