第三方api接口
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

43 wiersze
1.4 KiB

  1. package zhimeng
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md"
  4. zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
  5. "encoding/json"
  6. )
  7. func PddGoods(param map[string]interface{}) []map[string]string {
  8. var goods = make([]map[string]string, 0)
  9. resp, err := Send("pdd", "getgoods", param)
  10. if err != nil {
  11. return goods
  12. }
  13. var tmp struct {
  14. Data []md.PDDZhimengItem `json:"data"`
  15. }
  16. if err = json.Unmarshal(resp, &tmp); err != nil {
  17. return goods
  18. }
  19. for _, v := range tmp.Data {
  20. sales := v.GoodsSales
  21. if sales == "" {
  22. sales = v.InOrderCount
  23. }
  24. var tmp = map[string]string{
  25. "gid": v.GoodsSign,
  26. "title": v.GoodsTitle,
  27. "img": v.GoodsImg,
  28. "sales": sales,
  29. "price": zhios_third_party_utils.Float64ToStr(v.MinGroupPrice - float64(v.CouponPrice)),
  30. "cost_price": zhios_third_party_utils.Float64ToStr(v.MinNormalPrice),
  31. "coupon": zhios_third_party_utils.IntToStr(v.CouponPrice),
  32. "commission_rate": zhios_third_party_utils.AnyToString(v.Commission),
  33. "commission": zhios_third_party_utils.Float64ToStr((v.MinGroupPrice - float64(v.CouponPrice)) * (zhios_third_party_utils.AnyToFloat64(v.Commission) / 100)),
  34. "pvd": md.PVD_PDD,
  35. "share_content": "",
  36. }
  37. goods = append(goods, tmp)
  38. }
  39. return goods
  40. }