From a2ae2d41772e228484f166fe56169c1b9d307f08 Mon Sep 17 00:00:00 2001 From: sian Date: Mon, 29 Aug 2022 14:17:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc.go | 2 ++ supplier/goods/goods.go | 5 ++++ supplier/goods/sku.go | 56 +++++++++++++++++++++++++++++++++++++++++ supplier/supplier.go | 7 ++++++ 4 files changed, 70 insertions(+) create mode 100644 supplier/goods/goods.go create mode 100644 supplier/goods/sku.go create mode 100644 supplier/supplier.go diff --git a/rpc.go b/rpc.go index e0e791e..f53982f 100644 --- a/rpc.go +++ b/rpc.go @@ -3,6 +3,7 @@ package service import ( "git.oa00.com/supply-chain/service/customer" "git.oa00.com/supply-chain/service/jd" + "git.oa00.com/supply-chain/service/supplier" "git.oa00.com/supply-chain/service/supply" ) @@ -12,4 +13,5 @@ type rpc struct { Supply supply.Supply Jd jd.Jd Customer customer.Customer + Supplier supplier.Supplier } diff --git a/supplier/goods/goods.go b/supplier/goods/goods.go new file mode 100644 index 0000000..6e36c8b --- /dev/null +++ b/supplier/goods/goods.go @@ -0,0 +1,5 @@ +package goods + +type Goods struct { + Sku sku +} diff --git a/supplier/goods/sku.go b/supplier/goods/sku.go new file mode 100644 index 0000000..05a800c --- /dev/null +++ b/supplier/goods/sku.go @@ -0,0 +1,56 @@ +package goods + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" + "github.com/shopspring/decimal" +) + +const ( + SkuStatusNone = 1 // 待处理 + SkuStatusAdopt = 2 // 同步入库 + SkuStatusReject = 3 // 废弃商品 +) + +type sku struct { +} +type SkuSearch struct { + Name string // 商品名称 + SupplierSkuId uint64 // 京东SkuId + CategoryId uint64 // 类目id + BrandName string // 品牌 + MinSupplyPrice decimal.Decimal // 采购价最小 + MaxSupplyPrice decimal.Decimal // 采购价最大 + SupplierType uint // 供应商类型 +} +type ArgsSkuList struct { + Search SkuSearch + Page bean.Page +} + +type SkuItem struct { + Id uint `json:"id"` + Name string `json:"name"` + ImgUrl string `json:"imgUrl"` + FirstCategoryName string `json:"firstCategoryName"` + SecondCategoryName string `json:"secondCategoryName"` + ThirdCategoryName string `json:"thirdCategoryName"` + BrandName string `json:"brandName"` + SupplyPrice decimal.Decimal `json:"supplyPrice"` + GuidePrice decimal.Decimal `json:"guidePrice"` +} +type ReplySkuList struct { + Lists []SkuItem `json:"lists"` + Total int64 `json:"total"` +} + +// Lists @Title 获取商品列表 +func (s *sku) Lists(ctx context.Context, args ArgsSkuList) (reply ReplySkuList, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) + return +} diff --git a/supplier/supplier.go b/supplier/supplier.go new file mode 100644 index 0000000..668ec73 --- /dev/null +++ b/supplier/supplier.go @@ -0,0 +1,7 @@ +package supplier + +import "git.oa00.com/supply-chain/service/supplier/goods" + +type Supplier struct { + Goods goods.Goods +}