From ef00e8225463b352b77bb3c67b6a5f5d56f4aa2d Mon Sep 17 00:00:00 2001 From: kanade Date: Fri, 16 Sep 2022 10:37:27 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/user.go | 1 + 1 file changed, 1 insertion(+) diff --git a/customer/user.go b/customer/user.go index 92fd31e..c319df4 100644 --- a/customer/user.go +++ b/customer/user.go @@ -136,6 +136,7 @@ type ArgsUserServiceInfo struct { } type ReplyUserServiceInfo struct { CustomerId uint `json:"customerId"` + AppKey string `json:"appKey"` AppSecret string `json:"appSecret"` ExpirationAt int64 `json:"expirationAt"` } From 542d319b325d257d4221e2b45e7d6ec3db1cc9b6 Mon Sep 17 00:00:00 2001 From: sian Date: Fri, 16 Sep 2022 15:31:27 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/customer.go | 6 +++- customer/sku/banner.go | 52 +++++++++++++++++++++++++++++++++ customer/sku/item.go | 65 ++++++++++++++++++++++++++++++++++++++++++ customer/sku/sale.go | 19 ++++++++++++ customer/sku/sku.go | 8 ++++++ customer/sku/type.go | 59 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 customer/sku/banner.go create mode 100644 customer/sku/item.go create mode 100644 customer/sku/sale.go create mode 100644 customer/sku/sku.go create mode 100644 customer/sku/type.go 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 +} From 0a305e6fcf7ab3ba1cf809c7dde8babe6be43758 Mon Sep 17 00:00:00 2001 From: sian Date: Fri, 16 Sep 2022 16:03:42 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/sku/banner.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/customer/sku/banner.go b/customer/sku/banner.go index 718cf87..9703580 100644 --- a/customer/sku/banner.go +++ b/customer/sku/banner.go @@ -50,3 +50,18 @@ func (b *banner) Del(ctx context.Context, id uint) (err error) { 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 ArgsSkuBannerEdit) error { + xClient, err := client.GetClient(b) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} From 8ab396a400874df9be567236b589183fa7d2c789 Mon Sep 17 00:00:00 2001 From: sian Date: Fri, 16 Sep 2022 16:09:44 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/sku/banner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customer/sku/banner.go b/customer/sku/banner.go index 9703580..4dfa398 100644 --- a/customer/sku/banner.go +++ b/customer/sku/banner.go @@ -57,7 +57,7 @@ type ArgsSkuBannerAdd struct { } // Add @Title 添加轮播图 -func (b *banner) Add(ctx context.Context, args ArgsSkuBannerEdit) error { +func (b *banner) Add(ctx context.Context, args ArgsSkuBannerAdd) error { xClient, err := client.GetClient(b) if err != nil { return err From e232f8d9d56fc092f83e1b6c9a450e72f5049d6a Mon Sep 17 00:00:00 2001 From: sian Date: Fri, 16 Sep 2022 16:52:39 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E8=A1=A5=E9=BD=90=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/sku/sale.go | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/customer/sku/sale.go b/customer/sku/sale.go index c4983c3..61b16a8 100644 --- a/customer/sku/sale.go +++ b/customer/sku/sale.go @@ -1,5 +1,11 @@ package sku +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" +) + type sale struct { } @@ -8,6 +14,26 @@ type SaleHandleItem struct { Error string `json:"error"` } +// Add @Title 添加 +func (s *sale) Add(ctx context.Context, skuIds []uint) (reply []SaleSkuItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "Add", skuIds, &reply) + return +} + +// Lists @Title 商品列表 +func (s *sale) Lists(ctx context.Context, page bean.Page) (reply ReplySaleSkuItemLists, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return ReplySaleSkuItemLists{}, err + } + err = xClient.Call(ctx, "Lists", page, &reply) + return +} + type ReplySaleSkuItemLists struct { Total int64 `json:"total"` Lists []SaleSkuItem `json:"lists"` @@ -17,3 +43,34 @@ 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 +} From 083217cca174350570e436c5ebb99ddaea4eaa47 Mon Sep 17 00:00:00 2001 From: sian Date: Fri, 16 Sep 2022 17:41:59 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/sku/type.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/customer/sku/type.go b/customer/sku/type.go index d263a88..09835cd 100644 --- a/customer/sku/type.go +++ b/customer/sku/type.go @@ -49,11 +49,12 @@ type TypeItem struct { } // All @Title 全部分类 -func (s *skuType) All(ctx context.Context, id uint) (reply []TypeItem, err error) { +func (s *skuType) All(ctx context.Context) (reply []TypeItem, err error) { xClient, err := client.GetClient(s) if err != nil { return nil, err } - err = xClient.Call(ctx, "All", id, &reply) + args := 0 + err = xClient.Call(ctx, "All", args, &reply) return } From 99a60f89e7547db89dc933ad7c2e9e5aa302f431 Mon Sep 17 00:00:00 2001 From: sian Date: Sun, 18 Sep 2022 11:01:41 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/sku/item.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customer/sku/item.go b/customer/sku/item.go index 4f20a39..8171e24 100644 --- a/customer/sku/item.go +++ b/customer/sku/item.go @@ -20,7 +20,7 @@ type ArgsSkuItemAdd struct { } // Add @Title 添加商品 -func (i *item) Add(ctx context.Context, args []ArgsSkuItemAdd) (reply []ReplySkuItemHandle, err error) { +func (i *item) Add(ctx context.Context, args ArgsSkuItemAdd) (reply []ReplySkuItemHandle, err error) { xClient, err := client.GetClient(i) if err != nil { return nil, err From 08e30dc077cb2986ec9c2c871c569f2ec4e28a96 Mon Sep 17 00:00:00 2001 From: sian Date: Sun, 18 Sep 2022 11:30:18 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AEids?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2sku=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supply/sku.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/supply/sku.go b/supply/sku.go index 3869e0b..0f63d78 100644 --- a/supply/sku.go +++ b/supply/sku.go @@ -308,3 +308,37 @@ func (s *sku) ChangeData(ctx context.Context, args ArgsSkuChangeData) (err error err = xClient.Call(ctx, "ChangeData", args, &reply) return } + +type ByIdsSkuItem struct { + Id uint `json:"id"` + Name string `json:"name"` // 名称 + BrandName string `json:"brandName"` // 品牌名称 + FirstCategoryId uint `json:"firstCategoryId"` // 一级分类id + SecondCategoryId uint `json:"secondCategoryId"` // 二级分类id + ThirdCategoryId uint `json:"thirdCategoryId"` // 三级分类id + SupplyPrice decimal.Decimal `json:"supplyPrice"` // 采购价 + GuidePrice decimal.Decimal `json:"guidePrice"` // 指导价 + ImgUrl string `json:"imgUrl"` // 商品主图 + PlatformStatus uint `json:"platformStatus"` // 平台状态 1=上架 2=下架 + SourceName string `json:"sourceName"` // 供应商名称 + SourceSkuId string `json:"sourceSkuId"` // 源skuId + SourceStatus uint `json:"sourceStatus"` // 供应商状态 1=上架 2=下架 + CustomerPrice decimal.Decimal `json:"customerPrice"` // 供货最高价 + CustomerProfitRate decimal.Decimal `json:"customerProfitRate"` // 供货利润率 供货利润/供货最高价% + AdjustType uint `json:"adjustType"` // 加价类型 + AdjustPrice decimal.Decimal `json:"adjustPrice"` // 加价金额 + AfterAdjustType uint `json:"afterAdjustType"` // 改价后加价类型 + AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"` // 改价后加价金额 + Handle uint `json:"handle"` // 1=未处理 2=已处理 + Reason string `json:"reason"` // 驳回原因 +} + +// FindByIds @Title 根据Ids查询sku信息 +func (s *sku) FindByIds(ctx context.Context, ids []uint) (reply []ByIdsSkuItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "FindByIds", ids, &reply) + return +} From 883827475c3d7c49e48180966c69a08f59a3b949 Mon Sep 17 00:00:00 2001 From: sian Date: Sun, 18 Sep 2022 11:53:46 +0800 Subject: [PATCH 9/9] - --- customer/sku/type.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customer/sku/type.go b/customer/sku/type.go index 09835cd..9ad61ed 100644 --- a/customer/sku/type.go +++ b/customer/sku/type.go @@ -40,7 +40,7 @@ func (s *skuType) Del(ctx context.Context, id uint) error { return err } reply := 0 - return xClient.Call(ctx, "Add", id, &reply) + return xClient.Call(ctx, "Del", id, &reply) } type TypeItem struct {