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 } 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 }