|
|
@ -7,12 +7,6 @@ import (
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
|
|
SkuStatusNone = 1 // 待处理
|
|
|
|
|
|
|
|
SkuStatusAdopt = 2 // 同步入库
|
|
|
|
|
|
|
|
SkuStatusReject = 3 // 废弃商品
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type goods struct {
|
|
|
|
type goods struct {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
type GoodsSearch struct {
|
|
|
|
type GoodsSearch struct {
|
|
|
@ -133,22 +127,29 @@ func (g *goods) GetImgs(ctx context.Context, goodsId uint) (reply []string, err
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DownShelves @Title 获取商品主图
|
|
|
|
type AdoptItem struct {
|
|
|
|
func (g *goods) DownShelves(ctx context.Context, goodsIds []uint) (err error) {
|
|
|
|
Id uint `json:"id"`
|
|
|
|
|
|
|
|
GoodsNum string `json:"goodsNum"`
|
|
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
|
|
Error string `json:"error"`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Adopt @Title 批量入库
|
|
|
|
|
|
|
|
func (g *goods) Adopt(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
|
|
|
|
xClient, err := client.GetClient(g)
|
|
|
|
xClient, err := client.GetClient(g)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
reply := 0
|
|
|
|
err = xClient.Call(ctx, "Adopt", goodsIds, &reply)
|
|
|
|
return xClient.Call(ctx, "DownShelves", goodsIds, &reply)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// OnShelves @Title 获取商品主图
|
|
|
|
// Discard @Title 批量废弃
|
|
|
|
func (g *goods) OnShelves(ctx context.Context, goodsIds []uint) (err error) {
|
|
|
|
func (g *goods) Discard(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
|
|
|
|
xClient, err := client.GetClient(g)
|
|
|
|
xClient, err := client.GetClient(g)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
reply := 0
|
|
|
|
err = xClient.Call(ctx, "Discard", goodsIds, &reply)
|
|
|
|
return xClient.Call(ctx, "OnShelves", goodsIds, &reply)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|