|
|
|
@ -1,5 +1,11 @@
|
|
|
|
|
package sku
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"git.oa00.com/supply-chain/service/client"
|
|
|
|
|
"git.oa00.com/supply-chain/service/lib/bean"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type sale struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -8,6 +14,26 @@ type SaleHandleItem struct {
|
|
|
|
|
Error string `json:"error"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add @Title 添加
|
|
|
|
|
func (s *sale) Add(ctx context.Context, skuIds []uint) (reply []SaleSkuItem, err error) {
|
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
err = xClient.Call(ctx, "Add", skuIds, &reply)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Lists @Title 商品列表
|
|
|
|
|
func (s *sale) Lists(ctx context.Context, page bean.Page) (reply ReplySaleSkuItemLists, err error) {
|
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return ReplySaleSkuItemLists{}, err
|
|
|
|
|
}
|
|
|
|
|
err = xClient.Call(ctx, "Lists", page, &reply)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ReplySaleSkuItemLists struct {
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
Lists []SaleSkuItem `json:"lists"`
|
|
|
|
@ -17,3 +43,34 @@ type SaleSkuItem struct {
|
|
|
|
|
Id uint `json:"id"`
|
|
|
|
|
SkuId uint `json:"skuId"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Del @Title 删除商品
|
|
|
|
|
func (s *sale) Del(ctx context.Context, ids []uint) error {
|
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
reply := 0
|
|
|
|
|
return xClient.Call(ctx, "Del", ids, &reply)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetImg @Title 设置区域导图
|
|
|
|
|
func (s *sale) SetImg(ctx context.Context, path string) error {
|
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
reply := 0
|
|
|
|
|
return xClient.Call(ctx, "SetImg", path, &reply)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetImg @Title 获取区域导图
|
|
|
|
|
func (s *sale) GetImg(ctx context.Context) (reply string, err error) {
|
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", err
|
|
|
|
|
}
|
|
|
|
|
args := 0
|
|
|
|
|
err = xClient.Call(ctx, "GetImg", args, &reply)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|