feat 支持cn coach
This commit is contained in:
parent
63f1bd6930
commit
a7d6c7c666
@ -12,11 +12,19 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type XMacHeader string
|
||||
|
||||
const (
|
||||
XMac_Coach XMacHeader = "e6d4b3d780db4251bc4b6b54f41ee7b0"
|
||||
XMac_Outlet XMacHeader = "b55d4769f3e768630046291ee2ee26f0"
|
||||
)
|
||||
|
||||
type CN struct {
|
||||
c *client.Client
|
||||
xmac XMacHeader
|
||||
}
|
||||
|
||||
func CNClient() (cli *CN, err error) {
|
||||
func CNClient(xmac XMacHeader) (cli *CN, err error) {
|
||||
cli = new(CN)
|
||||
clientCfg := &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
@ -25,6 +33,7 @@ func CNClient() (cli *CN, err error) {
|
||||
client.WithTLSConfig(clientCfg),
|
||||
client.WithDialer(standard.NewDialer()),
|
||||
)
|
||||
cli.xmac = xmac
|
||||
return
|
||||
}
|
||||
|
||||
@ -79,7 +88,7 @@ func (c *CN) ListItems(_ctx context.Context, page, size int) (ItemListData, erro
|
||||
size = max(size, 50)
|
||||
req.SetRequestURI("https://ec-api.coach.com.cn/api/v2/item/search")
|
||||
req.SetMethod("GET")
|
||||
req.SetHeader("X-Ma-C", " b55d4769f3e768630046291ee2ee26f0")
|
||||
req.SetHeader("X-Ma-C", string(c.xmac))
|
||||
req.SetHeader("User-Agent", uarand.GetRandom())
|
||||
req.SetQueryString(fmt.Sprintf("scope=shop&pageNo=%d&pageSize=%d", page, size))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user