|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- 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 {
- gid := v.GoodsId
- if v.AdCode != "" {
- gid = v.GoodsId + "adCode" + v.AdCode
- }
- tmp := wph.WphGoods{
- Gid: gid,
- AdCode: v.AdCode,
- GoodsTitle: v.GoodsName,
- GoodsDesc: v.GoodsDesc,
- GoodsImg: v.GoodsMainPicture,
- ImgList: v.GoodsCarouselPictures,
- DetailImgList: v.GoodsDetailPictures,
- 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 {
- gid := v.GoodsId
- if v.AdCode != "" {
- gid = v.GoodsId + "adCode" + v.AdCode
- }
- tmp := wph.WphGoods{
- Gid: gid,
- AdCode: v.AdCode,
- GoodsTitle: v.GoodsName,
- GoodsDesc: v.GoodsDesc,
- GoodsImg: v.GoodsMainPicture,
- ImgList: v.GoodsCarouselPictures,
- DetailImgList: v.GoodsDetailPictures,
-
- 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 {
- gid := v.GoodsId
- if v.AdCode != "" {
- gid = v.GoodsId + "adCode" + v.AdCode
- }
- tmp := wph.WphGoods{
- Gid: gid,
- AdCode: v.AdCode,
- GoodsTitle: v.GoodsName,
- GoodsDesc: v.GoodsDesc,
- GoodsImg: v.GoodsMainPicture,
- ImgList: v.GoodsCarouselPictures,
- DetailImgList: v.GoodsDetailPictures,
-
- 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
- }
|