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/batchSku/hotItem.go

97 lines
2.0 KiB

package batchSku
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
)
type hotItem struct {
}
type ReplySkuHotItemHandle struct {
SkuId uint `json:"skuId"`
Error string `json:"error"`
}
type ArgsSkuHotItemAdd struct {
SkuTypeId uint
SkuIds []uint
}
// Add @Title 添加商品
func (i *hotItem) Add(ctx context.Context, args ArgsSkuHotItemAdd) (reply []ReplySkuHotItemHandle, err error) {
xClient, err := client.GetClient(i)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "Add", args, &reply)
return
}
type ArgsSkuHotItemDel struct {
SkuTypeId uint
SkuIds []uint
}
// Del @Title 删除商品
func (i *hotItem) Del(ctx context.Context, args ArgsSkuHotItemDel) error {
xClient, err := client.GetClient(i)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "Del", args, &reply)
}
type ArgsSkuHotItemLists struct {
SkuTypeId uint
SkuId uint
Page bean.Page
}
type ReplySkuHotItemLists struct {
Total int64 `json:"total"`
Lists []SkuHotItem `json:"lists"`
}
type SkuHotItem struct {
Id uint `json:"id"`
SkuId uint `json:"skuId"`
}
// Lists @Title 商品列表
func (i *hotItem) Lists(ctx context.Context, args ArgsSkuHotItemLists) (reply ReplySkuHotItemLists, err error) {
xClient, err := client.GetClient(i)
if err != nil {
return ReplySkuHotItemLists{}, err
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
// DelAll @Title 删除全部商品
func (i *hotItem) 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)
}
type ArgsBySkuHotIds struct {
SkuIds []uint
SkuTypeId uint
}
// FindBySkuIds @Title 根据SkuId查询数据
func (i *hotItem) FindBySkuIds(ctx context.Context, args ArgsBySkuHotIds) (reply []SkuHotItem, err error) {
xClient, err := client.GetClient(i)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "FindBySkuIds", args, &reply)
return
}