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.
97 lines
2.0 KiB
97 lines
2.0 KiB
2 years ago
|
package batchSku
|
||
|
|
||
|
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 添加商品
|
||
|
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
|
||
|
}
|
||
|
|
||
|
type ArgsSkuItemDel struct {
|
||
|
SkuTypeId uint
|
||
|
SkuIds []uint
|
||
|
}
|
||
|
|
||
|
// Del @Title 删除商品
|
||
|
func (i *item) Del(ctx context.Context, args ArgsSkuItemDel) error {
|
||
|
xClient, err := client.GetClient(i)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
reply := 0
|
||
|
return xClient.Call(ctx, "Del", args, &reply)
|
||
|
}
|
||
|
|
||
|
type ArgsSkuItemLists struct {
|
||
|
SkuTypeId uint
|
||
|
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
|
||
|
}
|
||
|
|
||
|
// 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)
|
||
|
}
|
||
|
|
||
|
type ArgsBySkuIds struct {
|
||
|
SkuIds []uint
|
||
|
SkuTypeId uint
|
||
|
}
|
||
|
|
||
|
// FindBySkuIds @Title 根据SkuId查询数据
|
||
|
func (i *item) FindBySkuIds(ctx context.Context, args ArgsBySkuIds) (reply []SkuItem, err error) {
|
||
|
xClient, err := client.GetClient(i)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = xClient.Call(ctx, "FindBySkuIds", args, &reply)
|
||
|
return
|
||
|
}
|