huangjiajun преди 5 месеца
родител
ревизия
34755b7869
променени са 2 файла, в които са добавени 129 реда и са изтрити 0 реда
  1. +88
    -0
      md/cps_pdd/goods.go
  2. +41
    -0
      pdd_union/goods.go

+ 88
- 0
md/cps_pdd/goods.go Целия файл

@@ -72,3 +72,91 @@ type SearchGoods struct {
TotalCount int `json:"total_count"`
} `json:"goods_search_response"`
}
type GoodsDetail struct {
GoodsDetailResponse struct {
GoodsDetails []struct {
ActivityPromotionRate int `json:"activity_promotion_rate"`
ActivityTags []int `json:"activity_tags"`
BrandName string `json:"brand_name"`
CashGiftAmount int `json:"cash_gift_amount"`
CatId int `json:"cat_id"`
CatIds []int `json:"cat_ids"`
CltCpnBatchSn string `json:"clt_cpn_batch_sn"`
CltCpnDiscount int `json:"clt_cpn_discount"`
CltCpnEndTime int `json:"clt_cpn_end_time"`
CltCpnMinAmt int `json:"clt_cpn_min_amt"`
CltCpnQuantity int `json:"clt_cpn_quantity"`
CltCpnRemainQuantity int `json:"clt_cpn_remain_quantity"`
CltCpnStartTime int `json:"clt_cpn_start_time"`
CouponDiscount int `json:"coupon_discount"`
CouponEndTime int `json:"coupon_end_time"`
CouponMinOrderAmount int `json:"coupon_min_order_amount"`
CouponRemainQuantity int `json:"coupon_remain_quantity"`
CouponStartTime int `json:"coupon_start_time"`
CouponTotalQuantity int `json:"coupon_total_quantity"`
CreateAt int `json:"create_at"`
DescTxt string `json:"desc_txt"`
ExtraCouponAmount int `json:"extra_coupon_amount"`
GoodsDesc string `json:"goods_desc"`
GoodsGalleryUrls []string `json:"goods_gallery_urls"`
GoodsImageUrl string `json:"goods_image_url"`
GoodsName string `json:"goods_name"`
GoodsSign string `json:"goods_sign"`
GoodsThumbnailUrl string `json:"goods_thumbnail_url"`
HasCoupon bool `json:"has_coupon"`
HasMallCoupon bool `json:"has_mall_coupon"`
LgstTxt string `json:"lgst_txt"`
MallCouponDiscountPct int `json:"mall_coupon_discount_pct"`
MallCouponEndTime int `json:"mall_coupon_end_time"`
MallCouponMaxDiscountAmount int `json:"mall_coupon_max_discount_amount"`
MallCouponMinOrderAmount int `json:"mall_coupon_min_order_amount"`
MallCouponRemainQuantity int `json:"mall_coupon_remain_quantity"`
MallCouponStartTime int `json:"mall_coupon_start_time"`
MallCouponTotalQuantity int `json:"mall_coupon_total_quantity"`
MallCps int `json:"mall_cps"`
MallId int `json:"mall_id"`
MallImgUrl string `json:"mall_img_url"`
MallName string `json:"mall_name"`
MaterialList []struct {
Id string `json:"id"`
ImageList []string `json:"image_list"`
TextList []string `json:"text_list"`
ThumbnailUrl string `json:"thumbnail_url"`
Type int `json:"type"`
VideoUrl string `json:"video_url"`
} `json:"material_list"`
MerchantType int `json:"merchant_type"`
MinGroupPrice int `json:"min_group_price"`
MinNormalPrice int `json:"min_normal_price"`
OnlySceneAuth bool `json:"only_scene_auth"`
OptId int `json:"opt_id"`
OptIds []int `json:"opt_ids"`
OptName string `json:"opt_name"`
PlanType int `json:"plan_type"`
PredictPromotionRate int `json:"predict_promotion_rate"`
PromotionRate int `json:"promotion_rate"`
SalesTip string `json:"sales_tip"`
ServTxt string `json:"serv_txt"`
ServiceTags []int `json:"service_tags"`
ShareRate int `json:"share_rate"`
SkuList []struct {
IsOnsale int `json:"is_onsale"`
MinGroupPrice int `json:"min_group_price"`
SkuThumbUrl string `json:"sku_thumb_url"`
SpecList []struct {
Note string `json:"note"`
ParentSpecId int `json:"parent_spec_id"`
ParentSpecValue string `json:"parent_spec_value"`
SpecId int `json:"spec_id"`
SpecValue string `json:"spec_value"`
} `json:"spec_list"`
} `json:"sku_list"`
SubsidyAmount int `json:"subsidy_amount"`
SubsidyDuoAmountTenMillion int `json:"subsidy_duo_amount_ten_million"`
SubsidyGoodsType int `json:"subsidy_goods_type"`
UnifiedTags []string `json:"unified_tags"`
VideoUrls []string `json:"video_urls"`
ZsDuoId int `json:"zs_duo_id"`
} `json:"goods_details"`
} `json:"goods_detail_response"`
}

+ 41
- 0
pdd_union/goods.go Целия файл

@@ -48,3 +48,44 @@ func GetSearchGoods(keyArr map[string]string, param map[string]interface{}) []ma
}
return data
}
func GetGoodsDetail(keyArr map[string]string, param map[string]interface{}) map[string]string {
send, _ := Send(keyArr, "pdd.ddk.oauth.goods.detail", param)
var res cps_pdd.GoodsDetail
json.Unmarshal([]byte(send), &res)
data := make(map[string]string)
for _, v := range res.GoodsDetailResponse.GoodsDetails {
tmp := make(map[string]string)
tmp["gid"] = v.GoodsSign
tmp["goods_title"] = v.GoodsName
tmp["commission"] = zhios_third_party_utils.Float64ToStr(float64(v.PromotionRate) / 10)
tmp["coupon_start_time"] = "0"
tmp["coupon_end_time"] = "0"
if v.CouponStartTime > 0 {
tmp["coupon_start_time"] = zhios_third_party_utils.IntToStr(v.CouponStartTime)
}
if v.CouponEndTime > 0 {
tmp["coupon_end_time"] = zhios_third_party_utils.IntToStr(v.CouponEndTime)
}
tmp["coupon_price"] = zhios_third_party_utils.Float64ToStr(float64(v.CouponDiscount) / 100)
tmp["shop_name"] = v.MallName
tmp["mall_id"] = zhios_third_party_utils.IntToStr(v.MallId)
tmp["min_normal_price"] = zhios_third_party_utils.Float64ToStr(float64(v.MinNormalPrice) / 100)
tmp["min_group_price"] = zhios_third_party_utils.Float64ToStr(float64(v.MinGroupPrice) / 100)
//销量处理
tmp["goods_sales"] = v.SalesTip
if strings.Contains(tmp["goods_sales"], "万+") {
tmp["goods_sales"] = strings.ReplaceAll(tmp["goods_sales"], "万+", "")
tmp["goods_sales"] = zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.StrToFloat64(tmp["goods_sales"]) * 10000)
}
if strings.Contains(tmp["goods_sales"], "万") {
tmp["goods_sales"] = strings.ReplaceAll(tmp["goods_sales"], "万", "")
tmp["goods_sales"] = zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.StrToFloat64(tmp["goods_sales"]) * 10000)
}
tmp["goods_img"] = v.GoodsImageUrl
tmp["goods_min_img"] = v.GoodsThumbnailUrl
tmp["goods_desc"] = v.GoodsDesc
tmp["goods_sign"] = v.GoodsSign
data = tmp
}
return data
}

Зареждане…
Отказ
Запис