diff --git a/customer/customer.go b/customer/customer.go index aef31de..5b89f2a 100644 --- a/customer/customer.go +++ b/customer/customer.go @@ -1,8 +1,12 @@ package customer -import "git.oa00.com/supply-chain/service/customer/service" +import ( + "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 } diff --git a/customer/sku/banner.go b/customer/sku/banner.go new file mode 100644 index 0000000..718cf87 --- /dev/null +++ b/customer/sku/banner.go @@ -0,0 +1,52 @@ +package sku + +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) +} diff --git a/customer/sku/item.go b/customer/sku/item.go new file mode 100644 index 0000000..4f20a39 --- /dev/null +++ b/customer/sku/item.go @@ -0,0 +1,65 @@ +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 +} diff --git a/customer/sku/sale.go b/customer/sku/sale.go new file mode 100644 index 0000000..c4983c3 --- /dev/null +++ b/customer/sku/sale.go @@ -0,0 +1,19 @@ +package sku + +type sale struct { +} + +type SaleHandleItem struct { + SkuId uint `json:"skuId"` + Error string `json:"error"` +} + +type ReplySaleSkuItemLists struct { + Total int64 `json:"total"` + Lists []SaleSkuItem `json:"lists"` +} + +type SaleSkuItem struct { + Id uint `json:"id"` + SkuId uint `json:"skuId"` +} diff --git a/customer/sku/sku.go b/customer/sku/sku.go new file mode 100644 index 0000000..a2ffb5e --- /dev/null +++ b/customer/sku/sku.go @@ -0,0 +1,8 @@ +package sku + +type Sku struct { + Banner banner + Type skuType + Sale sale + Item item +} diff --git a/customer/sku/type.go b/customer/sku/type.go new file mode 100644 index 0000000..d263a88 --- /dev/null +++ b/customer/sku/type.go @@ -0,0 +1,59 @@ +package sku + +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, "Add", id, &reply) +} + +type TypeItem struct { + Id uint `json:"id"` + Name string `json:"name"` +} + +// All @Title 全部分类 +func (s *skuType) All(ctx context.Context, id uint) (reply []TypeItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "All", id, &reply) + return +}