From 810ca4f43e3f549345569f0e565f58c3e028eeef Mon Sep 17 00:00:00 2001 From: kanade Date: Tue, 31 Jan 2023 10:48:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=93=81=E7=89=8C?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wholesale/brand.go | 47 +++++++------------------------------------ wholesale/category.go | 37 +++++----------------------------- 2 files changed, 12 insertions(+), 72 deletions(-) diff --git a/wholesale/brand.go b/wholesale/brand.go index 231096b..dc75db1 100644 --- a/wholesale/brand.go +++ b/wholesale/brand.go @@ -3,34 +3,14 @@ package wholesale import ( "context" "git.oa00.com/supply-chain/service/client" - "git.oa00.com/supply-chain/service/lib/bean" + "git.oa00.com/supply-chain/service/supply" ) type brand struct { } -type ArgsBrandList struct { - Search BrandSearch - Page bean.Page -} - -type BrandItem struct { - Id uint `json:"id"` - Name string `json:"name"` - CreatedAt int64 `json:"createdAt"` - UpdatedAt int64 `json:"updatedAt"` -} -type ReplyBrandList struct { - Lists []BrandItem `json:"lists"` - Total int64 `json:"total"` -} - -type BrandSearch struct { - Name string // 品牌名称 -} - // Lists @Title 品牌列表 -func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (result ReplyBrandList, err error) { +func (b *brand) Lists(ctx context.Context, args supply.ArgsBrandList) (result supply.ReplyBrandList, err error) { xClient, err := client.GetClient(b) if err != nil { return @@ -40,7 +20,7 @@ func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (result ReplyBran } // All @Title 全部品牌 -func (b *brand) All(ctx context.Context) (result []BrandItem, err error) { +func (b *brand) All(ctx context.Context) (result []supply.BrandItem, err error) { xClient, err := client.GetClient(b) if err != nil { return @@ -50,7 +30,7 @@ func (b *brand) All(ctx context.Context) (result []BrandItem, err error) { } // FindByNameAll @Title 品牌名称筛选品牌 -func (b *brand) FindByNameAll(ctx context.Context, name string) (result []BrandItem, err error) { +func (b *brand) FindByNameAll(ctx context.Context, name string) (result []supply.BrandItem, err error) { xClient, err := client.GetClient(b) if err != nil { return @@ -59,12 +39,8 @@ func (b *brand) FindByNameAll(ctx context.Context, name string) (result []BrandI return } -type ArgsBrandAdd struct { - Name string // 品牌名称 -} - // Add @Title 添加品牌 -func (b *brand) Add(ctx context.Context, args ArgsBrandAdd) (err error) { +func (b *brand) Add(ctx context.Context, args supply.ArgsBrandAdd) (err error) { reply := 0 xClient, err := client.GetClient(b) if err != nil { @@ -73,13 +49,8 @@ func (b *brand) Add(ctx context.Context, args ArgsBrandAdd) (err error) { return xClient.Call(ctx, "Add", args, &reply) } -type ArgsBrandEdit struct { - BrandId uint // 品牌id - Name string // 品牌名称 -} - // Edit @Title 编辑品牌 -func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) (err error) { +func (b *brand) Edit(ctx context.Context, args supply.ArgsBrandEdit) (err error) { reply := 0 xClient, err := client.GetClient(b) if err != nil { @@ -88,12 +59,8 @@ func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) (err error) { return xClient.Call(ctx, "Edit", args, &reply) } -type ArgsBrandFindByIds struct { - BrandIds []uint // 品牌id数组 -} - // FindByIds @Title 品牌获取 -func (b *brand) FindByIds(ctx context.Context, args ArgsBrandFindByIds) (result []BrandItem, err error) { +func (b *brand) FindByIds(ctx context.Context, args supply.ArgsBrandFindByIds) (result []supply.BrandItem, err error) { xClient, err := client.GetClient(b) if err != nil { return diff --git a/wholesale/category.go b/wholesale/category.go index 6d6295d..4e90bb7 100644 --- a/wholesale/category.go +++ b/wholesale/category.go @@ -3,20 +3,14 @@ package wholesale import ( "context" "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/supply" ) type category struct { } -type CategoryItem struct { - Id uint `json:"id"` - Name string `json:"name"` - ParentId uint `json:"parentId"` - Children []CategoryItem `json:"children"` -} - // All @Title 获取分类 -func (c *category) All(ctx context.Context) (result []CategoryItem, err error) { +func (c *category) All(ctx context.Context) (result []supply.CategoryItem, err error) { xClient, err := client.GetClient(c) if err != nil { return @@ -25,13 +19,8 @@ func (c *category) All(ctx context.Context) (result []CategoryItem, err error) { return } -type ArgsCategoryAdd struct { - Name string // 分类名称 - ParentId uint // 上级id -} - // Add @Title 添加分类 -func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) { +func (c *category) Add(ctx context.Context, args supply.ArgsCategoryAdd) (err error) { reply := 0 xClient, err := client.GetClient(c) if err != nil { @@ -40,14 +29,8 @@ func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) { return xClient.Call(ctx, "Add", args, &reply) } -type ArgsCategoryEdit struct { - CategoryId uint // 分类id - Name string // 分类名称 - ParentId uint // 上级id -} - // Edit @Title 编辑分类 -func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) { +func (c *category) Edit(ctx context.Context, args supply.ArgsCategoryEdit) (err error) { reply := 0 xClient, err := client.GetClient(c) if err != nil { @@ -56,18 +39,8 @@ func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) return xClient.Call(ctx, "Edit", args, &reply) } -type ArgsCategoryFindByIds struct { - ThirdCategoryIds []uint // 三级分类id数组 -} -type ThirdCategoryItem struct { - Id uint `json:"id"` - Name string `json:"name"` - ParentId uint `json:"parentId"` - Parent *ThirdCategoryItem `json:"parent"` -} - // FindByIds @Title 三级分类获取 -func (c *category) FindByIds(ctx context.Context, args ArgsCategoryFindByIds) (result []ThirdCategoryItem, err error) { +func (c *category) FindByIds(ctx context.Context, args supply.ArgsCategoryFindByIds) (result []supply.ThirdCategoryItem, err error) { xClient, err := client.GetClient(c) if err != nil { return From 6f30c29e791272b6ca298eb9ff279cd046781569 Mon Sep 17 00:00:00 2001 From: sian Date: Tue, 31 Jan 2023 13:04:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E7=8A=B6=E6=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd/task.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/jd/task.go b/jd/task.go index 9017f45..a8bf25c 100644 --- a/jd/task.go +++ b/jd/task.go @@ -37,3 +37,18 @@ func (t *task) RefreshToken(ctx context.Context) error { } return xClient.Call(ctx, "RefreshToken", 0, &a) } + +type ReplySkuAddStatus struct { + Total uint + Count uint +} + +// GetSkuAddStatus @Title 获取同步状态 +func (t *task) GetSkuAddStatus(ctx context.Context) (reply ReplySkuAddStatus, err error) { + xClient, err := client.GetClient(t) + if err != nil { + return + } + err = xClient.Call(ctx, "GetSkuAddStatus", 0, &reply) + return +}