ebai filter
This commit is contained in:
@@ -2,7 +2,6 @@ package ebaiapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
@@ -242,6 +241,7 @@ func (a *API) ShopStatusGet(shopID string, baiduShopID int64) (status int, err e
|
||||
|
||||
// 相同值再次重复映射会出错
|
||||
func (a *API) ShopIDBatchUpdate(baiduShopIDs []string, shopIDs []string) (err error) {
|
||||
//_, err = a.AccessAPI("shop.id.batchupdate", params)
|
||||
_, err = a.AccessAPI("shop.id.batchupdate", utils.Params2Map("baidu_shop_ids", baiduShopIDs, "shop_ids", shopIDs))
|
||||
if err == nil {
|
||||
return nil
|
||||
|
||||
@@ -239,12 +239,10 @@ func (a *API) ShopCategoryCreate(shopID string, parentID int64, name string, ran
|
||||
return utils.Interface2Int64WithDefault((result.Data.(map[string]interface{})["category_id"]), 0), nil
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("ShopCategoryCreate err====%v", err)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
func (a *API) ShopCategoryGet(shopID string) (cats []*CategoryInfo, err error) {
|
||||
globals.SugarLogger.Debugf("ShopCategoryGet shopID====%s", shopID)
|
||||
result, err := a.AccessAPI("sku.shop.category.get", utils.Params2Map(KeyShopID, shopID))
|
||||
if err == nil {
|
||||
if inMap, ok := result.Data.(map[string]interface{}); ok {
|
||||
@@ -263,7 +261,6 @@ func (a *API) ShopCategoryUpdate(shopID string, categoryID int64, name string, r
|
||||
"name": name,
|
||||
"rank": rank,
|
||||
})
|
||||
globals.SugarLogger.Debugf("ShopCategoryUpdate err====%v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -273,7 +270,6 @@ func (a *API) ShopCategoryDelete(shopID string, categoryID int64) (err error) {
|
||||
KeyShopID: shopID,
|
||||
"category_id": categoryID,
|
||||
})
|
||||
globals.SugarLogger.Debugf("ShopCategoryDelete err====%v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ebaiapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -122,7 +123,27 @@ func TestShopStatusGet(t *testing.T) {
|
||||
|
||||
//todo 修改ebai平台与本地映射
|
||||
func TestShopIDBatchUpdate(t *testing.T) {
|
||||
err := api.ShopIDBatchUpdate([]string{utils.Int2Str(2235877567)}, []string{"100920"})
|
||||
var (
|
||||
fBaiduShopIDs []string
|
||||
fShopIDs []string
|
||||
)
|
||||
key := map[int64]string{
|
||||
2235877567: "100920",
|
||||
508281125: "6688759",
|
||||
}
|
||||
for k, v := range key {
|
||||
k1 := utils.Int64ToStr(k)
|
||||
remoteRel, err := api.ShopGet2("", k)
|
||||
fmt.Sprintf("err====%v", err)
|
||||
if remoteRel.ShopID != v {
|
||||
fBaiduShopIDs = append(fBaiduShopIDs, k1)
|
||||
fShopIDs = append(fShopIDs, v)
|
||||
}
|
||||
}
|
||||
fmt.Sprintf("fBaiduIDs=====%s", fBaiduShopIDs)
|
||||
fmt.Sprintf("fBaiduIDs=====%s", fShopIDs)
|
||||
err := api.ShopIDBatchUpdate(fBaiduShopIDs, fShopIDs)
|
||||
//err := api.ShopIDBatchUpdate([]string{utils.Int2Str(2235877567)}, []string{"100920"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user