- set upc in SkuCreate.

This commit is contained in:
gazebo
2018-10-26 20:03:19 +08:00
parent 3613375647
commit 56bea8ce11
3 changed files with 15 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ import (
)
const (
testShopBaiduID = 2233909607
testShopBaiduID = 2233976901
testShopID = "100077"
)

View File

@@ -119,7 +119,7 @@ func (a *API) SkuCreate(shopID string, customSkuID int, params map[string]interf
}
if params["upc"] == nil {
defParams["upc_type"] = UPCTypePrivate
defParams["upc"] = "无"
defParams["upc"] = "upc-" + utils.Int2Str(customSkuID)
}
if params["brand_id"] == nil {
defParams["brand_id"] = 0
@@ -127,8 +127,9 @@ func (a *API) SkuCreate(shopID string, customSkuID int, params map[string]interf
if params["brand_name"] == nil {
defParams["brand_name"] = "无" // 很狗血的是,你还必须填个无才行。。。
}
result, err := a.AccessAPI("sku.create", utils.MergeMaps(params, defParams))
params = utils.MergeMaps(params, defParams)
// baseapi.SugarLogger.Debugf(utils.Format4Output(params, false))
result, err := a.AccessAPI("sku.create", params)
if err == nil {
return utils.Str2Int64(utils.Interface2String(result.Data.(map[string]interface{})["sku_id"])), nil
}

View File

@@ -43,9 +43,16 @@ func TestShopGet(t *testing.T) {
func TestShopUpdate(t *testing.T) {
params := map[string]interface{}{
KeyShopID: testShopID,
KeyName: "hello",
"phone": "13812345678",
KeyName: "好菜鲜生-测试店1",
KeyPhone: "13812345678",
KeyBaiduShopID: 2233976901,
"longitude": 116.307884,
"latitude": 40.036828,
"coord_type": "amap",
"province": "131",
"city": "131",
"county": "1960",
"address": "北京市海淀区上地信息路甲9号",
}
err := api.ShopUpdate(params)
if err != nil {