feat 添加获取预售商品接口
This commit is contained in:
parent
b04e8891dc
commit
47902c467f
@ -47,9 +47,9 @@ func NewConsignBidClient(cfg Config) BidClient {
|
|||||||
// 获取平台sku最低价【闪电直发】
|
// 获取平台sku最低价【闪电直发】
|
||||||
const FastLowestPriceUrl = "/dop/api/v1/consign/bidding/lowest_price"
|
const FastLowestPriceUrl = "/dop/api/v1/consign/bidding/lowest_price"
|
||||||
|
|
||||||
type ConsignLowestPriceReq struct {
|
type LowestPriceReq struct {
|
||||||
PublicParams
|
PublicParams `param:",inline"`
|
||||||
SkuId int `json:"sku_id" url:"sku_id"`
|
SkuId int `json:"sku_id" url:"sku_id" param:"sku_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LowestPriceResponse struct {
|
type LowestPriceResponse struct {
|
||||||
@ -66,7 +66,7 @@ func (a *ConsignBidClientImpl) LowestPrice(skuId int) (*PublicResponse[LowestPri
|
|||||||
if skuId == 0 {
|
if skuId == 0 {
|
||||||
return nil, Err_Params_None
|
return nil, Err_Params_None
|
||||||
}
|
}
|
||||||
data := ConsignLowestPriceReq{
|
data := LowestPriceReq{
|
||||||
PublicParams: PublicParams{
|
PublicParams: PublicParams{
|
||||||
AppKey: a.cfg.Key,
|
AppKey: a.cfg.Key,
|
||||||
Timestamp: time.Now().UnixMilli(),
|
Timestamp: time.Now().UnixMilli(),
|
||||||
|
@ -12,7 +12,7 @@ var testConfig = Config{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewBidConsignClient(t *testing.T) {
|
func TestNewBidConsignClient(t *testing.T) {
|
||||||
cli := NewConsignBidClient(testConfig)
|
cli := NewPreSaleBidClient(testConfig)
|
||||||
resp, err := cli.LowestPrice(626512954)
|
resp, err := cli.LowestPrice(626512954)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
4
bid.go
4
bid.go
@ -3,5 +3,7 @@ package dw_sdk
|
|||||||
type BiddingType int8
|
type BiddingType int8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
BiddingType_Consign BiddingType = 5 //闪电直发
|
BiddingType_PreSale BiddingType = 1 //预售
|
||||||
|
BiddingType_Consign BiddingType = 5 //闪电直发
|
||||||
|
BiddingType_Fast_PreSale BiddingType = 8 //急速预售
|
||||||
)
|
)
|
||||||
|
@ -3,12 +3,14 @@ package dw_sdk
|
|||||||
type Client struct {
|
type Client struct {
|
||||||
articleServiceClient ArticleServiceClient
|
articleServiceClient ArticleServiceClient
|
||||||
consignBidClient BidClient
|
consignBidClient BidClient
|
||||||
|
preSaleBidClient BidClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(cfg Config) *Client {
|
func NewClient(cfg Config) *Client {
|
||||||
return &Client{
|
return &Client{
|
||||||
articleServiceClient: NewArticleServiceClient(cfg),
|
articleServiceClient: NewArticleServiceClient(cfg),
|
||||||
consignBidClient: NewConsignBidClient(cfg),
|
consignBidClient: NewConsignBidClient(cfg),
|
||||||
|
preSaleBidClient: NewPreSaleBidClient(cfg),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,15 +3,16 @@ package dw_sdk
|
|||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/bytedance/sonic"
|
|
||||||
"github.com/google/go-querystring/query"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/bytedance/sonic"
|
||||||
|
"github.com/google/go-querystring/query"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PublicParams struct {
|
type PublicParams struct {
|
||||||
AppKey string `json:"app_key" url:"app_key"`
|
AppKey string `json:"app_key" url:"app_key"`
|
||||||
Sign string `json:"sign" url:"-"`
|
Sign string `json:"sign" url:"sign,omitempty"`
|
||||||
AccessToken string `json:"access_token,omitempty" url:"access_token,omitempty"`
|
AccessToken string `json:"access_token,omitempty" url:"access_token,omitempty"`
|
||||||
Timestamp int64 `json:"timestamp" url:"timestamp"`
|
Timestamp int64 `json:"timestamp" url:"timestamp"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user