This commit is contained in:
邹宗楠
2021-12-14 10:10:32 +08:00
parent 18126f6b73
commit a2fa9bf427
2 changed files with 21 additions and 14 deletions

View File

@@ -51,7 +51,7 @@ type SkuListParams struct {
Upc string `json:"upc,omitempty"` Upc string `json:"upc,omitempty"`
SkuID int64 `json:"sku_id,omitempty"` SkuID int64 `json:"sku_id,omitempty"`
CustomSkuID string `json:"custom_sku_id,omitempty"` CustomSkuID string `json:"custom_sku_id,omitempty"`
UpcType int `json:"upc_type,omitempty"` //UpcType int `json:"upc_type,omitempty"`
GetUncate int `json:"get_uncate,omitempty"` GetUncate int `json:"get_uncate,omitempty"`
Delete int `json:"delete,omitempty"` Delete int `json:"delete,omitempty"`
Enabled int `json:"enabled,omitempty"` Enabled int `json:"enabled,omitempty"`
@@ -95,7 +95,7 @@ type SkuInfo struct {
Status int `json:"status"` Status int `json:"status"`
Summary string `json:"summary"` Summary string `json:"summary"`
Upc string `json:"upc"` Upc string `json:"upc"`
UpcType string `json:"upc_type"` //UpcType string `json:"upc_type"`
UpdateTime string `json:"update_time"` UpdateTime string `json:"update_time"`
Weight int `json:"weight"` Weight int `json:"weight"`
WeightFlag int `json:"weight_flag"` WeightFlag int `json:"weight_flag"`
@@ -294,14 +294,14 @@ func (a *API) SkuList(shopID string, params *SkuListParams) (skuInfo *PageDataIn
} }
// 饿百商品名可以相同,不会报错 // 饿百商品名可以相同,不会报错
func (a *API) SkuCreate(trackInfo, shopID string, customSkuID int64, params map[string]interface{}) (skuID int64, err error) { func (a *API) SkuCreate(trackInfo, shopID string, customSkuID string, params map[string]interface{}) (skuID int64, err error) {
defParams := map[string]interface{}{ defParams := map[string]interface{}{
KeyShopID: shopID, KeyShopID: shopID,
KeyCustomSkuID: customSkuID, KeyCustomSkuID: customSkuID,
} }
if params["upc"] == nil { if params["upc"] == nil {
defParams["upc_type"] = UPCTypePrivate // defParams["upc_type"] = UPCTypePrivate
defParams["upc"] = "upc-" + utils.Int2Str(int(customSkuID)) defParams["upc"] = "upc-" + "customSkuID"
} }
/*if params["brand_id"] == nil { /*if params["brand_id"] == nil {
defParams["brand_id"] = 0 defParams["brand_id"] = 0

View File

@@ -76,9 +76,16 @@ func TestSkuCreate(t *testing.T) {
"cat1_id": 151301831158987, "cat1_id": 151301831158987,
"cat2_id": 15347484581335, "cat2_id": 15347484581335,
"cat3_id": 15347484581339, "cat3_id": 15347484581339,
"encrypt": "",
"sign": "A97439C8B502BB7197EC7E5CED53C158",
"source": "34665",
"ticket": "E700820C-8FDC-4A8B-A920-38ACAA01C332",
"timestamp": 1639390432,
"traceid": "0bc5f41d16393904320001232e5843",
"version": "3",
"photos": []map[string]interface{}{ "photos": []map[string]interface{}{
map[string]interface{}{ map[string]interface{}{
"is_master": true, "is_master": 1,
"url": "http://image.jxc4.com/8536c76779333f53517006f88ea7174c.jpg?imageView2/1/w/80/h/80", "url": "http://image.jxc4.com/8536c76779333f53517006f88ea7174c.jpg?imageView2/1/w/80/h/80",
}, },
}, },