package zhimeng import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md" zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" "encoding/json" ) func JdGoods(param map[string]interface{}) []map[string]string { var goods = make([]map[string]string, 0) resp, err := Send("jd", "new_getgoods", param) if err != nil { return goods } var tmp struct { Data []md.JDZhimengItem `json:"data"` } if err = json.Unmarshal(resp, &tmp); err != nil { return goods } for _, v := range tmp.Data { var tmp = map[string]string{ "gid": v.Gid, "title": v.GoodsTitle, "img": v.GoodsImg, "sales": zhios_third_party_utils.IntToStr(v.InOrderCount), "price": zhios_third_party_utils.Float64ToStr(v.WlGoodsPrice - float64(v.CouponPrice)), "cost_price": zhios_third_party_utils.Float64ToStr(v.PcGoodsPrice), "coupon": zhios_third_party_utils.IntToStr(v.CouponPrice), "commission_rate": zhios_third_party_utils.AnyToString(v.CommissionRate), "commission": zhios_third_party_utils.Float64ToStr((v.WlGoodsPrice - float64(v.CouponPrice)) * (zhios_third_party_utils.AnyToFloat64(v.CommissionRate) / 100)), "pvd": md.PVD_JD, "share_content": "", } goods = append(goods, tmp) } return goods } // NewZhiMengJingDongSDK is constructor func NewZhiMengJingDongSDK() *SDK { jd := &SDK{} jd.Init(md.PVD_JD) return jd }