Compare commits
2 Commits
566d95bc0f
...
18ceb8a077
Author | SHA1 | Date | |
---|---|---|---|
18ceb8a077 | |||
4ac9614af6 |
@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCNClient(t *testing.T) {
|
||||
cli, err := CNClient()
|
||||
cli, err := CNClient(XMac_Coach)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -99,18 +99,26 @@ func (c *US) RequestInventory(ctx context.Context, pid string) (inv Inventory, e
|
||||
}
|
||||
|
||||
type ProductData struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Brand string `json:"brand"`
|
||||
Inventory Inventory `json:"inventory"`
|
||||
Url string `json:"url"`
|
||||
MasterId string `json:"masterId"`
|
||||
Prices struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Brand string `json:"brand"`
|
||||
Inventory Inventory `json:"inventory"`
|
||||
Url string `json:"url"`
|
||||
MasterId string `json:"masterId"`
|
||||
ImageGroups []ImageGroup `json:"imageGroups"`
|
||||
Prices struct {
|
||||
CurrentPrice float64 `json:"currentPrice"`
|
||||
} `json:"prices"`
|
||||
Remark string `json:"-"`
|
||||
}
|
||||
|
||||
type ImageGroup struct {
|
||||
Images []struct {
|
||||
Src string `json:"src"`
|
||||
Title string `json:"title"`
|
||||
Alt string `json:"alt"`
|
||||
} `json:"images"`
|
||||
ViewType string `json:"viewType"`
|
||||
}
|
||||
type ProductDataResponse struct {
|
||||
ProductData []*ProductData `json:"productsData"`
|
||||
}
|
||||
@ -140,6 +148,7 @@ type PageDataResponse struct {
|
||||
Products []Product `json:"products"`
|
||||
} `json:"pageData"`
|
||||
}
|
||||
|
||||
type Product struct {
|
||||
Name string `json:"name"`
|
||||
Colors []Color `json:"colors"`
|
||||
|
@ -2,15 +2,16 @@ package coach_client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.timerzz.com/kedaya_haitao/common/pkg/proxy"
|
||||
"testing"
|
||||
|
||||
"gitea.timerzz.com/kedaya_haitao/common/pkg/proxy"
|
||||
)
|
||||
|
||||
func TestClient(t *testing.T) {
|
||||
subs := []string{"https://us.timerzz.com:26106/vmess/sub", "https://us.timerzz.com:26106/trojan/sub", "https://us.timerzz.com:26106/ssr/sub"}
|
||||
subs := []string{"https://us.timerzz.com:26106/vmess/sub"}
|
||||
pool := proxy.NewProxyPool(subs)
|
||||
client := USClient(pool)
|
||||
resp, err := client.ViewAllBags(context.Background(), 1)
|
||||
resp, err := client.RequestProductDetail(context.Background(), "CU808-CHK")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -2,12 +2,13 @@ package restry_pool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/corpix/uarand"
|
||||
"github.com/go-resty/resty/v2"
|
||||
"net"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/corpix/uarand"
|
||||
"github.com/go-resty/resty/v2"
|
||||
)
|
||||
|
||||
var rp *restyPool
|
||||
@ -35,6 +36,15 @@ const (
|
||||
|
||||
func beforeRequest(cli *resty.Client, req *resty.Request) error {
|
||||
cli.SetHeader("User-Agent", uarand.GetRandom())
|
||||
cli.SetHeader("sec-fetch-site", "same-origin")
|
||||
cli.SetHeader("upgrade-insecure-requests", "1")
|
||||
cli.SetHeaders(map[string]string{
|
||||
"sec-fetch-dest": "empty",
|
||||
"sec-fetch-mode": "navigate",
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Connection": "keep-alive",
|
||||
})
|
||||
return nil
|
||||
}
|
||||
func NewRestyPool() *restyPool {
|
||||
|
Loading…
Reference in New Issue
Block a user