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