- GetOrderActDetail and sku_benefit_detail
This commit is contained in:
@@ -399,13 +399,7 @@ func (a *API) QueryKeyWordDicInfo(pageNo, pageSize int, keyValue string) (values
|
||||
// 商家商品状态同步接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=180&apiid=5e29d6c9317847e58b8cbcc70702fd52
|
||||
func (a *API) SyncProduct(storeId, skuId string) (retVal bool, err error) {
|
||||
result, err := a.AccessAPINoPage("search/syncProduct", utils.Params2Map(KeyStoreId, storeId, KeySkuId, skuId), nil, nil, func(data map[string]interface{}) (interface{}, error) {
|
||||
status := utils.MustInterface2Int64(data["status"])
|
||||
if status == 200 {
|
||||
return data["synchronized"].(bool), nil
|
||||
}
|
||||
return nil, utils.NewErrorIntCode(data["message"].(string), int(status))
|
||||
})
|
||||
result, err := a.AccessAPINoPage("search/syncProduct", utils.Params2Map(KeyStoreId, storeId, KeySkuId, skuId), nil, nil, genNoPageResultParser("status", "message", "synchronized", "200"))
|
||||
if err == nil {
|
||||
return result.(bool), nil
|
||||
}
|
||||
|
||||
@@ -95,32 +95,32 @@ func TestQueryKeyWordDicInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSyncProduct(t *testing.T) {
|
||||
result, err := api.SyncProduct("11732425", "2015717812")
|
||||
result, err := api.SyncProduct(mustExistStoreID, "2022250244")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
baseapi.SugarLogger.Debug(result)
|
||||
result, err = api.SyncProduct("wrongstoreid", "2015717812")
|
||||
result, err = api.SyncProduct("wrongstoreid", "2022250244")
|
||||
if err == nil {
|
||||
t.Fatal("SyncProduct should return error")
|
||||
}
|
||||
result, err = api.SyncProduct("11732425", "wrongskuid")
|
||||
result, err = api.SyncProduct(mustExistStoreID, "wrongskuid")
|
||||
if err == nil {
|
||||
t.Fatal("SyncProduct should return error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetProductStatust(t *testing.T) {
|
||||
result, err := api.GetProductStatus("11732425", "2015717812")
|
||||
result, err := api.GetProductStatus(mustExistStoreID, "2022250244")
|
||||
if err != nil || result == nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// baseapi.SugarLogger.Debug(result)
|
||||
result, err = api.GetProductStatus("wrongstoreid", "2015717812")
|
||||
result, err = api.GetProductStatus("wrongstoreid", "2022250244")
|
||||
if err == nil {
|
||||
t.Fatal("GetProductStatus should return error")
|
||||
}
|
||||
result, err = api.GetProductStatus("11732425", "wrongskuid")
|
||||
result, err = api.GetProductStatus(mustExistStoreID, "wrongskuid")
|
||||
if err == nil {
|
||||
t.Fatal("GetProductStatus should return error")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user