dw-sdk/params_test.go

55 lines
1.2 KiB
Go
Raw Normal View History

package dw_sdk
import (
"testing"
)
// 用于测试的请求
type TestRequest struct {
AppointNo string `json:"appoint_no" url:"appoint_no"`
SkuList ListParams[TestSku] `json:"sku_list" url:"sku_list"`
PublicParams
}
type TestSku struct {
SpuId int `json:"spu_id"`
SkuId int `json:"sku_id"`
BarCode string `json:"bar_code"`
ArticleNumber string `json:"article_number"`
AppointNum int `json:"appoint_num"`
BrandId int `json:"brand_id"`
CategoryId int `json:"category_id"`
}
func TestParams(t *testing.T) {
var p = TestRequest{
PublicParams: PublicParams{
AppKey: "4d1715e032c44b709ef4954ef13e0950",
Timestamp: 1603353500369,
},
AppointNo: "A14343543654",
SkuList: ListParams[TestSku]{
{
SpuId: 81293,
SkuId: 487752589,
BarCode: "487752589",
ArticleNumber: "wucaishi",
AppointNum: 10,
BrandId: 10444,
CategoryId: 46,
},
{
SpuId: 81293,
SkuId: 487752589,
BarCode: "487752589",
ArticleNumber: "wucaishi",
AppointNum: 10,
BrandId: 10444,
CategoryId: 46,
},
},
}
Sign(&p, "")
}