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.
service/customer/sku/item.go

82 lines
1.6 KiB

package sku
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
)
type item struct {
}
type ReplySkuItemHandle struct {
SkuId uint `json:"skuId"`
Error string `json:"error"`
}
type ArgsSkuItemAdd struct {
SkuTypeId uint
SkuIds []uint
}
// Add @Title 添加商品
2 years ago
func (i *item) Add(ctx context.Context, args ArgsSkuItemAdd) (reply []ReplySkuItemHandle, err error) {
xClient, err := client.GetClient(i)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "Add", args, &reply)
return
}
2 years ago
type ArgsSkuItemDel struct {
SkuTypeId uint
SkuIds []uint
}
// Del @Title 删除商品
2 years ago
func (i *item) Del(ctx context.Context, args ArgsSkuItemDel) error {
xClient, err := client.GetClient(i)
if err != nil {
return err
}
reply := 0
2 years ago
return xClient.Call(ctx, "Del", args, &reply)
}
type ArgsSkuItemLists struct {
SkuTypeId uint
2 years ago
SkuId uint
Page bean.Page
}
type ReplySkuItemLists struct {
Total int64 `json:"total"`
Lists []SkuItem `json:"lists"`
}
type SkuItem struct {
Id uint `json:"id"`
SkuId uint `json:"skuId"`
}
// Lists @Title 商品列表
func (i *item) Lists(ctx context.Context, args ArgsSkuItemLists) (reply ReplySkuItemLists, err error) {
xClient, err := client.GetClient(i)
if err != nil {
return ReplySkuItemLists{}, err
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
2 years ago
// DelAll @Title 删除全部商品
func (i *item) DelAll(ctx context.Context, skuTypeId uint) error {
xClient, err := client.GetClient(i)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "DelAll", skuTypeId, &reply)
}