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 WphGoods(param map[string]interface{}) []map[string]string { var goods = make([]map[string]string, 0) resp, err := Send("wph_new", "seach_goods", param) if err != nil { return goods } var tmp struct { Data []md.VIPZhimengItem `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": "", "price": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.StrToFloat64(v.GoodsPrice) - zhios_third_party_utils.StrToFloat64(v.YhqPrice)), "cost_price": v.GoodsCostPrice, "coupon": v.YhqPrice, "commission_rate": zhios_third_party_utils.AnyToString(v.CommissionRate), "commission": zhios_third_party_utils.Float64ToStr((zhios_third_party_utils.StrToFloat64(v.GoodsPrice) - zhios_third_party_utils.StrToFloat64(v.YhqPrice)) * (zhios_third_party_utils.AnyToFloat64(v.CommissionRate) / 100)), "pvd": md.PVD_VIP, "share_content": "", } goods = append(goods, tmp) } return goods }