- 重构新京西活动,平台接口定为笼统的SyncAct,京平台支持添加,删除商品,暂不支持修改

This commit is contained in:
gazebo
2019-06-23 21:06:41 +08:00
parent ec891581ce
commit 594aa3e6b7
14 changed files with 565 additions and 534 deletions

View File

@@ -21,15 +21,15 @@ func init() {
func TestInitDb(t *testing.T) {
dao.ExecuteSQL(dao.GetDB(), `
DROP TABLE IF EXISTS act,act_map, act_order_rule, act_store_map, act_store_sku, act_store_sku_map;
DROP TABLE IF EXISTS act, act_map, act_order_rule, act_store_sku, act_store_sku_map;
`)
}
func TestCreateAct(t *testing.T) {
actID, err := CreateAct(jxcontext.AdminCtx, &model.Act{
Name: "测试活动2",
Name: "测试活动",
PricePercentage: 80,
}, []int{0, 1, 3}, nil, []*ActStoreSkuParam{
}, []int{0}, nil, []*ActStoreSkuParam{
&ActStoreSkuParam{
ActStoreSku: model.ActStoreSku{
StoreID: 100119,
@@ -68,6 +68,70 @@ func TestCancelAct(t *testing.T) {
}
}
func TestDeleteActStoreBind(t *testing.T) {
err := DeleteActStoreBind(jxcontext.AdminCtx, 1, []*ActStoreSkuParam{
// &ActStoreSkuParam{
// ActStoreSku: model.ActStoreSku{
// StoreID: 100119,
// SkuID: 30828,
// },
// },
// &ActStoreSkuParam{
// ActStoreSku: model.ActStoreSku{
// StoreID: 100119,
// SkuID: 30827,
// },
// },
&ActStoreSkuParam{
ActStoreSku: model.ActStoreSku{
StoreID: 100118,
SkuID: 30592,
},
},
&ActStoreSkuParam{
ActStoreSku: model.ActStoreSku{
StoreID: 100118,
SkuID: 30565,
},
},
})
if err != nil {
t.Fatal(err)
}
}
func TestAddActStoreBind(t *testing.T) {
err := AddActStoreBind(jxcontext.AdminCtx, 1, []*ActStoreSkuParam{
// &ActStoreSkuParam{
// ActStoreSku: model.ActStoreSku{
// StoreID: 100119,
// SkuID: 30828,
// },
// },
// &ActStoreSkuParam{
// ActStoreSku: model.ActStoreSku{
// StoreID: 100119,
// SkuID: 30827,
// },
// },
&ActStoreSkuParam{
ActStoreSku: model.ActStoreSku{
StoreID: 100118,
SkuID: 30592,
},
},
&ActStoreSkuParam{
ActStoreSku: model.ActStoreSku{
StoreID: 100118,
SkuID: 30565,
},
},
})
if err != nil {
t.Fatal(err)
}
}
func TestSyncAct(t *testing.T) {
err := SyncAct(jxcontext.AdminCtx, 1, nil, nil, nil)
if err != nil {