- 添加了部分到家订单级促销
This commit is contained in:
72
platformapi/jdapi/promotion_sku_test.go
Normal file
72
platformapi/jdapi/promotion_sku_test.go
Normal file
@@ -0,0 +1,72 @@
|
||||
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.CreatePromotionRules(infoId, "", 1, 1, 1, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
skuInfos, err := api.CreatePromotionSkuSingle(infoId, "", []map[string]interface{}{
|
||||
{
|
||||
KeyOutSkuId: "2216",
|
||||
KeyStationNo: 11682042,
|
||||
KeyPromotionPrice: 500,
|
||||
KeyLimitSkuCount: 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.CreatePromotionRules(infoId, "", 1, 1, 5, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
skuInfos, err := api.CreatePromotionSkuLimitTime(infoId, "", []map[string]interface{}{
|
||||
{
|
||||
KeyOutSkuId: "2216",
|
||||
KeyStationNo: 11682042,
|
||||
KeyPromotionPrice: 300,
|
||||
KeyLimitSkuCount: 2,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(skuInfos)
|
||||
err = api.ConfirmPromotionLimitTime(infoId, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueryPromotionInfo(t *testing.T) {
|
||||
result, err := api.QueryPromotionInfo(14885272)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(result.SkuResultList) == 0 {
|
||||
t.Fatal("should have SkuResultList")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user