Browse Source

唯品会

master
huangjiajun 5 months ago
parent
commit
bb22b36bf4
1 changed files with 17 additions and 5 deletions
  1. +17
    -5
      wph/goods.go

+ 17
- 5
wph/goods.go View File

@@ -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,


Loading…
Cancel
Save