- part of jd promotion apis

This commit is contained in:
gazebo
2018-10-10 16:47:41 +08:00
parent eec461bd4e
commit 10b80441d9
4 changed files with 222 additions and 3 deletions

View 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)
}
}