From d05ca78fd59fc3920420004c361ceb3e65a2eda3 Mon Sep 17 00:00:00 2001 From: sian Date: Thu, 6 Apr 2023 11:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=BB=E9=A2=98=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/batchSku/batchSku.go | 10 ++-- customer/batchSku/hotItem.go | 96 +++++++++++++++++++++++++++++++++++ customer/batchSku/hotType.go | 60 ++++++++++++++++++++++ 3 files changed, 162 insertions(+), 4 deletions(-) create mode 100644 customer/batchSku/hotItem.go create mode 100644 customer/batchSku/hotType.go diff --git a/customer/batchSku/batchSku.go b/customer/batchSku/batchSku.go index d4eea51..c90075b 100644 --- a/customer/batchSku/batchSku.go +++ b/customer/batchSku/batchSku.go @@ -1,8 +1,10 @@ package batchSku type BatchSku struct { - Banner banner - Type skuType - Sale sale - Item item + Banner banner + Type skuType + Sale sale + Item item + HotType skuHotType + HotItem hotItem } diff --git a/customer/batchSku/hotItem.go b/customer/batchSku/hotItem.go new file mode 100644 index 0000000..bb5a484 --- /dev/null +++ b/customer/batchSku/hotItem.go @@ -0,0 +1,96 @@ +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 +} diff --git a/customer/batchSku/hotType.go b/customer/batchSku/hotType.go new file mode 100644 index 0000000..17875e2 --- /dev/null +++ b/customer/batchSku/hotType.go @@ -0,0 +1,60 @@ +package batchSku + +import ( + "context" + "git.oa00.com/supply-chain/service/client" +) + +type skuHotType struct { +} + +type ArgsSkuHotTypeEdit struct { + Id uint + Name string +} + +// Edit @Title 编辑分类 +func (s *skuHotType) Edit(ctx context.Context, args ArgsSkuHotTypeEdit) error { + xClient, err := client.GetClient(s) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Add @Title 添加分类 +func (s *skuHotType) Add(ctx context.Context, name string) error { + xClient, err := client.GetClient(s) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Add", name, &reply) +} + +// Del @Title 删除分类 +func (s *skuHotType) Del(ctx context.Context, id uint) error { + xClient, err := client.GetClient(s) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Del", id, &reply) +} + +type HotTypeItem struct { + Id uint `json:"id"` + Name string `json:"name"` +} + +// All @Title 全部分类 +func (s *skuHotType) All(ctx context.Context) (reply []HotTypeItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + args := 0 + err = xClient.Call(ctx, "All", args, &reply) + return +}