163 lines
3.3 KiB
Go
163 lines
3.3 KiB
Go
package jdapi
|
|
|
|
import (
|
|
"fmt"
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
mustExistSkuID = 2023747677
|
|
mustExistSkuJXID = "5246"
|
|
)
|
|
|
|
func TestGetStationInfoList(t *testing.T) {
|
|
result, err := api.GetStationInfoList("11910721", []int64{2023432263})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestDelVipPrice(t *testing.T) {
|
|
err := api.DelVipPrice("667281", []*SkuIdEntity{
|
|
&SkuIdEntity{
|
|
OutSkuId: "31196",
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Fatal(err)
|
|
//t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
//func TestQueryOpenUseable(t *testing.T) {
|
|
// result, err := api.QueryOpenUseable([]*BaseStockCenterRequest{
|
|
// &BaseStockCenterRequest{
|
|
// StationNo: mustExistStoreID,
|
|
// SkuId: mustExistSkuID,
|
|
// },
|
|
// })
|
|
// if err != nil {
|
|
// t.Fatal(err)
|
|
// }
|
|
// t.Log(utils.Format4Output(result, false))
|
|
//}
|
|
|
|
//func TestQueryStockCenter(t *testing.T) {
|
|
// result, err := api.QueryStockCenter(mustExistStoreJXID, []*SkuIdEntity{
|
|
// &SkuIdEntity{
|
|
// OutSkuId: mustExistSkuJXID,
|
|
// },
|
|
// }, "test")
|
|
// if err != nil {
|
|
// t.Fatal(err)
|
|
// }
|
|
// t.Log(utils.Format4Output(result, false))
|
|
//}
|
|
|
|
func TestBatchUpdateVendibility(t *testing.T) {
|
|
data := []int64{1}
|
|
for _, v := range data {
|
|
_, err := api.BatchUpdateVendibility("liulei", "", "14986394", []*StockVendibility{
|
|
&StockVendibility{
|
|
OutSkuId: utils.Int64ToStr(v),
|
|
DoSale: false,
|
|
},
|
|
}, "test")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
func TestUpdateVendibility(t *testing.T) {
|
|
result, err := api.UpdateVendibility("", []*QueryStockRequest{
|
|
&QueryStockRequest{
|
|
StationNo: "11053496",
|
|
SkuId: 2012224772,
|
|
DoSale: 1,
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
//baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestUpdateVendorStationPrice(t *testing.T) {
|
|
result, err := api.UpdateVendorStationPrice("", "2", "", []*SkuPriceInfo{
|
|
&SkuPriceInfo{
|
|
OutSkuId: "02",
|
|
Price: 200,
|
|
},
|
|
&SkuPriceInfo{
|
|
OutSkuId: "01",
|
|
Price: 200,
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
//baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestBatchUpdateCurrentQtys(t *testing.T) {
|
|
result, err := api.BatchUpdateCurrentQtys("", "2", "", []*SkuStock{
|
|
&SkuStock{
|
|
OutSkuId: "01",
|
|
StockQty: 111,
|
|
},
|
|
&SkuStock{
|
|
OutSkuId: "2212",
|
|
StockQty: 111,
|
|
},
|
|
}, "")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
//baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
|
}
|
|
|
|
var data = []int64{}
|
|
|
|
func TestUnBindStoreGoods(t *testing.T) {
|
|
for _, v := range data {
|
|
api.UnBindStoreGoods(v)
|
|
fmt.Println(v)
|
|
time.Sleep(200 * time.Microsecond)
|
|
}
|
|
}
|
|
|
|
var data2 = []int64{}
|
|
|
|
func TestUpdateSku2(t *testing.T) {
|
|
i2 := len(data2) % 50
|
|
if i2 != 0 {
|
|
i2 = len(data2)/50 + 1
|
|
} else {
|
|
i2 = len(data2) / 50
|
|
}
|
|
|
|
for i := 0; i < i2; i++ {
|
|
|
|
bility := make([]*StockVendibility, 0, 50)
|
|
for _, v := range data2 {
|
|
bility = append(bility, &StockVendibility{OutSkuId: utils.Int64ToStr(v), DoSale: false})
|
|
fmt.Println(v)
|
|
}
|
|
|
|
_, err := api.BatchUpdateVendibility("liulei", "", "23988364", bility, "test")
|
|
if err != nil {
|
|
fmt.Println(err.Error())
|
|
}
|
|
time.Sleep(200 * time.Microsecond)
|
|
}
|
|
}
|