1
This commit is contained in:
@@ -70,42 +70,62 @@ type SkuCustomCatInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SkuInfo struct {
|
type SkuInfo struct {
|
||||||
CustomCatIDs string `json:"custom_cat_ids"`
|
CateId int `json:"cate_id"`
|
||||||
CustomCatList []*SkuCustomCatInfo `json:"custom_cat_list"`
|
CateId1 int `json:"cate_id1"`
|
||||||
CustomSkuID string `json:"custom_sku_id"`
|
CateId2 int `json:"cate_id2"`
|
||||||
IsInActivity int `json:"is_in_activity"`
|
CateName string `json:"cate_name"`
|
||||||
LeftNum int `json:"left_num"`
|
CateName1 string `json:"cate_name1"`
|
||||||
MarketPrice int `json:"market_price"`
|
CateName2 string `json:"cate_name2"`
|
||||||
Minimum int `json:"minimum"`
|
CustomCatIds string `json:"custom_cat_ids"`
|
||||||
Name string `json:"name"`
|
CustomSkuId string `json:"custom_sku_id"`
|
||||||
NeedIce int `json:"need_ice"`
|
DurationSaleFlag bool `json:"duration_sale_flag"`
|
||||||
Photos []*SkuPhotoInfo `json:"photos"`
|
IsInActivity int `json:"is_in_activity"`
|
||||||
PreminusWeight int `json:"preminus_weight"`
|
ItemId int64 `json:"item_id"`
|
||||||
PreparationTime string `json:"preparation_time"`
|
LeftNum int `json:"left_num"`
|
||||||
ProductionAddr1 string `json:"production_addr1"`
|
MarketPrice int `json:"market_price"`
|
||||||
ProductionAddr2 string `json:"production_addr2"`
|
Minimum int `json:"minimum"`
|
||||||
ProductionAddr3 string `json:"production_addr3"`
|
Name string `json:"name"`
|
||||||
Rtf string `json:"rtf"`
|
NeedIce string `json:"need_ice"`
|
||||||
SalePrice int64 `json:"sale_price"`
|
PackageFlag bool `json:"package_flag"`
|
||||||
SaleStep string `json:"sale_step"`
|
Photos []struct {
|
||||||
SaleUnit string `json:"sale_unit"`
|
IsMaster int `json:"is_master"`
|
||||||
ShelfNumber string `json:"shelf_number"`
|
Url string `json:"url"`
|
||||||
SkuID int64 `json:"sku_id"`
|
} `json:"photos"`
|
||||||
// SkuProperty []interface{} `json:"sku_property"`
|
PreminusWeight int `json:"preminus_weight"`
|
||||||
Status int `json:"status"`
|
PreparationTime int `json:"preparation_time"`
|
||||||
Summary string `json:"summary"`
|
PrescriptionType string `json:"prescription_type"`
|
||||||
Upc string `json:"upc"`
|
ProcessDetail []interface{} `json:"process_detail"`
|
||||||
//UpcType string `json:"upc_type"`
|
ProcessType int `json:"process_type"`
|
||||||
UpdateTime string `json:"update_time"`
|
ProductionAddr1 string `json:"production_addr1"`
|
||||||
Weight int `json:"weight"`
|
ProductionAddr2 string `json:"production_addr2"`
|
||||||
WeightFlag int `json:"weight_flag"`
|
ProductionAddr3 string `json:"production_addr3"`
|
||||||
|
Rtf string `json:"rtf"`
|
||||||
|
SalePrice int `json:"sale_price"`
|
||||||
|
SaleStep int `json:"sale_step"`
|
||||||
|
SaleUnit string `json:"sale_unit"`
|
||||||
|
SevenDaysNoReason bool `json:"seven_days_no_reason"`
|
||||||
|
SkuId int64 `json:"sku_id"`
|
||||||
|
SkuProperty []interface{} `json:"sku_property"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Summary string `json:"summary"`
|
||||||
|
Upc string `json:"upc"`
|
||||||
|
UpcType int `json:"upc_type"`
|
||||||
|
Weight string `json:"weight"`
|
||||||
|
WeightFlag int `json:"weight_flag"`
|
||||||
|
|
||||||
|
CustomCatIDs string `json:"custom_cat_ids"`
|
||||||
|
CustomCatList []*SkuCustomCatInfo `json:"custom_cat_list"`
|
||||||
|
CustomSkuID string `json:"custom_sku_id"`
|
||||||
|
ShelfNumber string `json:"shelf_number"`
|
||||||
|
UpdateTime string `json:"update_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PageDataInfo struct {
|
type PageDataInfo struct {
|
||||||
Total int `json:"Total"`
|
Total int `json:"Total"`
|
||||||
Page int `json:"Page"`
|
Page int `json:"Page"`
|
||||||
Pages int `json:"Pages"`
|
Pages int `json:"Pages"`
|
||||||
List []*SkuInfo `json:"List"`
|
SkuIdOffset int `json:"sku_id_offset"`
|
||||||
|
List []*SkuInfo `json:"List"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BatchOpSkuResult struct {
|
type BatchOpSkuResult struct {
|
||||||
@@ -289,6 +309,7 @@ func (a *API) SkuGetItemsByCategoryId(shopID string, categoryID int64) (skus []m
|
|||||||
|
|
||||||
// 此函数查不到结果是不会报错的
|
// 此函数查不到结果是不会报错的
|
||||||
func (a *API) SkuList(shopID string, params *SkuListParams) (skuInfo *PageDataInfo, err error) {
|
func (a *API) SkuList(shopID string, params *SkuListParams) (skuInfo *PageDataInfo, err error) {
|
||||||
|
params.PageSize = 100
|
||||||
paramMap := utils.Struct2FlatMap(params)
|
paramMap := utils.Struct2FlatMap(params)
|
||||||
paramMap[KeyShopID] = shopID
|
paramMap[KeyShopID] = shopID
|
||||||
result, err := a.AccessAPI("sku.list", paramMap)
|
result, err := a.AccessAPI("sku.list", paramMap)
|
||||||
@@ -585,7 +606,7 @@ func (a *API) GetEbaiSkuIDFromCustomID(shopID, customSkuID string) (ebaiSkuID in
|
|||||||
if skuInfo, err2 := a.SkuList(shopID, &SkuListParams{
|
if skuInfo, err2 := a.SkuList(shopID, &SkuListParams{
|
||||||
CustomSkuID: customSkuID,
|
CustomSkuID: customSkuID,
|
||||||
}); err2 == nil && skuInfo != nil && len(skuInfo.List) > 0 {
|
}); err2 == nil && skuInfo != nil && len(skuInfo.List) > 0 {
|
||||||
ebaiSkuID = skuInfo.List[0].SkuID
|
ebaiSkuID = skuInfo.List[0].SkuId
|
||||||
}
|
}
|
||||||
return ebaiSkuID
|
return ebaiSkuID
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func TestShopCategoryDelete(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSkuGetItemsByCategoryId(t *testing.T) {
|
func TestSkuGetItemsByCategoryId(t *testing.T) {
|
||||||
result, err := api.SkuGetItemsByCategoryId(testShopID, 153838813210900)
|
result, err := api.SkuGetItemsByCategoryId("667544", 153838813210900)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
@@ -307,7 +307,7 @@ func TestDeleteSku(t *testing.T) {
|
|||||||
fmt.Println(err2)
|
fmt.Println(err2)
|
||||||
}
|
}
|
||||||
for _, v := range skuInfo2.List {
|
for _, v := range skuInfo2.List {
|
||||||
skuIds = append(skuIds, v.SkuID)
|
skuIds = append(skuIds, v.SkuId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := 1; i <= skuInfo.Pages; i++ {
|
for i := 1; i <= skuInfo.Pages; i++ {
|
||||||
|
|||||||
Reference in New Issue
Block a user