获取饿鲜打全国账号商品接口
This commit is contained in:
@@ -32,6 +32,8 @@ const (
|
|||||||
ShopStatusOnLine = 1 //饿百商家中心商户 上线
|
ShopStatusOnLine = 1 //饿百商家中心商户 上线
|
||||||
ShopStatusOffLine = 2 //饿百商家中心商户 未上线
|
ShopStatusOffLine = 2 //饿百商家中心商户 未上线
|
||||||
ProxyBusinessState = 10 //饿百商家中心商户,除正常营业外的状态
|
ProxyBusinessState = 10 //饿百商家中心商户,除正常营业外的状态
|
||||||
|
|
||||||
|
EbaiWholeCountryStore = "22267110836"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PageShopUserInfo struct {
|
type PageShopUserInfo struct {
|
||||||
@@ -572,6 +574,28 @@ type EbaiSku struct {
|
|||||||
} `json:"ctrl_edit"`
|
} `json:"ctrl_edit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EbaiSkuList struct {
|
||||||
|
UpcID string `json:"upc_id"`
|
||||||
|
UpcType string `json:"upc_type"`
|
||||||
|
Photos string `json:"photos"`
|
||||||
|
UpcName string `json:"upc_name"`
|
||||||
|
Upc string `json:"upc"`
|
||||||
|
BrandID string `json:"brand_id"`
|
||||||
|
Weight string `json:"weight"`
|
||||||
|
Wid string `json:"wid"`
|
||||||
|
Enabled string `json:"enabled"`
|
||||||
|
Cat1ID string `json:"cat1_id"`
|
||||||
|
Cat2ID string `json:"cat2_id"`
|
||||||
|
Cat3ID string `json:"cat3_id"`
|
||||||
|
BrandName string `json:"brand_name"`
|
||||||
|
PhotosList []struct {
|
||||||
|
URL string `json:"url"`
|
||||||
|
IsMaster int `json:"is_master"`
|
||||||
|
} `json:"photos_list"`
|
||||||
|
Shopsku int `json:"shopsku"`
|
||||||
|
IsInActivity int `json:"is_in_activity"`
|
||||||
|
}
|
||||||
|
|
||||||
func (a *API) AccessStorePage2(subURL, storeURL2 string, params map[string]interface{}, isPost bool, cookies map[string]string) (retVal map[string]interface{}, err error) {
|
func (a *API) AccessStorePage2(subURL, storeURL2 string, params map[string]interface{}, isPost bool, cookies map[string]string) (retVal map[string]interface{}, err error) {
|
||||||
if a.GetCookieCount() == 0 {
|
if a.GetCookieCount() == 0 {
|
||||||
return nil, fmt.Errorf("需要设置Store Cookie才能使用此方法")
|
return nil, fmt.Errorf("需要设置Store Cookie才能使用此方法")
|
||||||
@@ -1080,3 +1104,38 @@ func (a *API) GetExianDaSku(exdSkuID int64) (results *ExianDaSku, err error) {
|
|||||||
utils.Map2StructByJson(result["data"], &results, false)
|
utils.Map2StructByJson(result["data"], &results, false)
|
||||||
return results, err
|
return results, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查询饿百全国账号商品库商品
|
||||||
|
func (a *API) GetEbaiDepotSku(supplierID string, upc string) (ebaiSkuList []*EbaiSkuList, err error) {
|
||||||
|
params := map[string]interface{}{
|
||||||
|
"wid": 0,
|
||||||
|
"supplierId": supplierID,
|
||||||
|
"upc": upc,
|
||||||
|
"curpage": 1,
|
||||||
|
"perpage": 20,
|
||||||
|
}
|
||||||
|
result, err := a.AccessStorePage("commodity/getsuppliergoods", "", params, false)
|
||||||
|
if err == nil {
|
||||||
|
err2 := utils.Map2StructByJson(result["sku_list"], &ebaiSkuList, false)
|
||||||
|
if err2 != nil {
|
||||||
|
return ebaiSkuList, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ebaiSkuList, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询饿百商品,根据upc
|
||||||
|
func (a *API) GetEbaiSku(upcID string, supplierID string) (ebaiSku *EbaiSku, err error) {
|
||||||
|
params := map[string]interface{}{
|
||||||
|
"supplierId": supplierID,
|
||||||
|
"upc_id": upcID,
|
||||||
|
}
|
||||||
|
result, err := a.AccessStorePage("commodity/getsku", "", params, false)
|
||||||
|
if err == nil {
|
||||||
|
err2 := utils.Map2StructByJson(result, &ebaiSku, false)
|
||||||
|
if err2 != nil {
|
||||||
|
return ebaiSku, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ebaiSku, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -169,3 +169,13 @@ func TestPageGetSku(t *testing.T) {
|
|||||||
result, _ := api.PageGetSku(32267350915, 15813853840796298)
|
result, _ := api.PageGetSku(32267350915, 15813853840796298)
|
||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetEbaiDepotSku(t *testing.T) {
|
||||||
|
result, _ := api.GetEbaiDepotSku(EbaiWholeCountryStore, "190700570")
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetEbaiSku(t *testing.T) {
|
||||||
|
result, _ := api.GetEbaiSku("1578500400097", EbaiWholeCountryStore)
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user