From 24a34758a8d837ccd7a7e3fdfddc77ea481706e2 Mon Sep 17 00:00:00 2001 From: sian Date: Wed, 21 Dec 2022 16:37:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E5=8F=91=E5=95=86=E5=9F=8E=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/batchSku/banner.go | 67 ++++++++++++++++++++++ customer/batchSku/batchSku.go | 8 +++ customer/batchSku/item.go | 96 ++++++++++++++++++++++++++++++++ customer/batchSku/sale.go | 102 ++++++++++++++++++++++++++++++++++ customer/batchSku/type.go | 60 ++++++++++++++++++++ customer/customer.go | 8 ++- 6 files changed, 338 insertions(+), 3 deletions(-) create mode 100644 customer/batchSku/banner.go create mode 100644 customer/batchSku/batchSku.go create mode 100644 customer/batchSku/item.go create mode 100644 customer/batchSku/sale.go create mode 100644 customer/batchSku/type.go diff --git a/customer/batchSku/banner.go b/customer/batchSku/banner.go new file mode 100644 index 0000000..afb79ef --- /dev/null +++ b/customer/batchSku/banner.go @@ -0,0 +1,67 @@ +package batchSku + +import ( + "context" + "git.oa00.com/supply-chain/service/client" +) + +type banner struct { +} + +type BannerItem struct { + Id uint `json:"id"` + Img string `json:"img"` + SkuId uint `json:"skuId"` +} + +// All @Title 全部轮播图 +func (b *banner) All(ctx context.Context) (reply []BannerItem, err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + args := 0 + err = xClient.Call(ctx, "All", args, &reply) + return +} + +type ArgsSkuBannerEdit struct { + Id uint + SkuId uint + Img string +} + +// Edit @Title 编辑轮播图 +func (b *banner) Edit(ctx context.Context, args ArgsSkuBannerEdit) (err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Del @Title 删除轮播图 +func (b *banner) Del(ctx context.Context, id uint) (err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Del", id, &reply) +} + +type ArgsSkuBannerAdd struct { + SkuId uint + Img string +} + +// Add @Title 添加轮播图 +func (b *banner) Add(ctx context.Context, args ArgsSkuBannerAdd) error { + xClient, err := client.GetClient(b) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} diff --git a/customer/batchSku/batchSku.go b/customer/batchSku/batchSku.go new file mode 100644 index 0000000..d4eea51 --- /dev/null +++ b/customer/batchSku/batchSku.go @@ -0,0 +1,8 @@ +package batchSku + +type BatchSku struct { + Banner banner + Type skuType + Sale sale + Item item +} diff --git a/customer/batchSku/item.go b/customer/batchSku/item.go new file mode 100644 index 0000000..49f3798 --- /dev/null +++ b/customer/batchSku/item.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 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 +} diff --git a/customer/batchSku/sale.go b/customer/batchSku/sale.go new file mode 100644 index 0000000..c39f007 --- /dev/null +++ b/customer/batchSku/sale.go @@ -0,0 +1,102 @@ +package batchSku + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" +) + +type sale struct { +} + +type SaleHandleItem struct { + SkuId uint `json:"skuId"` + Error string `json:"error"` +} + +// Add @Title 添加 +func (s *sale) Add(ctx context.Context, skuIds []uint) (reply []SaleHandleItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "Add", skuIds, &reply) + return +} + +type ArgsSaleLists struct { + SkuId uint + Page bean.Page +} + +// Lists @Title 商品列表 +func (s *sale) Lists(ctx context.Context, args ArgsSaleLists) (reply ReplySaleSkuItemLists, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return ReplySaleSkuItemLists{}, err + } + err = xClient.Call(ctx, "Lists", args, &reply) + return +} + +type ReplySaleSkuItemLists struct { + Total int64 `json:"total"` + Lists []SaleSkuItem `json:"lists"` +} + +type SaleSkuItem struct { + Id uint `json:"id"` + SkuId uint `json:"skuId"` +} + +// Del @Title 删除商品 +func (s *sale) Del(ctx context.Context, ids []uint) error { + xClient, err := client.GetClient(s) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Del", ids, &reply) +} + +// SetImg @Title 设置区域导图 +func (s *sale) SetImg(ctx context.Context, path string) error { + xClient, err := client.GetClient(s) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "SetImg", path, &reply) +} + +// GetImg @Title 获取区域导图 +func (s *sale) GetImg(ctx context.Context) (reply string, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return "", err + } + args := 0 + err = xClient.Call(ctx, "GetImg", args, &reply) + return +} + +// DelAll @Title 删除全部商品 +func (s *sale) DelAll(ctx context.Context) error { + xClient, err := client.GetClient(s) + if err != nil { + return err + } + args := 0 + reply := 0 + return xClient.Call(ctx, "DelAll", args, &reply) +} + +// FindBySkuIds @Title 根据SkuId查询数据 +func (s *sale) FindBySkuIds(ctx context.Context, skuIds []uint) (reply []SaleSkuItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "FindBySkuIds", skuIds, &reply) + return +} diff --git a/customer/batchSku/type.go b/customer/batchSku/type.go new file mode 100644 index 0000000..1fd5b70 --- /dev/null +++ b/customer/batchSku/type.go @@ -0,0 +1,60 @@ +package batchSku + +import ( + "context" + "git.oa00.com/supply-chain/service/client" +) + +type skuType struct { +} + +type ArgsSkuTypeEdit struct { + Id uint + Name string +} + +// Edit @Title 编辑分类 +func (s *skuType) Edit(ctx context.Context, args ArgsSkuTypeEdit) error { + xClient, err := client.GetClient(s) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Add @Title 添加分类 +func (s *skuType) 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 *skuType) 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 TypeItem struct { + Id uint `json:"id"` + Name string `json:"name"` +} + +// All @Title 全部分类 +func (s *skuType) All(ctx context.Context) (reply []TypeItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + args := 0 + err = xClient.Call(ctx, "All", args, &reply) + return +} diff --git a/customer/customer.go b/customer/customer.go index 5b89f2a..ad1f7b7 100644 --- a/customer/customer.go +++ b/customer/customer.go @@ -1,12 +1,14 @@ package customer import ( + "git.oa00.com/supply-chain/service/customer/batchSku" "git.oa00.com/supply-chain/service/customer/service" "git.oa00.com/supply-chain/service/customer/sku" ) type Customer struct { - User user - Service service.Service - Sku sku.Sku + User user + Service service.Service + Sku sku.Sku + BatchSku batchSku.BatchSku }