aa
This commit is contained in:
@@ -114,3 +114,70 @@ func (a *API) GoodsSearch(goodsSearchParam *GoodsSearchParam) (goodsSearchResult
|
||||
}
|
||||
return goodsSearchResult, err
|
||||
}
|
||||
|
||||
type GoodsDetailResult struct {
|
||||
CategoryName string `json:"category_name"`
|
||||
CouponRemainQuantity int `json:"coupon_remain_quantity"`
|
||||
PromotionRate int `json:"promotion_rate"`
|
||||
ServiceTags []int `json:"service_tags"`
|
||||
MallID int `json:"mall_id"`
|
||||
MallName string `json:"mall_name"`
|
||||
MallCouponEndTime int `json:"mall_coupon_end_time"`
|
||||
LgstTxt string `json:"lgst_txt"`
|
||||
GoodsName string `json:"goods_name"`
|
||||
GoodsGalleryUrls []string `json:"goods_gallery_urls"`
|
||||
GoodsID int64 `json:"goods_id"`
|
||||
PredictPromotionRate int `json:"predict_promotion_rate"`
|
||||
GoodsDesc string `json:"goods_desc"`
|
||||
OptName string `json:"opt_name"`
|
||||
ShareRate int `json:"share_rate"`
|
||||
OptIds []int `json:"opt_ids"`
|
||||
GoodsImageURL string `json:"goods_image_url"`
|
||||
MallImgURL string `json:"mall_img_url"`
|
||||
HasMallCoupon bool `json:"has_mall_coupon"`
|
||||
UnifiedTags []interface{} `json:"unified_tags"`
|
||||
VideoUrls []string `json:"video_urls"`
|
||||
CouponStartTime int `json:"coupon_start_time"`
|
||||
MinGroupPrice int `json:"min_group_price"`
|
||||
CouponDiscount int `json:"coupon_discount"`
|
||||
CouponEndTime int `json:"coupon_end_time"`
|
||||
ZsDuoID int `json:"zs_duo_id"`
|
||||
MallCouponRemainQuantity int `json:"mall_coupon_remain_quantity"`
|
||||
PlanType int `json:"plan_type"`
|
||||
ExtraCouponAmount int `json:"extra_coupon_amount"`
|
||||
CatIds []int `json:"cat_ids"`
|
||||
CouponMinOrderAmount int `json:"coupon_min_order_amount"`
|
||||
CategoryID int `json:"category_id"`
|
||||
MallCouponDiscountPct int `json:"mall_coupon_discount_pct"`
|
||||
CouponTotalQuantity int `json:"coupon_total_quantity"`
|
||||
MallCouponMinOrderAmount int `json:"mall_coupon_min_order_amount"`
|
||||
MerchantType int `json:"merchant_type"`
|
||||
SalesTip string `json:"sales_tip"`
|
||||
OnlySceneAuth bool `json:"only_scene_auth"`
|
||||
DescTxt string `json:"desc_txt"`
|
||||
GoodsThumbnailURL string `json:"goods_thumbnail_url"`
|
||||
OptID int `json:"opt_id"`
|
||||
HasCoupon bool `json:"has_coupon"`
|
||||
MinNormalPrice int `json:"min_normal_price"`
|
||||
MallCouponStartTime int `json:"mall_coupon_start_time"`
|
||||
ServTxt string `json:"serv_txt"`
|
||||
MallCouponTotalQuantity int `json:"mall_coupon_total_quantity"`
|
||||
MallCouponMaxDiscountAmount int `json:"mall_coupon_max_discount_amount"`
|
||||
MallCps int `json:"mall_cps"`
|
||||
GoodsSign string `json:"goods_sign"`
|
||||
}
|
||||
|
||||
//多多进宝商品详情
|
||||
func (a *API) GoodsDetail(goodsID string) (goodsDetailResult *GoodsDetailResult, err error) {
|
||||
var goodsDetailResults []*GoodsDetailResult
|
||||
result, err := a.AccessAPI("pdd.ddk.goods.detail", false, map[string]interface{}{
|
||||
"goods_sign": goodsID,
|
||||
})
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["goods_detail_response"].(map[string]interface{})["goods_details"], &goodsDetailResults, false)
|
||||
if len(goodsDetailResults) > 0 {
|
||||
goodsDetailResult = goodsDetailResults[0]
|
||||
}
|
||||
}
|
||||
return goodsDetailResult, err
|
||||
}
|
||||
|
||||
@@ -24,3 +24,11 @@ func TestGoodsSearch(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestGoodsDetail(t *testing.T) {
|
||||
result, err := api.GoodsDetail("Y9j2gIAgrxpKWDjRwfDZdyHfazgTDQpH_JyzHgT6ly")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user