package wph import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md/wph" zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" "encoding/json" "github.com/tidwall/gjson" ) //关键字查询 func QueryWithOauth(serviceParam map[string]string, param string) []wph.WphGoods { post, _ := SendPost("com.vip.adp.api.open.service.UnionGoodsService", "queryWithOauth", serviceParam, param) var goods = make([]wph.OfficialGoods, 0) json.Unmarshal([]byte(gjson.Get(post, "result.goodsInfoList").String()), &goods) list := make([]wph.WphGoods, 0) for _, v := range goods { tmp := wph.WphGoods{ Gid: v.GoodsId + "adCode" + v.AdCode, AdCode: v.AdCode, GoodsTitle: v.GoodsName, GoodsDesc: v.GoodsDesc, GoodsImg: v.GoodsMainPicture, ImgList: v.GoodsCarouselPictures, SourceType: zhios_third_party_utils.IntToStr(v.SourceType), GoodsPrice: v.VipPrice, GoodsCostPrice: v.MarketPrice, Commission: v.Commission, CommissionRate: v.CommissionRate, Discount: v.Discount, YhqPrice: v.CouponInfo.Fav, CouponPrice: v.CouponInfo.Fav, } if zhios_third_party_utils.StrToFloat64(tmp.YhqPrice) == 0 { tmp.YhqPrice = v.ExclusiveCoupon.Fav tmp.CouponPrice = v.ExclusiveCoupon.Fav } list = append(list, tmp) } return list } //联盟在推商品列表 func GoodsListWithOauth(serviceParam map[string]string, param string) []wph.WphGoods { post, _ := SendPost("com.vip.adp.api.open.service.UnionGoodsService", "goodsListWithOauth", serviceParam, param) var goods = make([]wph.OfficialGoods, 0) json.Unmarshal([]byte(gjson.Get(post, "result.goodsInfoList").String()), &goods) list := make([]wph.WphGoods, 0) for _, v := range goods { tmp := wph.WphGoods{ Gid: v.GoodsId + "adCode" + v.AdCode, AdCode: v.AdCode, GoodsTitle: v.GoodsName, GoodsDesc: v.GoodsDesc, GoodsImg: v.GoodsMainPicture, ImgList: v.GoodsCarouselPictures, SourceType: zhios_third_party_utils.IntToStr(v.SourceType), GoodsPrice: v.VipPrice, GoodsCostPrice: v.MarketPrice, Commission: v.Commission, CommissionRate: v.CommissionRate, Discount: v.Discount, YhqPrice: v.CouponInfo.Fav, CouponPrice: v.CouponInfo.Fav, } if zhios_third_party_utils.StrToFloat64(tmp.YhqPrice) == 0 { tmp.YhqPrice = v.ExclusiveCoupon.Fav tmp.CouponPrice = v.ExclusiveCoupon.Fav } list = append(list, tmp) } return list } func GetByGoodsIdsWithOauth(serviceParam map[string]string, param string) []wph.WphGoods { post, _ := SendPost("com.vip.adp.api.open.service.UnionGoodsService", "getByGoodsIdsWithOauth", serviceParam, param) var goods = make([]wph.OfficialGoods, 0) json.Unmarshal([]byte(gjson.Get(post, "result").String()), &goods) list := make([]wph.WphGoods, 0) for _, v := range goods { tmp := wph.WphGoods{ Gid: v.GoodsId + "adCode" + v.AdCode, AdCode: v.AdCode, GoodsTitle: v.GoodsName, GoodsDesc: v.GoodsDesc, GoodsImg: v.GoodsMainPicture, ImgList: v.GoodsCarouselPictures, SourceType: zhios_third_party_utils.IntToStr(v.SourceType), GoodsPrice: v.VipPrice, GoodsCostPrice: v.MarketPrice, Commission: v.Commission, CommissionRate: v.CommissionRate, Discount: v.Discount, YhqPrice: v.CouponInfo.Fav, CouponPrice: v.CouponInfo.Fav, } if zhios_third_party_utils.StrToFloat64(tmp.YhqPrice) == 0 { tmp.YhqPrice = v.ExclusiveCoupon.Fav tmp.CouponPrice = v.ExclusiveCoupon.Fav } list = append(list, tmp) } return list }