pdd物料推荐
This commit is contained in:
@@ -181,3 +181,61 @@ func (a *API) GoodsDetail(goodsID string) (goodsDetailResult *GoodsDetailResult,
|
|||||||
}
|
}
|
||||||
return goodsDetailResult, err
|
return goodsDetailResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GoodsRecommendGetResult struct {
|
||||||
|
Total int `json:"total"`
|
||||||
|
ListID string `json:"list_id"`
|
||||||
|
List []struct {
|
||||||
|
CategoryName string `json:"category_name"`
|
||||||
|
CouponRemainQuantity int `json:"coupon_remain_quantity"`
|
||||||
|
PromotionRate int `json:"promotion_rate"`
|
||||||
|
CatIds []int `json:"cat_ids"`
|
||||||
|
CouponMinOrderAmount int `json:"coupon_min_order_amount"`
|
||||||
|
CategoryID string `json:"category_id"`
|
||||||
|
MallID int `json:"mall_id"`
|
||||||
|
MallName string `json:"mall_name"`
|
||||||
|
CouponTotalQuantity int `json:"coupon_total_quantity"`
|
||||||
|
MerchantType string `json:"merchant_type"`
|
||||||
|
LgstTxt string `json:"lgst_txt"`
|
||||||
|
GoodsName string `json:"goods_name"`
|
||||||
|
SalesTip string `json:"sales_tip"`
|
||||||
|
GoodsID int64 `json:"goods_id"`
|
||||||
|
DescTxt string `json:"desc_txt"`
|
||||||
|
PredictPromotionRate int `json:"predict_promotion_rate"`
|
||||||
|
GoodsDesc string `json:"goods_desc"`
|
||||||
|
OptName string `json:"opt_name"`
|
||||||
|
GoodsThumbnailURL string `json:"goods_thumbnail_url"`
|
||||||
|
ShareRate int `json:"share_rate"`
|
||||||
|
OptID string `json:"opt_id"`
|
||||||
|
OptIds []int `json:"opt_ids"`
|
||||||
|
SearchID string `json:"search_id"`
|
||||||
|
GoodsImageURL string `json:"goods_image_url"`
|
||||||
|
ActivityTags []int `json:"activity_tags"`
|
||||||
|
HasCoupon bool `json:"has_coupon"`
|
||||||
|
MinNormalPrice int `json:"min_normal_price"`
|
||||||
|
ServTxt string `json:"serv_txt"`
|
||||||
|
UnifiedTags []interface{} `json:"unified_tags"`
|
||||||
|
CouponStartTime int `json:"coupon_start_time"`
|
||||||
|
MinGroupPrice int `json:"min_group_price"`
|
||||||
|
CouponDiscount int `json:"coupon_discount"`
|
||||||
|
GoodsSign string `json:"goods_sign"`
|
||||||
|
CouponEndTime int `json:"coupon_end_time"`
|
||||||
|
ExtraCouponAmount int `json:"extra_coupon_amount,omitempty"`
|
||||||
|
} `json:"list"`
|
||||||
|
RequestID string `json:"request_id"`
|
||||||
|
SearchID string `json:"search_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//多多进宝商品推荐查询
|
||||||
|
func (a *API) GoodsRecommendGet(goodsID string, rcmmdType, offset, pageSize int) (goodsSearchResult *GoodsRecommendGetResult, err error) {
|
||||||
|
result, err := a.AccessAPI("pdd.ddk.goods.recommend.get", false, map[string]interface{}{
|
||||||
|
"goods_sign_list": []string{"\"" + goodsID + "\""},
|
||||||
|
"channel_type": rcmmdType,
|
||||||
|
"limit": pageSize,
|
||||||
|
"offset": offset,
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result["goods_basic_detail_response"], &goodsSearchResult, false)
|
||||||
|
}
|
||||||
|
return goodsSearchResult, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,3 +32,11 @@ func TestGoodsDetail(t *testing.T) {
|
|||||||
}
|
}
|
||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGoodsRecommendGet(t *testing.T) {
|
||||||
|
result, err := api.GoodsRecommendGet("Y9j2gIAgrxpKWDjRwfDZdyHfazgTDQpH_JyzHgT6ly", 3, 0, 10)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user