银豹api新增修改商品

This commit is contained in:
苏尹岚
2020-03-18 18:02:44 +08:00
parent bd834157b1
commit 4e5ca49985
2 changed files with 107 additions and 41 deletions

View File

@@ -4,6 +4,7 @@ import (
"testing"
"git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/utils"
"go.uber.org/zap"
)
@@ -20,18 +21,35 @@ func init() {
}
func TestAddProductInfo(t *testing.T) {
api.AddProductInfo(&AddProductInfoParam{
var (
stock = 5.1
)
result, err := api.AddProductInfo(&ProductInfoParam{
ProductInfo: &ProductInfo{
Name: "测试商品",
Barcode: "12138",
BuyPrice: 5,
SellPrice: 5,
Stock: 99,
Barcode: "12135",
BuyPrice: &stock,
SellPrice: &stock,
Stock: &stock,
},
})
// result, err :=
// if err != nil {
// t.Fatal(err)
// }
// t.Log(utils.Format4Output(result, false))
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestUpdateProductInfo(t *testing.T) {
var (
sellPrice = float64(50)
)
err := api.UpdateProductInfo(&ProductInfoParam{
ProductInfo: &ProductInfo{
UID: 285305464077105187,
Stock: &sellPrice,
},
})
if err != nil {
t.Fatal(err)
}
}