第三方api接口
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.

jingtuitui.go 1.7 KiB

1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
12345678910111213141516171819202122232425262728293031323334353637383940
  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. "img_list": zhios_third_party_utils.SerializeStr(v.ImgInfo),
  23. "gid": zhios_third_party_utils.AnyToString(v.GoodsID),
  24. "title": v.GoodsInfo.GoodsName,
  25. "img": v.GoodsInfo.GoodsImg,
  26. "sales": zhios_third_party_utils.IntToStr(v.GoodsInfo.InOrderCount30Days),
  27. "price": zhios_third_party_utils.AnyToString(v.GoodsInfo.FinalPrice),
  28. "cost_price": zhios_third_party_utils.AnyToString(v.GoodsInfo.GoodsPrice),
  29. "coupon": zhios_third_party_utils.AnyToString(v.GoodsInfo.DiscountPrice),
  30. "commission_rate": zhios_third_party_utils.AnyToString(v.GoodsInfo.CommissionShare),
  31. "commission": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.AnyToFloat64(v.GoodsInfo.FinalPrice) * (zhios_third_party_utils.AnyToFloat64(v.GoodsInfo.CommissionShare) / 100)),
  32. "pvd": md.PVD_JDS,
  33. "share_content": v.CircleContent[0],
  34. }
  35. goods = append(goods, tmp)
  36. }
  37. return goods
  38. }