You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pinduoduo/pdd.ddk.goods.detail.go

112 lines
10 KiB

2 years ago
package pinduoduo
import (
2 years ago
"context"
2 years ago
"encoding/json"
"go.dtapp.net/gorequest"
)
type GoodsDetailResponse struct {
GoodsDetailResponse struct {
GoodsDetails []struct {
ActivityPromotionRate int `json:"activity_promotion_rate,omitempty"` // 活动佣金比例,千分比(特定活动期间的佣金比例)
ActivityTags []int `json:"activity_tags,omitempty"` // 商品活动标记数组,例:[4,7]4-秒杀 7-百亿补贴等
BrandName string `json:"brand_name,omitempty"` // 商品品牌词信息,如“苹果”、“阿迪达斯”、“李宁”等
CashGiftAmount int `json:"cash_gift_amount,omitempty"` // 全局礼金金额,单位分
CatId int `json:"cat_id,omitempty"` // 商品类目ID使用pdd.goods.cats.get接口获取
CatIds []int `json:"cat_ids,omitempty"` // 商品一~四级类目ID列表
CltCpnBatchSn string `json:"clt_cpn_batch_sn,omitempty"` // 店铺收藏券id
CltCpnDiscount int `json:"clt_cpn_discount,omitempty"` // 店铺收藏券面额,单位为分
CltCpnEndTime int `json:"clt_cpn_end_time,omitempty"` // 店铺收藏券截止时间
CltCpnMinAmt int `json:"clt_cpn_min_amt,omitempty"` // 店铺收藏券使用门槛价格,单位为分
CltCpnQuantity int `json:"clt_cpn_quantity,omitempty"` // 店铺收藏券总量
CltCpnRemainQuantity int `json:"clt_cpn_remain_quantity,omitempty"` // 店铺收藏券剩余量
CltCpnStartTime int `json:"clt_cpn_start_time,omitempty"` // 店铺收藏券起始时间
CouponDiscount int64 `json:"coupon_discount,omitempty"` // 优惠券面额,单位为分
CouponEndTime int `json:"coupon_end_time,omitempty"` // 优惠券失效时间UNIX时间戳
CouponMinOrderAmount int `json:"coupon_min_order_amount,omitempty"` // 优惠券门槛金额,单位为分
CouponRemainQuantity int `json:"coupon_remain_quantity,omitempty"` // 优惠券剩余数量
CouponStartTime int `json:"coupon_start_time,omitempty"` // 优惠券生效时间UNIX时间戳
CouponTotalQuantity int `json:"coupon_total_quantity,omitempty"` // 优惠券总数量
CreateAt int `json:"create_at,omitempty"` // 创建时间unix时间戳
DescTxt string `json:"desc_txt,omitempty"` // 描述分
ExtraCouponAmount int `json:"extra_coupon_amount,omitempty"` // 额外优惠券
GoodsDesc string `json:"goods_desc,omitempty"` // 参与多多进宝的商品描述
GoodsGalleryUrls []string `json:"goods_gallery_urls,omitempty"` // 商品轮播图
GoodsImageUrl string `json:"goods_image_url,omitempty"` // 多多进宝商品主图
GoodsName string `json:"goods_name,omitempty"` // 参与多多进宝的商品标题
GoodsSign string `json:"goods_sign,omitempty"` // 商品goodsSign支持通过goodsSign查询商品。goodsSign是加密后的goodsId, goodsId已下线请使用goodsSign来替代。使用说明https://jinbao.pinduoduo.com/qa-system?questionId=252
GoodsThumbnailUrl string `json:"goods_thumbnail_url,omitempty"` // 商品缩略图
HasCoupon bool `json:"has_coupon,omitempty"` // 商品是否有优惠券 true-有false-没有
HasMallCoupon bool `json:"has_mall_coupon,omitempty"` // 是否有店铺券
LgstTxt string `json:"lgst_txt,omitempty"` // 物流分
MallCouponDiscountPct int64 `json:"mall_coupon_discount_pct,omitempty"` // 店铺折扣
MallCouponEndTime int `json:"mall_coupon_end_time,omitempty"` // 店铺券使用结束时间
MallCouponMaxDiscountAmount int64 `json:"mall_coupon_max_discount_amount,omitempty"` // 最大使用金额
MallCouponMinOrderAmount int64 `json:"mall_coupon_min_order_amount,omitempty"` // 最小使用金额
MallCouponRemainQuantity int `json:"mall_coupon_remain_quantity,omitempty"` // 店铺券余量
MallCouponStartTime int `json:"mall_coupon_start_time,omitempty"` // 店铺券使用开始时间
MallCouponTotalQuantity int `json:"mall_coupon_total_quantity,omitempty"` // 店铺券总量
MallCps int64 `json:"mall_cps,omitempty"` // 该商品所在店铺是否参与全店推广01
MallId int64 `json:"mall_id,omitempty"` // 商家id
MallImgUrl string `json:"mall_img_url,omitempty"` // 店铺logo图
MallName string `json:"mall_name,omitempty"` // 店铺名称
MaterialList []struct {
Id string `json:"id,omitempty"` // 素材ID
ImageList []string `json:"image_list,omitempty"` // 图片列表
TextList []string `json:"text_list,omitempty"` // 文字列表
ThumbnailUrl string `json:"thumbnail_url,omitempty"` // 视频缩略图
Mtype int `json:"type,omitempty"` // 素材类型1-图文2-视频
VideoUrl string `json:"video_url,omitempty"` // 视频url
} `json:"material_list"`
MerchantType int `json:"merchant_type,omitempty"` // 店铺类型1-个人2-企业3-旗舰店4-专卖店5-专营店6-普通店(未传为全部)
MinGroupPrice int64 `json:"min_group_price,omitempty"` // 最低价sku的拼团价单位为分
MinNormalPrice int64 `json:"min_normal_price,omitempty"` // 最低价sku的单买价单位为分
OnlySceneAuth bool `json:"only_scene_auth,omitempty"` // 快手专享
OptId int `json:"opt_id,omitempty"` // 商品标签ID使用pdd.goods.opt.get接口获取
OptIds []int `json:"opt_ids,omitempty"` // 商品标签ID
OptName string `json:"opt_name,omitempty"` // 商品标签名称
PlanType int `json:"plan_type,omitempty"` // 推广计划类型: 1-全店推广 2-单品推广 3-定向推广 4-招商推广 5-分销推广
PredictPromotionRate int `json:"predict_promotion_rate,omitempty"` // 比价行为预判定佣金,需要用户备案
PromotionRate int64 `json:"promotion_rate,omitempty"` // 佣金比例,千分比
SalesTip string `json:"sales_tip,omitempty"` // 已售卖件数
ServiceTags []int `json:"service_tags,omitempty"` // 服务标签: 4-送货入户并安装,5-送货入户,6-电子发票,9-坏果包赔,11-闪电退款,12-24小时发货,13-48小时发货,17-顺丰包邮,18-只换不修,1可定制化,29-预约配送,1000001-正品发票,1000002-送货入户并安装
ServTxt string `json:"serv_txt,omitempty"` // 服务分
ShareRate int `json:"share_rate,omitempty"` // 招商分成服务费比例,千分比
SubsidyAmount int `json:"subsidy_amount,omitempty"` // 优势渠道专属商品补贴金额,单位为分。针对优质渠道的补贴活动,指定优势渠道可通过推广该商品获取相应补贴。补贴活动入口:[进宝网站-官方活动-千万补贴]报名入口https://jinbao.pinduoduo.com/ten-million-subsidy/entry
SubsidyDuoAmountTenMillion int `json:"subsidy_duo_amount_ten_million,omitempty"` // 千万补贴给渠道的收入补贴,不允许直接给下级代理展示,单位为分
UnifiedTags []string `json:"unified_tags,omitempty"` // 优惠标签列表,包括:"X元券","比全网低X元","服务费","精选素材","近30天低价","同款低价","同款好评","同款热销","旗舰店","一降到底","招商优选","商家优选","好价再降X元","全站销量XX","实时热销榜第X名","实时好评榜第X名","额外补X元"等
VideoUrls []string `json:"video_urls,omitempty"` // 商品视频url
ZsDuoId int `json:"zs_duo_id,omitempty"` // 招商团长id
GoodsId int64 `json:"goods_id"`
CategoryId int64 `json:"category_id"`
CategoryName string `json:"category_name"`
} `json:"goods_details"`
} `json:"goods_detail_response"`
}
type GoodsDetailResult struct {
Result GoodsDetailResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
2 years ago
func newGoodsDetailResult(result GoodsDetailResponse, body []byte, http gorequest.Response, err error) *GoodsDetailResult {
2 years ago
return &GoodsDetailResult{Result: result, Body: body, Http: http, Err: err}
}
// GoodsDetail 多多进宝商品详情查询
// https://jinbao.pinduoduo.com/third-party/api-detail?apiName=pdd.ddk.goods.detail
2 years ago
func (c *Client) GoodsDetail(ctx context.Context, notMustParams ...Params) *GoodsDetailResult {
2 years ago
// 参数
params := NewParamsWithType("pdd.ddk.goods.detail", notMustParams...)
2 years ago
params.Set("pid", c.GetPid())
2 years ago
// 请求
2 years ago
request, err := c.request(ctx, params)
2 years ago
// 定义
var response GoodsDetailResponse
err = json.Unmarshal(request.ResponseBody, &response)
2 years ago
return newGoodsDetailResult(response, request.ResponseBody, request, err)
2 years ago
}