Selaa lähdekoodia

热度

master
huangjiajun 2 kuukautta sitten
vanhempi
commit
544a672400
2 muutettua tiedostoa jossa 78 lisäystä ja 0 poistoa
  1. +44
    -0
      egoer/api.go
  2. +34
    -0
      egoer/md.go

+ 44
- 0
egoer/api.go Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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"`
}

Ladataan…
Peruuta
Tallenna