63 lines
1.3 KiB
Go
63 lines
1.3 KiB
Go
package jdapi
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestCreatePromotionSingle(t *testing.T) {
|
|
infoId, err := api.CreatePromotionInfosSingle("测试1", time.Now(), time.Now().Add(24*time.Hour), "", "")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(infoId)
|
|
err = api.CreatePromotionRulesSingle(infoId, "", 1, 1, 1, 1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
skuInfos, err := api.CreatePromotionSkuSingle(infoId, "", []*PromotionSku{
|
|
&PromotionSku{
|
|
OutSkuID: "2216",
|
|
StationNo: 11682042,
|
|
PromotionPrice: 500,
|
|
LimitSkuCount: 2,
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(skuInfos)
|
|
err = api.ConfirmPromotionSingle(infoId, "")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestCreatePromotionLimitTime(t *testing.T) {
|
|
infoId, err := api.CreatePromotionInfosLimitTime("测试1", time.Now(), time.Now().Add(24*time.Hour), "", "")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(infoId)
|
|
err = api.CreatePromotionRulesLimitTime(infoId, "", 1, 1, 5, 1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
skuInfos, err := api.CreatePromotionSkuLimitTime(infoId, "", []*PromotionSku{
|
|
&PromotionSku{
|
|
OutSkuID: "2216",
|
|
StationNo: 11682042,
|
|
PromotionPrice: 300,
|
|
LimitSkuCount: 2,
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(skuInfos)
|
|
err = api.ConfirmPromotionLimitTime(infoId, "")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|