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.
66 lines
1.3 KiB
66 lines
1.3 KiB
2 years ago
|
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 添加商品
|
||
|
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
|
||
|
}
|
||
|
|
||
|
// Del @Title 删除商品
|
||
|
func (i *item) Del(ctx context.Context, ids []uint) error {
|
||
|
xClient, err := client.GetClient(i)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
reply := 0
|
||
|
return xClient.Call(ctx, "Del", ids, &reply)
|
||
|
}
|
||
|
|
||
|
type ArgsSkuItemLists struct {
|
||
|
SkuTypeId 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
|
||
|
}
|