- part of jd promotion apis
This commit is contained in:
62
platformapi/jdapi/promotion_test.go
Normal file
62
platformapi/jdapi/promotion_test.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package jdapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestCreatePromotionSingle(t *testing.T) {
|
||||
infoId, err := jdapi.CreatePromotionInfosSingle("测试1", time.Now(), time.Now().Add(24*time.Hour), "", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(infoId)
|
||||
err = jdapi.CreatePromotionRules(infoId, "", 1, 1, 1, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
skuInfos, err := jdapi.CreatePromotionSkuSingle(infoId, "", []map[string]interface{}{
|
||||
{
|
||||
KeyOutSkuId: "2216",
|
||||
KeyStationNo: 11682042,
|
||||
KeyPromotionPrice: 500,
|
||||
KeyLimitSkuCount: 2,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(skuInfos)
|
||||
err = jdapi.ConfirmPromotionSingle(infoId, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreatePromotionLimitTime(t *testing.T) {
|
||||
infoId, err := jdapi.CreatePromotionInfosLimitTime("测试1", time.Now(), time.Now().Add(24*time.Hour), "", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(infoId)
|
||||
err = jdapi.CreatePromotionRules(infoId, "", 1, 1, 5, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
skuInfos, err := jdapi.CreatePromotionSkuLimitTime(infoId, "", []map[string]interface{}{
|
||||
{
|
||||
KeyOutSkuId: "2216",
|
||||
KeyStationNo: 11682042,
|
||||
KeyPromotionPrice: 300,
|
||||
KeyLimitSkuCount: 2,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(skuInfos)
|
||||
err = jdapi.ConfirmPromotionLimitTime(infoId, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user