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 PddGoods(param map[string]interface{}) []map[string]string { var goods = make([]map[string]string, 0) resp, err := Send("pdd", "getgoods", param) if err != nil { return goods } var tmp struct { Data []md.PDDZhimengItem `json:"data"` } if err = json.Unmarshal(resp, &tmp); err != nil { return goods } for _, v := range tmp.Data { sales := v.GoodsSales if sales == "" { sales = v.InOrderCount } var tmp = map[string]string{ "gid": v.GoodsSign, "title": v.GoodsTitle, "img": v.GoodsImg, "sales": sales, "price": zhios_third_party_utils.Float64ToStr(v.MinGroupPrice - float64(v.CouponPrice)), "cost_price": zhios_third_party_utils.Float64ToStr(v.MinNormalPrice), "coupon": zhios_third_party_utils.IntToStr(v.CouponPrice), "commission_rate": zhios_third_party_utils.AnyToString(v.Commission), "commission": zhios_third_party_utils.Float64ToStr((v.MinGroupPrice - float64(v.CouponPrice)) * (zhios_third_party_utils.AnyToFloat64(v.Commission) / 100)), "pvd": md.PVD_PDD, "share_content": "", } goods = append(goods, tmp) } return goods }