You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
1.9 KiB
93 lines
1.9 KiB
package sku
|
|
|
|
import (
|
|
"context"
|
|
"git.oa00.com/supply-chain/service/client"
|
|
"git.oa00.com/supply-chain/service/lib/bean"
|
|
)
|
|
|
|
type sale struct {
|
|
}
|
|
|
|
type SaleHandleItem struct {
|
|
SkuId uint `json:"skuId"`
|
|
Error string `json:"error"`
|
|
}
|
|
|
|
// Add @Title 添加
|
|
func (s *sale) Add(ctx context.Context, skuIds []uint) (reply []SaleHandleItem, err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
err = xClient.Call(ctx, "Add", skuIds, &reply)
|
|
return
|
|
}
|
|
|
|
type ArgsSaleLists struct {
|
|
SkuId uint
|
|
Page bean.Page
|
|
}
|
|
|
|
// Lists @Title 商品列表
|
|
func (s *sale) Lists(ctx context.Context, args ArgsSaleLists) (reply ReplySaleSkuItemLists, err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return ReplySaleSkuItemLists{}, err
|
|
}
|
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
|
return
|
|
}
|
|
|
|
type ReplySaleSkuItemLists struct {
|
|
Total int64 `json:"total"`
|
|
Lists []SaleSkuItem `json:"lists"`
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// DelAll @Title 删除全部商品
|
|
func (s *sale) DelAll(ctx context.Context) error {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
args := 0
|
|
reply := 0
|
|
return xClient.Call(ctx, "DelAll", args, &reply)
|
|
}
|