From bb22b36bf494db86a774f39963116ee3f7b8ca81 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 25 Jul 2024 14:54:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=94=AF=E5=93=81=E4=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wph/goods.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/wph/goods.go b/wph/goods.go index 8dd2760..d624c14 100644 --- a/wph/goods.go +++ b/wph/goods.go @@ -7,15 +7,19 @@ import ( "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: v.GoodsId + "adCode" + v.AdCode, + Gid: gid, AdCode: v.AdCode, GoodsTitle: v.GoodsName, GoodsDesc: v.GoodsDesc, @@ -39,15 +43,19 @@ func QueryWithOauth(serviceParam map[string]string, param string) []wph.WphGoods 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: v.GoodsId + "adCode" + v.AdCode, + Gid: gid, AdCode: v.AdCode, GoodsTitle: v.GoodsName, GoodsDesc: v.GoodsDesc, @@ -77,8 +85,12 @@ func GetByGoodsIdsWithOauth(serviceParam map[string]string, param string) []wph. 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: v.GoodsId + "adCode" + v.AdCode, + Gid: gid, AdCode: v.AdCode, GoodsTitle: v.GoodsName, GoodsDesc: v.GoodsDesc,