Ver código fonte

热度

master
huangjiajun 4 meses atrás
pai
commit
544a672400
2 arquivos alterados com 78 adições e 0 exclusões
  1. +44
    -0
      egoer/api.go
  2. +34
    -0
      egoer/md.go

+ 44
- 0
egoer/api.go Ver arquivo

@@ -0,0 +1,44 @@
package egoer

import (
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
"encoding/json"
"fmt"
"github.com/tidwall/gjson"
"strings"
)

func GetGoods(key, secret, version string, param map[string]interface{}) []EgoerGoods {
send, err := PostSend("/openapi/kwaimoney/product/queryProductList", key, secret, version, param)
var data = make([]EgoerGoods, 0)
if err != nil {
return data
}
list := gjson.Get(send, "data.data").String()
json.Unmarshal([]byte(list), &data)
return data
}

//https://x.egoer.cn/userhome/wordPage 快手团长商品
//a8a6bbf6afad4ffa885986c5a7a1d0a7
//redu20242672GtFyuLYMwmUqX3
func PostSend(method, key, secret, version string, param map[string]interface{}) (string, error) {
urls := "https://open.redu.com/service" + method
param["appkey"] = key
param["version"] = version
param["appSecret"] = secret

for k, v := range param {
if strings.Contains(urls, "?") == false {
urls += "?" + k + "=" + zhios_third_party_utils.AnyToString(v)
} else {
urls += "&" + k + "=" + zhios_third_party_utils.AnyToString(v)
}
}
fmt.Println(urls)
fmt.Println(zhios_third_party_utils.SerializeStr(param))
post, err := zhios_third_party_utils.CurlPost(urls, zhios_third_party_utils.SerializeStr(param), nil)
fmt.Println(string(post))
fmt.Println(err)
return string(post), err
}

+ 34
- 0
egoer/md.go Ver arquivo

@@ -0,0 +1,34 @@
package egoer

type EgoerGoods struct {
ProductId int `json:"productId"`
CategoryId interface{} `json:"categoryId"`
CategoryName interface{} `json:"categoryName"`
PlatformProductId string `json:"platformProductId"`
Title string `json:"title"`
Cover string `json:"cover"`
CouponPrice float64 `json:"couponPrice"`
Price float64 `json:"price"`
CosRatio interface{} `json:"cosRatio"`
CosFee interface{} `json:"cosFee"`
ActivityCosRatio int `json:"activityCosRatio"`
ActivityCosFee float64 `json:"activityCosFee"`
ServiceRatio int `json:"serviceRatio"`
Sales string `json:"sales"`
InStock interface{} `json:"inStock"`
FirstCid interface{} `json:"firstCid"`
DouyinFirstCid *int `json:"douyinFirstCid"`
ShopId interface{} `json:"shopId"`
ShopName string `json:"shopName"`
ViewNum interface{} `json:"viewNum"`
KolNum interface{} `json:"kolNum"`
OrderNum int `json:"orderNum"`
PromotionStartTime string `json:"promotionStartTime"`
PromotionEndTime string `json:"promotionEndTime"`
SaleStatus int `json:"saleStatus"`
Sales24 interface{} `json:"sales24"`
Sales7Day interface{} `json:"sales7Day"`
DetailUrl string `json:"detailUrl"`
InterfaceUpdateTime interface{} `json:"interfaceUpdateTime"`
IsReDu bool `json:"isReDu"`
}

Carregando…
Cancelar
Salvar