第三方api接口
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

40 líneas
1.6 KiB

  1. package jingtuitui
  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. "github.com/tidwall/gjson"
  7. )
  8. func JingtuituiGetCircleList(params map[string]string) []map[string]string {
  9. var goods = make([]map[string]string, 0)
  10. resp, err := SendReq("http://japi.jingtuitui.com/api/get_circle_list", params)
  11. if err != nil {
  12. return goods
  13. }
  14. data := gjson.Get(string(resp), "result.data").String()
  15. if data == "" {
  16. return goods
  17. }
  18. var oldGoods []md.JingtuituiGetCircleList
  19. json.Unmarshal([]byte(data), &oldGoods)
  20. for _, v := range oldGoods {
  21. var tmp = map[string]string{
  22. "gid": zhios_third_party_utils.AnyToString(v.GoodsID),
  23. "title": v.GoodsInfo.GoodsName,
  24. "img": v.GoodsInfo.GoodsImg,
  25. "sales": zhios_third_party_utils.IntToStr(v.GoodsInfo.InOrderCount30Days),
  26. "price": zhios_third_party_utils.AnyToString(v.GoodsInfo.FinalPrice),
  27. "cost_price": zhios_third_party_utils.AnyToString(v.GoodsInfo.GoodsPrice),
  28. "coupon": zhios_third_party_utils.AnyToString(v.GoodsInfo.DiscountPrice),
  29. "commission_rate": zhios_third_party_utils.AnyToString(v.GoodsInfo.CommissionShare),
  30. "commission": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.AnyToFloat64(v.GoodsInfo.FinalPrice) * (zhios_third_party_utils.AnyToFloat64(v.GoodsInfo.CommissionShare) / 100)),
  31. "pvd": md.PVD_JDS,
  32. "share_content": v.CircleContent[0],
  33. }
  34. goods = append(goods, tmp)
  35. }
  36. return goods
  37. }