From 5779913f6f9217995683dd5ac73ce23ffa0a9bcf Mon Sep 17 00:00:00 2001 From: sian Date: Mon, 1 Aug 2022 11:06:48 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supply/sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supply/sku.go b/supply/sku.go index e411cb5..620fd9a 100644 --- a/supply/sku.go +++ b/supply/sku.go @@ -138,7 +138,7 @@ type SkuItem struct { AdjustType uint // 加价类型 AdjustPrice decimal.Decimal // 加价金额 Handle uint // 1=未处理 2=已处理 - Imgs []SkuImg + Reason string // 驳回原因 } // Lists @Title 商品列表 From 417037f710c3f7ed0fa64aa53c72855c5a3c7b45 Mon Sep 17 00:00:00 2001 From: sian Date: Mon, 1 Aug 2022 15:25:13 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E5=93=81?= =?UTF-8?q?=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 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/supply/sku.go b/supply/sku.go index 620fd9a..b572774 100644 --- a/supply/sku.go +++ b/supply/sku.go @@ -147,6 +147,34 @@ func (s *sku) Lists(ctx context.Context, args ArgsSkuLists) (reply ReplySkuList, return } +type SkuInfo struct { + Id uint + Name string // 名称 + BrandName string // 品牌名称 + FirstCategoryId uint // 一级分类id + SecondCategoryId uint // 二级分类id + ThirdCategoryId uint // 三级分类id + SupplyPrice decimal.Decimal // 采购价 + GuidePrice decimal.Decimal // 指导价 + ImgUrl string // 商品主图 + PlatformStatus uint // 平台状态 1=上架 2=下架 + SourceName string // 供应商名称 + SourceSkuId string // 源skuId + SourceStatus uint // 供应商状态 1=上架 2=下架 + CustomerPrice decimal.Decimal // 供货最高价 + CustomerProfitRate decimal.Decimal // 供货利润率 供货利润/供货最高价% + AdjustType uint // 加价类型 + AdjustPrice decimal.Decimal // 加价金额 + Handle uint // 1=未处理 2=已处理 + Reason string // 驳回原因 +} + +// Info @Title 商品信息 +func (s *sku) Info(ctx context.Context, skuId uint) (reply SkuInfo, err error) { + err = client.GetClient(s).Call(ctx, "Info", skuId, &reply) + return +} + type ArgsSkuOnShelves struct { SkuIds []uint } From b4ded1cb4445ec6c619aacfd2abba66099656892 Mon Sep 17 00:00:00 2001 From: sian Date: Mon, 1 Aug 2022 16:02:28 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supply/sku.go | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/supply/sku.go b/supply/sku.go index b572774..31b1dd1 100644 --- a/supply/sku.go +++ b/supply/sku.go @@ -148,25 +148,24 @@ func (s *sku) Lists(ctx context.Context, args ArgsSkuLists) (reply ReplySkuList, } type SkuInfo struct { - Id uint - Name string // 名称 - BrandName string // 品牌名称 - FirstCategoryId uint // 一级分类id - SecondCategoryId uint // 二级分类id - ThirdCategoryId uint // 三级分类id - SupplyPrice decimal.Decimal // 采购价 - GuidePrice decimal.Decimal // 指导价 - ImgUrl string // 商品主图 - PlatformStatus uint // 平台状态 1=上架 2=下架 - SourceName string // 供应商名称 - SourceSkuId string // 源skuId - SourceStatus uint // 供应商状态 1=上架 2=下架 - CustomerPrice decimal.Decimal // 供货最高价 - CustomerProfitRate decimal.Decimal // 供货利润率 供货利润/供货最高价% - AdjustType uint // 加价类型 - AdjustPrice decimal.Decimal // 加价金额 - Handle uint // 1=未处理 2=已处理 - Reason string // 驳回原因 + Id uint `json:"id"` + Name string `json:"name"` + SourceSkuId string `json:"jdSkuId"` + SupplyPrice decimal.Decimal `json:"supplyPrice"` + GuidePrice decimal.Decimal `json:"guidePrice"` + Profit decimal.Decimal `json:"profit"` + UpcCode string `json:"upcCode"` + Color string `json:"color"` + Size string `json:"size"` + FirstCategoryName string `json:"firstCategoryName"` + SecondCategoryName string `json:"secondCategoryName"` + ThirdCategoryName string `json:"thirdCategoryName"` + BrandName string `json:"brandName"` + Content string `json:"content"` + Tax string `json:"tax"` + Unit string `json:"unit"` + Imgs []SkuImg `json:"imgs"` + Reason string `json:"reason"` } // Info @Title 商品信息 From f95bd8835e6d34f72a9f1b35118d8fc9c21857c3 Mon Sep 17 00:00:00 2001 From: kanade Date: Mon, 1 Aug 2022 17:03:09 +0800 Subject: [PATCH 4/7] =?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 --- jd/sku.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jd/sku.go b/jd/sku.go index 4b6776d..e905ef3 100644 --- a/jd/sku.go +++ b/jd/sku.go @@ -51,6 +51,8 @@ type SkuItem struct { Profit decimal.Decimal `json:"profit"` Status uint `json:"status"` Handle uint `json:"handle"` + SupplyCategoryId uint `json:"supplyCategoryId"` + SupplyBrandId uint `json:"supplyBrandId"` } type ReplySkuList struct { Lists []SkuItem `json:"lists"` @@ -63,6 +65,12 @@ func (s *sku) Lists(ctx context.Context, args ArgsSkuList) (reply ReplySkuList, return } +// Start @Title 开始处理 +func (s *sku) Start(ctx context.Context, skuIds []uint) error { + reply := 0 + return client.GetClient(s).Call(ctx, "Start", skuIds, &reply) +} + type ReplySkuInfo struct { Id uint `json:"id"` Name string `json:"name"` From 6fbd1af5ad9ebb36499fd614ec9cd322cc853fb2 Mon Sep 17 00:00:00 2001 From: sian Date: Mon, 1 Aug 2022 17:21:42 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supply/sku.go | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/supply/sku.go b/supply/sku.go index 31b1dd1..24a0725 100644 --- a/supply/sku.go +++ b/supply/sku.go @@ -148,24 +148,29 @@ func (s *sku) Lists(ctx context.Context, args ArgsSkuLists) (reply ReplySkuList, } type SkuInfo struct { - Id uint `json:"id"` - Name string `json:"name"` - SourceSkuId string `json:"jdSkuId"` - SupplyPrice decimal.Decimal `json:"supplyPrice"` - GuidePrice decimal.Decimal `json:"guidePrice"` - Profit decimal.Decimal `json:"profit"` - UpcCode string `json:"upcCode"` - Color string `json:"color"` - Size string `json:"size"` - FirstCategoryName string `json:"firstCategoryName"` - SecondCategoryName string `json:"secondCategoryName"` - ThirdCategoryName string `json:"thirdCategoryName"` - BrandName string `json:"brandName"` - Content string `json:"content"` - Tax string `json:"tax"` - Unit string `json:"unit"` - Imgs []SkuImg `json:"imgs"` - Reason string `json:"reason"` + Id uint `json:"id"` + Name string `json:"name"` + SourceSkuId string `json:"jdSkuId"` + SupplyPrice decimal.Decimal `json:"supplyPrice"` + GuidePrice decimal.Decimal `json:"guidePrice"` + Profit decimal.Decimal `json:"profit"` + UpcCode string `json:"upcCode"` + Color string `json:"color"` + Size string `json:"size"` + FirstCategoryName string `json:"firstCategoryName"` + SecondCategoryName string `json:"secondCategoryName"` + ThirdCategoryName string `json:"thirdCategoryName"` + BrandName string `json:"brandName"` + Content string `json:"content"` + Tax string `json:"tax"` + Unit string `json:"unit"` + Imgs []SkuImg `json:"imgs"` + Reason string `json:"reason"` + Specifications []SkuSpecification `json:"specification"` + PlatformStatus uint `json:"platformStatus"` + SourceName string `json:"sourceName"` + AdjustType uint `json:"adjustType"` + AdjustPrice decimal.Decimal `json:"adjustPrice"` } // Info @Title 商品信息 From d5b4e7b91e84efa42a9e0d9586ac5b46d4a89b54 Mon Sep 17 00:00:00 2001 From: sian Date: Tue, 2 Aug 2022 17:09:27 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supply/skuAudit.go | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/supply/skuAudit.go b/supply/skuAudit.go index 4dc5ec5..6058a5f 100644 --- a/supply/skuAudit.go +++ b/supply/skuAudit.go @@ -23,24 +23,27 @@ type SkuAuditSearch struct { Status uint // 状态 1=未审核 2=通过 3=驳回 } type SkuAndAuditItem struct { - AuditId uint `json:"auditId"` - SkuId uint `json:"skuId"` - AfterAdjustType uint `json:"afterAdjustType"` - AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"` - Name string `json:"name"` - SupplyPrice decimal.Decimal `json:"supplyPrice"` - GuidePrice decimal.Decimal `json:"guidePrice"` - AdjustType uint `json:"adjustType"` - AdjustPrice decimal.Decimal `json:"adjustPrice"` - CustomerPrice decimal.Decimal `json:"customerPrice"` - Category string `json:"category"` - BrandName string `json:"brandName"` - SourceName string `json:"sourceName"` - AuditUserId uint `json:"auditUserId"` - AuditAt sql.NullTime `json:"auditAt"` - ImgUrl string `json:"imgUrl"` - Reason string `json:"reason"` - CreatedAt time.Time `json:"createdAt"` + AuditId uint `json:"auditId"` + SkuId uint `json:"skuId"` + AfterAdjustType uint `json:"afterAdjustType"` + AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"` + Name string `json:"name"` + SupplyPrice decimal.Decimal `json:"supplyPrice"` + GuidePrice decimal.Decimal `json:"guidePrice"` + AdjustType uint `json:"adjustType"` + AdjustPrice decimal.Decimal `json:"adjustPrice"` + CustomerPrice decimal.Decimal `json:"customerPrice"` + Category string `json:"category"` + BrandName string `json:"brandName"` + SourceName string `json:"sourceName"` + AuditUserId uint `json:"auditUserId"` + AuditAt sql.NullTime `json:"auditAt"` + ImgUrl string `json:"imgUrl"` + Reason string `json:"reason"` + FirstCategoryName string `json:"firstCategoryName"` + SecondCategoryName string `json:"secondCategoryName"` + ThirdCategoryName string `json:"thirdCategoryName"` + CreatedAt time.Time `json:"createdAt"` } type ReplySkuAuditLists struct { From 9d48a244c0140129608f55688bfdbc7c7f54f112 Mon Sep 17 00:00:00 2001 From: kanade Date: Wed, 3 Aug 2022 09:29:07 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client.go | 14 +++++------ customer/service/audit.go | 6 ++++- customer/service/audit/supply.go | 24 +++++++++++++++--- customer/user.go | 42 ++++++++++++++++++++++++++------ customer/user/deposit.go | 12 +++++++-- customer/user/depositAudit.go | 18 +++++++++++--- customer/user/wallet.go | 6 ++++- jd/brand.go | 18 +++++++++++--- jd/category.go | 18 +++++++++++--- jd/sku.go | 42 ++++++++++++++++++++++++++------ jd/task.go | 12 +++++++-- supply/brand.go | 30 +++++++++++++++++++---- supply/category.go | 24 +++++++++++++++--- supply/channel/order.go | 12 +++++++-- supply/channel/sku.go | 18 +++++++++++--- supply/setting/rate.go | 12 +++++++-- supply/sku.go | 42 ++++++++++++++++++++++++++------ supply/skuAudit.go | 18 +++++++++++--- 18 files changed, 302 insertions(+), 66 deletions(-) diff --git a/client/client.go b/client/client.go index 0fe95e9..a9531bd 100644 --- a/client/client.go +++ b/client/client.go @@ -1,6 +1,7 @@ package client import ( + "errors" "fmt" "git.oa00.com/supply-chain/service/config" "github.com/smallnest/rpcx/client" @@ -23,7 +24,7 @@ func init() { } // GetClient @Title 获取RPC客户的 -func GetClient(s interface{}) client.XClient { +func GetClient(s interface{}) (client.XClient, error) { path := strings.TrimPrefix(reflect.ValueOf(s).Elem().Type().PkgPath(), basePkgPath) actionName := reflect.ValueOf(s).Elem().Type().Name() key := path + "/" + actionName @@ -38,8 +39,7 @@ func GetClient(s interface{}) client.XClient { d, err := client.NewConsulDiscovery(basePath, servicePath, config.RpcConfig.RegistryServer, nil) if err != nil { - log.Println(err) - return nil + return nil, errors.New("系统异常") } option := client.DefaultOption option.Retries = 3 @@ -51,11 +51,11 @@ func GetClient(s interface{}) client.XClient { } mutex.Unlock() } - return xClient.(client.XClient) + return xClient.(client.XClient), nil } // GetClientName @Title 根据服务名获取客户端 -func GetClientName(base, service string) client.XClient { +func GetClientName(base, service string) (client.XClient, error) { key := fmt.Sprintf("%s/%s", base, service) xClient, ok := mClient.Load(key) if !ok { @@ -65,7 +65,7 @@ func GetClientName(base, service string) client.XClient { d, err := client.NewConsulDiscovery(base, service, config.RpcConfig.RegistryServer, nil) if err != nil { log.Println(err) - return nil + return nil, errors.New("系统异常") } option := client.DefaultOption option.Retries = 3 @@ -77,5 +77,5 @@ func GetClientName(base, service string) client.XClient { } mutex.Unlock() } - return xClient.(client.XClient) + return xClient.(client.XClient), nil } diff --git a/customer/service/audit.go b/customer/service/audit.go index 27ee3c6..bb7bd49 100644 --- a/customer/service/audit.go +++ b/customer/service/audit.go @@ -34,6 +34,10 @@ type ReplyAuditLists struct { // Lists @Title 服务审核列表 func (a *audit) Lists(ctx context.Context, args ArgsAuditLists) (reply ReplyAuditLists, err error) { - err = client.GetClient(a).Call(ctx, "Lists", args, &reply) + xClient, err := client.GetClient(a) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) return } diff --git a/customer/service/audit/supply.go b/customer/service/audit/supply.go index 64c7891..821f006 100644 --- a/customer/service/audit/supply.go +++ b/customer/service/audit/supply.go @@ -19,7 +19,11 @@ type ArgsSupplyApply struct { // Apply @Title 申请 func (s *supply) Apply(ctx context.Context, args ArgsSupplyApply) error { reply := 0 - return client.GetClient(s).Call(ctx, "Apply", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Apply", args, &reply) } type ArgsSupplyAdopt struct { @@ -30,7 +34,11 @@ type ArgsSupplyAdopt struct { // Adopt @Title 审核通过 func (s *supply) Adopt(ctx context.Context, args ArgsSupplyAdopt) error { reply := 0 - return client.GetClient(s).Call(ctx, "Adopt", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Adopt", args, &reply) } type ArgsSupplyReject struct { @@ -42,7 +50,11 @@ type ArgsSupplyReject struct { // Reject @Title 驳回 func (s *supply) Reject(ctx context.Context, args ArgsSupplyReject) error { reply := 0 - return client.GetClient(s).Call(ctx, "Reject", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Reject", args, &reply) } type ReplySupplyInfo struct { @@ -63,6 +75,10 @@ type ReplySupplyInfo struct { // Info @Title 详情 func (s *supply) Info(ctx context.Context, userServiceId uint) (reply ReplySupplyInfo, err error) { - err = client.GetClient(s).Call(ctx, "Info", userServiceId, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", userServiceId, &reply) return } diff --git a/customer/user.go b/customer/user.go index 1278a5e..92fd31e 100644 --- a/customer/user.go +++ b/customer/user.go @@ -46,7 +46,11 @@ type ReplyUserList struct { // Lists @Title 获取客户列表 func (u *user) Lists(ctx context.Context, args ArgsUserList) (reply ReplyUserList, err error) { - err = client.GetClient(u).Call(ctx, "Lists", args, &reply) + xClient, err := client.GetClient(u) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) return } @@ -63,7 +67,11 @@ type ArgsUserAdd struct { // Add @Title 添加客户 func (u *user) Add(ctx context.Context, args ArgsUserAdd) error { reply := 0 - return client.GetClient(u).Call(ctx, "Add", args, &reply) + xClient, err := client.GetClient(u) + if err != nil { + return err + } + return xClient.Call(ctx, "Add", args, &reply) } type ReplyUserInfo struct { @@ -76,7 +84,11 @@ type ReplyUserInfo struct { // Info @Title 客户详情 func (u *user) Info(ctx context.Context, userId uint) (result ReplyUserInfo, err error) { - err = client.GetClient(u).Call(ctx, "Info", userId, &result) + xClient, err := client.GetClient(u) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", userId, &result) return } @@ -91,19 +103,31 @@ type ArgsUserEdit struct { // Edit @Title 编辑客户 func (u *user) Edit(ctx context.Context, args ArgsUserEdit) error { reply := 0 - return client.GetClient(u).Call(ctx, "Edit", args, &reply) + xClient, err := client.GetClient(u) + if err != nil { + return err + } + return xClient.Call(ctx, "Edit", args, &reply) } // Enable @Title 启用 func (u *user) Enable(ctx context.Context, userId uint) error { reply := 0 - return client.GetClient(u).Call(ctx, "Enable", userId, &reply) + xClient, err := client.GetClient(u) + if err != nil { + return err + } + return xClient.Call(ctx, "Enable", userId, &reply) } // Disable @Title 停用 func (u *user) Disable(ctx context.Context, userId uint) error { reply := 0 - return client.GetClient(u).Call(ctx, "Disable", userId, &reply) + xClient, err := client.GetClient(u) + if err != nil { + return err + } + return xClient.Call(ctx, "Disable", userId, &reply) } type ArgsUserServiceInfo struct { @@ -118,6 +142,10 @@ type ReplyUserServiceInfo struct { // ServiceInfo @Title 获取服务信息 func (u *user) ServiceInfo(ctx context.Context, args ArgsUserServiceInfo) (reply ReplyUserServiceInfo, err error) { - err = client.GetClient(u).Call(ctx, "ServiceInfo", args, &reply) + xClient, err := client.GetClient(u) + if err != nil { + return + } + err = xClient.Call(ctx, "ServiceInfo", args, &reply) return } diff --git a/customer/user/deposit.go b/customer/user/deposit.go index 9501065..6f6419f 100644 --- a/customer/user/deposit.go +++ b/customer/user/deposit.go @@ -31,7 +31,11 @@ type ArgsDepositAdd struct { // Add @Title 充值 func (d *deposit) Add(ctx context.Context, args ArgsDepositAdd) error { reply := 0 - return client.GetClient(d).Call(ctx, "Add", args, &reply) + xClient, err := client.GetClient(d) + if err != nil { + return err + } + return xClient.Call(ctx, "Add", args, &reply) } type ArgsDepositInfo struct { @@ -57,6 +61,10 @@ type ReplyDepositInfo struct { // Info @Title 详情 func (d *deposit) Info(ctx context.Context, args ArgsDepositInfo) (reply ReplyDepositInfo, err error) { - err = client.GetClient(d).Call(ctx, "Info", args, &reply) + xClient, err := client.GetClient(d) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", args, &reply) return } diff --git a/customer/user/depositAudit.go b/customer/user/depositAudit.go index 21e28c4..1af29f5 100644 --- a/customer/user/depositAudit.go +++ b/customer/user/depositAudit.go @@ -41,7 +41,11 @@ type DepositAuditItem struct { // Lists @Title 充值审核列表 func (d *depositAudit) Lists(ctx context.Context, args ArgsDepositAuditLists) (reply ReplyDepositAuditList, err error) { - err = client.GetClient(d).Call(ctx, "Lists", args, &reply) + xClient, err := client.GetClient(d) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) return } @@ -53,7 +57,11 @@ type ArgsDepositAuditAdopt struct { // Adopt @Title 通过 func (d *depositAudit) Adopt(ctx context.Context, args ArgsDepositAuditAdopt) error { reply := 0 - return client.GetClient(d).Call(ctx, "Adopt", args, &reply) + xClient, err := client.GetClient(d) + if err != nil { + return err + } + return xClient.Call(ctx, "Adopt", args, &reply) } @@ -66,5 +74,9 @@ type ArgsDepositAuditReject struct { // Reject @Title 驳回 func (d *depositAudit) Reject(ctx context.Context, args ArgsDepositAuditReject) error { reply := 0 - return client.GetClient(d).Call(ctx, "Reject", args, &reply) + xClient, err := client.GetClient(d) + if err != nil { + return err + } + return xClient.Call(ctx, "Reject", args, &reply) } diff --git a/customer/user/wallet.go b/customer/user/wallet.go index 04aa620..1136b89 100644 --- a/customer/user/wallet.go +++ b/customer/user/wallet.go @@ -30,5 +30,9 @@ type ArgsWalletDirect struct { // Direct @Title 直接消费 func (w *wallet) Direct(ctx context.Context, args ArgsDepositAuditReject) error { reply := 0 - return client.GetClient(w).Call(ctx, "Direct", args, &reply) + xClient, err := client.GetClient(w) + if err != nil { + return err + } + return xClient.Call(ctx, "Direct", args, &reply) } diff --git a/jd/brand.go b/jd/brand.go index f8366f1..3ad00d1 100644 --- a/jd/brand.go +++ b/jd/brand.go @@ -25,7 +25,11 @@ type ReplyBrandList struct { // Lists @Title 获取品牌匹配列表 func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (reply ReplyBrandList, err error) { - err = client.GetClient(b).Call(ctx, "Lists", args, &reply) + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) return } @@ -38,7 +42,11 @@ type ArgsBrandEdit struct { // Edit @Title 编辑品牌匹配 func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) error { reply := 0 - return client.GetClient(b).Call(ctx, "Edit", args, &reply) + xClient, err := client.GetClient(b) + if err != nil { + return err + } + return xClient.Call(ctx, "Edit", args, &reply) } type ArgsImport struct { @@ -48,5 +56,9 @@ type ArgsImport struct { func (b *brand) Import(ctx context.Context, args []ArgsImport) error { reply := 0 - return client.GetClient(b).Call(ctx, "Import", args, &reply) + xClient, err := client.GetClient(b) + if err != nil { + return err + } + return xClient.Call(ctx, "Import", args, &reply) } diff --git a/jd/category.go b/jd/category.go index 8b0fd20..2aad24d 100644 --- a/jd/category.go +++ b/jd/category.go @@ -27,7 +27,11 @@ type ReplyCategoryList struct { // Lists @Title 获取品牌匹配列表 func (c *category) Lists(ctx context.Context, args ArgsCategoryList) (reply ReplyCategoryList, err error) { - err = client.GetClient(c).Call(ctx, "Lists", args, &reply) + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) return } @@ -42,12 +46,20 @@ type ArgsCategoryEdit struct { // Edit @Title 编辑品牌匹配 func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) error { reply := 0 - return client.GetClient(c).Call(ctx, "Edit", args, &reply) + xClient, err := client.GetClient(c) + if err != nil { + return err + } + return xClient.Call(ctx, "Edit", args, &reply) } // Select @Title 类目筛选 func (c *category) Select(ctx context.Context) (reply []CategoryItem, err error) { args := 0 - err = client.GetClient(c).Call(ctx, "Select", args, &reply) + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "Select", args, &reply) return } diff --git a/jd/sku.go b/jd/sku.go index e905ef3..b40e03d 100644 --- a/jd/sku.go +++ b/jd/sku.go @@ -61,14 +61,22 @@ type ReplySkuList struct { // Lists @Title 获取商品列表 func (s *sku) Lists(ctx context.Context, args ArgsSkuList) (reply ReplySkuList, err error) { - err = client.GetClient(s).Call(ctx, "Lists", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) return } // Start @Title 开始处理 func (s *sku) Start(ctx context.Context, skuIds []uint) error { reply := 0 - return client.GetClient(s).Call(ctx, "Start", skuIds, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Start", skuIds, &reply) } type ReplySkuInfo struct { @@ -103,7 +111,11 @@ type SkuImg struct { // GetImgs @Title 获取预览图 func (s *sku) GetImgs(ctx context.Context, skuId uint) (reply []SkuImg, err error) { - err = client.GetClient(s).Call(ctx, "GetImgs", skuId, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "GetImgs", skuId, &reply) return } @@ -119,7 +131,11 @@ type SkuAttribute struct { // Info @Title 获取商品详情 func (s *sku) Info(ctx context.Context, skuId uint) (reply ReplySkuInfo, err error) { - err = client.GetClient(s).Call(ctx, "Info", skuId, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", skuId, &reply) return } @@ -139,13 +155,21 @@ type SkuImgEdit struct { // Edit @Title 商品编辑 func (s *sku) Edit(ctx context.Context, args ArgsSkuEdit) error { reply := 0 - return client.GetClient(s).Call(ctx, "Edit", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Edit", args, &reply) } // Discard @Title 废弃 func (s *sku) Discard(ctx context.Context, skuIds []uint) error { reply := 0 - return client.GetClient(s).Call(ctx, "Discard", skuIds, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Discard", skuIds, &reply) } type AdoptItem struct { @@ -157,6 +181,10 @@ type AdoptItem struct { // Adopt @Title 入库 func (s *sku) Adopt(ctx context.Context, skuIds []uint) (reply []AdoptItem, err error) { - err = client.GetClient(s).Call(ctx, "Adopt", skuIds, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Adopt", skuIds, &reply) return } diff --git a/jd/task.go b/jd/task.go index 802a463..5a3b0a6 100644 --- a/jd/task.go +++ b/jd/task.go @@ -11,11 +11,19 @@ type task struct { // PullSku @Title 拉取京东商品 func (t *task) PullSku(ctx context.Context) error { a := 0 - return client.GetClient(t).Call(ctx, "PullSku", 0, &a) + xClient, err := client.GetClient(t) + if err != nil { + return err + } + return xClient.Call(ctx, "PullSku", 0, &a) } // SkuAdd @Title 添加商品到库 func (t *task) SkuAdd(ctx context.Context) error { a := 0 - return client.GetClient(t).Call(ctx, "SkuAdd", 0, &a) + xClient, err := client.GetClient(t) + if err != nil { + return err + } + return xClient.Call(ctx, "SkuAdd", 0, &a) } diff --git a/supply/brand.go b/supply/brand.go index b4054d6..d4516ff 100644 --- a/supply/brand.go +++ b/supply/brand.go @@ -31,13 +31,21 @@ type BrandSearch struct { // Lists @Title 品牌列表 func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (result ReplyBrandList, err error) { - err = client.GetClient(b).Call(ctx, "Lists", args, &result) + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &result) return } // All @Title 全部品牌 func (b *brand) All(ctx context.Context) (result []BrandItem, err error) { - err = client.GetClient(b).Call(ctx, "All", 0, &result) + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "All", 0, &result) return } @@ -48,7 +56,11 @@ type ArgsBrandAdd struct { // Add @Title 添加品牌 func (b *brand) Add(ctx context.Context, args ArgsBrandAdd) (err error) { reply := 0 - return client.GetClient(b).Call(ctx, "Add", args, &reply) + xClient, err := client.GetClient(b) + if err != nil { + return err + } + return xClient.Call(ctx, "Add", args, &reply) } type ArgsBrandEdit struct { @@ -59,7 +71,11 @@ type ArgsBrandEdit struct { // Edit @Title 编辑品牌 func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) (err error) { reply := 0 - return client.GetClient(b).Call(ctx, "Edit", args, &reply) + xClient, err := client.GetClient(b) + if err != nil { + return err + } + return xClient.Call(ctx, "Edit", args, &reply) } type ArgsBrandFindByIds struct { @@ -68,6 +84,10 @@ type ArgsBrandFindByIds struct { // FindByIds @Title 品牌获取 func (b *brand) FindByIds(ctx context.Context, args ArgsBrandFindByIds) (result []BrandItem, err error) { - err = client.GetClient(b).Call(ctx, "FindByIds", args, &result) + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "FindByIds", args, &result) return } diff --git a/supply/category.go b/supply/category.go index d6673c2..0795cfc 100644 --- a/supply/category.go +++ b/supply/category.go @@ -17,7 +17,11 @@ type CategoryItem struct { // All @Title 获取分类 func (c *category) All(ctx context.Context) (result []CategoryItem, err error) { - err = client.GetClient(c).Call(ctx, "All", 0, &result) + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", 0, &result) return } @@ -29,7 +33,11 @@ type ArgsCategoryAdd struct { // Add @Title 添加分类 func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) { reply := 0 - return client.GetClient(c).Call(ctx, "Add", args, &reply) + xClient, err := client.GetClient(c) + if err != nil { + return + } + return xClient.Call(ctx, "Add", args, &reply) } type ArgsCategoryEdit struct { @@ -41,7 +49,11 @@ type ArgsCategoryEdit struct { // Edit @Title 编辑分类 func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) { reply := 0 - return client.GetClient(c).Call(ctx, "Edit", args, &reply) + xClient, err := client.GetClient(c) + if err != nil { + return + } + return xClient.Call(ctx, "Edit", args, &reply) } type ArgsCategoryFindByIds struct { @@ -56,6 +68,10 @@ type ThirdCategoryItem struct { // FindByIds @Title 三级分类获取 func (c *category) FindByIds(ctx context.Context, args ArgsCategoryFindByIds) (result []ThirdCategoryItem, err error) { - err = client.GetClient(c).Call(ctx, "FindByIds", args, &result) + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "FindByIds", args, &result) return } diff --git a/supply/channel/order.go b/supply/channel/order.go index 2450dc5..f253939 100644 --- a/supply/channel/order.go +++ b/supply/channel/order.go @@ -27,7 +27,11 @@ type ReplyOrderFreightFee struct { // FreightFee @Title 获取运费 func (o *order) FreightFee(ctx context.Context, channelId string, args ArgsOrderFreightFee) (reply []ReplyOrderFreightFee, err error) { - err = client.GetClient(o).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "FreightFee", args, &reply) + xClient, err := client.GetClient(o) + if err != nil { + return + } + err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "FreightFee", args, &reply) return } @@ -52,6 +56,10 @@ type ReplyOrderSubmit struct { // Submit @Title 下单 func (o *order) Submit(ctx context.Context, channelId string, args ArgsOrderSubmit) (reply []ReplyOrderSubmit, err error) { - err = client.GetClient(o).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Submit", args, &reply) + xClient, err := client.GetClient(o) + if err != nil { + return + } + err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Submit", args, &reply) return } diff --git a/supply/channel/sku.go b/supply/channel/sku.go index a4af4e6..ee277f6 100644 --- a/supply/channel/sku.go +++ b/supply/channel/sku.go @@ -51,7 +51,11 @@ type ReplySkuList struct { // Lists @Title 商品列表 func (s *sku) Lists(ctx context.Context, channelId string, args ArgsSkuList) (reply ReplySkuList, err error) { - err = client.GetClient(s).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Lists", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Lists", args, &reply) return } @@ -103,7 +107,11 @@ type SkuAttribute struct { // Details @Title 获取sku详情 func (s *sku) Details(ctx context.Context, channelId string, args ArgsSkuDetails) (reply []SkuDetailItem, err error) { - err = client.GetClient(s).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Details", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Details", args, &reply) return } @@ -124,6 +132,10 @@ type ReplySkuStock struct { // Stock @Title 库存查询 func (s *sku) Stock(ctx context.Context, channelId string, args ArgsSkuStock) (reply []ReplySkuStock, err error) { - err = client.GetClient(s).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Stock", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Stock", args, &reply) return } diff --git a/supply/setting/rate.go b/supply/setting/rate.go index bbde3c8..8ffb1fa 100644 --- a/supply/setting/rate.go +++ b/supply/setting/rate.go @@ -17,7 +17,11 @@ type RateItem struct { // All @Title 全部利率 func (r *rate) All(ctx context.Context) (result []RateItem, err error) { - err = client.GetClient(r).Call(ctx, "All", 0, &result) + xClient, err := client.GetClient(r) + if err != nil { + return + } + err = xClient.Call(ctx, "All", 0, &result) return } @@ -29,5 +33,9 @@ type ArgsRateChannel struct { // Channel @Title 设置渠道利率 func (r *rate) Channel(ctx context.Context, args ArgsRateChannel) error { reply := 0 - return client.GetClient(r).Call(ctx, "Channel", args, &reply) + xClient, err := client.GetClient(r) + if err != nil { + return err + } + return xClient.Call(ctx, "Channel", args, &reply) } diff --git a/supply/sku.go b/supply/sku.go index 24a0725..79ee92f 100644 --- a/supply/sku.go +++ b/supply/sku.go @@ -76,7 +76,11 @@ type SkuAttribute struct { // Add @Title 添加商品 func (s *sku) Add(ctx context.Context, args ArgsSkuAdd) error { reply := 0 - return client.GetClient(s).Call(ctx, "Add", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Add", args, &reply) } type ArgsSkuAdjust struct { @@ -89,7 +93,11 @@ type ArgsSkuAdjust struct { // Adjust @Title 加价 func (s *sku) Adjust(ctx context.Context, args ArgsSkuAdjust) error { reply := 0 - return client.GetClient(s).Call(ctx, "Adjust", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Adjust", args, &reply) } type ArgsSkuLists struct { @@ -143,7 +151,11 @@ type SkuItem struct { // Lists @Title 商品列表 func (s *sku) Lists(ctx context.Context, args ArgsSkuLists) (reply ReplySkuList, err error) { - err = client.GetClient(s).Call(ctx, "Lists", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) return } @@ -175,7 +187,11 @@ type SkuInfo struct { // Info @Title 商品信息 func (s *sku) Info(ctx context.Context, skuId uint) (reply SkuInfo, err error) { - err = client.GetClient(s).Call(ctx, "Info", skuId, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", skuId, &reply) return } @@ -190,13 +206,21 @@ type ArgsSkuDownShelves struct { // OnShelves @Title 上架 func (s *sku) OnShelves(ctx context.Context, args ArgsSkuOnShelves) error { reply := 0 - return client.GetClient(s).Call(ctx, "OnShelves", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "OnShelves", args, &reply) } // DownShelves @Title 下架 func (s *sku) DownShelves(ctx context.Context, args ArgsSkuDownShelves) error { reply := 0 - return client.GetClient(s).Call(ctx, "DownShelves", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "DownShelves", args, &reply) } type ArgsSkuAdjustType struct { @@ -209,5 +233,9 @@ type ArgsSkuAdjustType struct { // EditAdjust @Title 修改改价类型 func (s *sku) EditAdjust(ctx context.Context, args ArgsSkuAdjustType) error { reply := 0 - return client.GetClient(s).Call(ctx, "EditAdjust", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "EditAdjust", args, &reply) } diff --git a/supply/skuAudit.go b/supply/skuAudit.go index 6058a5f..5624d0b 100644 --- a/supply/skuAudit.go +++ b/supply/skuAudit.go @@ -53,7 +53,11 @@ type ReplySkuAuditLists struct { // Lists @Title 审核列表 func (s *skuAudit) Lists(ctx context.Context, args ArgsSkuAuditLists) (reply ReplySkuAuditLists, err error) { - err = client.GetClient(s).Call(ctx, "Lists", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) return } @@ -65,7 +69,11 @@ type ArgsSkuAuditAdopt struct { // Adopt @Title 通过 func (s *skuAudit) Adopt(ctx context.Context, args ArgsSkuAuditAdopt) error { reply := 0 - return client.GetClient(s).Call(ctx, "Adopt", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Adopt", args, &reply) } type ArgsSkuAuditReject struct { @@ -77,7 +85,11 @@ type ArgsSkuAuditReject struct { // Reject @Title 驳回 func (s *skuAudit) Reject(ctx context.Context, args ArgsSkuAuditReject) error { reply := 0 - return client.GetClient(s).Call(ctx, "Reject", args, &reply) + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Reject", args, &reply) } // Stock @Title 库存查询