- ShopBusStatusOffline to ShopBusStatusHaveRest

This commit is contained in:
gazebo
2019-04-16 09:26:37 +08:00
parent 13c5f5378f
commit 46fd28cbe5
2 changed files with 24 additions and 6 deletions

View File

@@ -16,11 +16,11 @@ const (
)
const (
ShopBusStatusOffline = 1
ShopBusStatusCanBooking = 2
ShopBusStatusOpening = 3
ShopBusStatusSuspended = 4
ShopBusStatusBookingNextDay = 5
ShopBusStatusHaveRest = 1 // 表示休息中
ShopBusStatusCanBooking = 2 // 表示可预订
ShopBusStatusOpening = 3 // 表示营业中
ShopBusStatusSuspended = 4 // 表示暂停营业
ShopBusStatusBookingNextDay = 5 // 表示必须跨天预订
)
const (
@@ -155,6 +155,15 @@ func (a *API) ShopBusStatusGet(shopID string, baiduShopID int64, platformFlag st
return 0, err
}
func (a *API) ShopStatusGet(shopID string, baiduShopID int64) (status int, err error) {
params := a.genShopIDParams(shopID, baiduShopID, 0)
result, err := a.AccessAPI("shop.status.get", params)
if err == nil {
return int(utils.Str2Int64(utils.Interface2String(result.Data.(map[string]interface{})["sys_status"]))), nil
}
return 0, err
}
// 相同值再次重复映射会出错
func (a *API) ShopIDBatchUpdate(baiduShopIDs []string, shopIDs []string) (err error) {
_, err = a.AccessAPI("shop.id.batchupdate", utils.Params2Map("baidu_shop_ids", baiduShopIDs, "shop_ids", shopIDs))

View File

@@ -63,7 +63,16 @@ func TestShopUpdate(t *testing.T) {
}
func TestShopBusStatusGet(t *testing.T) {
result, err := api.ShopBusStatusGet(testShopID, 0, PlatformFlagBaidu)
result, err := api.ShopBusStatusGet("", testShopBaiduID, PlatformFlagElm)
if err != nil {
t.Fatal(err)
} else {
t.Log(result)
}
}
func TestShopStatusGet(t *testing.T) {
result, err := api.ShopStatusGet("", testShopBaiduID)
if err != nil {
t.Fatal(err)
} else {