新增银豹api和test
This commit is contained in:
@@ -17,7 +17,7 @@ func init() {
|
||||
logger, _ := zap.NewDevelopment()
|
||||
sugarLogger = logger.Sugar()
|
||||
baseapi.Init(sugarLogger)
|
||||
api = New("682628966212343269", "18C0E0867E467DBC26EFF5E957B02EC4")
|
||||
api = New("682628966212343269", "18C0E0867E467DBC26EFF5E957B02EC4") //总店
|
||||
}
|
||||
|
||||
func TestAddProductInfo(t *testing.T) {
|
||||
@@ -26,11 +26,12 @@ func TestAddProductInfo(t *testing.T) {
|
||||
)
|
||||
result, err := api.AddProductInfo(&ProductInfoParam{
|
||||
ProductInfo: &ProductInfo{
|
||||
Name: "测试商品",
|
||||
Barcode: "12135",
|
||||
BuyPrice: &stock,
|
||||
SellPrice: &stock,
|
||||
Stock: &stock,
|
||||
Name: "测试商品",
|
||||
Barcode: "12132",
|
||||
BuyPrice: &stock,
|
||||
SellPrice: &stock,
|
||||
Stock: &stock,
|
||||
SupplierUID: 123,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -53,3 +54,41 @@ func TestUpdateProductInfo(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueryProductByBarcode(t *testing.T) {
|
||||
result, err := api.QueryProductByBarcode("22510")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestQueryProductByBarcodes(t *testing.T) {
|
||||
result, err := api.QueryProductByBarcodes([]string{
|
||||
"22510",
|
||||
"2003181534102",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestQueryProductImagesByBarcode(t *testing.T) {
|
||||
result, err := api.QueryProductImagesByBarcode("22510")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestQueryProductPages(t *testing.T) {
|
||||
result, err := api.QueryProductPages(&PostBackParameter{
|
||||
ParameterType: "LAST_RESULT_MAX_ID",
|
||||
ParameterValue: "7064573",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user