第三方api接口
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

7 месяцев назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package pdd_union
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md/cps_pdd"
  4. zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
  5. "encoding/json"
  6. "strings"
  7. )
  8. func GetSearchGoods(keyArr map[string]string, param map[string]interface{}) {
  9. send, _ := Send(keyArr, "pdd.ddk.oauth.goods.search", param)
  10. var res cps_pdd.SearchGoods
  11. json.Unmarshal([]byte(send), &res)
  12. data := make([]map[string]string, 0)
  13. for _, v := range res.GoodsSearchResponse.GoodsList {
  14. tmp := make(map[string]string)
  15. tmp["gid"] = v.GoodsSign
  16. tmp["goods_title"] = v.GoodsName
  17. tmp["commission"] = zhios_third_party_utils.Float64ToStr(float64(v.PromotionRate) / 10)
  18. tmp["coupon_start_time"] = "0"
  19. tmp["coupon_end_time"] = "0"
  20. if v.CouponStartTime > 0 {
  21. tmp["coupon_start_time"] = zhios_third_party_utils.IntToStr(v.CouponStartTime)
  22. }
  23. if v.CouponEndTime > 0 {
  24. tmp["coupon_end_time"] = zhios_third_party_utils.IntToStr(v.CouponEndTime)
  25. }
  26. tmp["coupon_price"] = zhios_third_party_utils.Float64ToStr(float64(v.CouponDiscount) / 100)
  27. tmp["shop_name"] = v.MallName
  28. tmp["mall_id"] = zhios_third_party_utils.IntToStr(v.MallId)
  29. tmp["min_normal_price"] = zhios_third_party_utils.Float64ToStr(float64(v.MinNormalPrice) / 100)
  30. tmp["min_group_price"] = zhios_third_party_utils.Float64ToStr(float64(v.MinGroupPrice) / 100)
  31. //销量处理
  32. tmp["goods_sales"] = v.SalesTip
  33. if strings.Contains(tmp["goods_sales"], "万+") {
  34. tmp["goods_sales"] = strings.ReplaceAll(tmp["goods_sales"], "万+", "")
  35. tmp["goods_sales"] = zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.StrToFloat64(tmp["goods_sales"]) * 10000)
  36. }
  37. if strings.Contains(tmp["goods_sales"], "万") {
  38. tmp["goods_sales"] = strings.ReplaceAll(tmp["goods_sales"], "万", "")
  39. tmp["goods_sales"] = zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.StrToFloat64(tmp["goods_sales"]) * 10000)
  40. }
  41. tmp["goods_img"] = v.GoodsImageUrl
  42. tmp["goods_min_img"] = v.GoodsThumbnailUrl
  43. tmp["goods_desc"] = v.GoodsDesc
  44. tmp["goods_sign"] = v.GoodsSign
  45. data = append(data, tmp)
  46. }
  47. }