From 413e2b0d9cbb9d7f3f9ca284b1237aac793eb410 Mon Sep 17 00:00:00 2001 From: kanade Date: Thu, 11 Aug 2022 10:20:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc/error.go | 8 ++++++-- supply/channel/order.go | 22 ++++++++++++++++------ supply/interface/order.go | 11 ++++++----- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/rpc/error.go b/rpc/error.go index 0525ee9..80f924b 100644 --- a/rpc/error.go +++ b/rpc/error.go @@ -6,17 +6,21 @@ const ( ErrorSystem Error = 11001 // 系统错误 ErrorOrderRepeat Error = 11002 // 重复下单 - ErrorOrderFreightFee Error = 11003 // 运费获取失败 + ErrorOrderFreightFee Error = 11003 // 运费错误 ErrorOrderSubmit Error = 11004 // 下单失败 ErrorOrderShipment Error = 11005 // 无法配送 + ErrorOrderSkuPrice Error = 11006 // 商品价格错误 + ErrorOrderAmount Error = 11007 // 订单金额错误 ) var ErrorCodes = map[Error]string{ ErrorSystem: "系统错误", ErrorOrderRepeat: "重复下单", - ErrorOrderFreightFee: "运费获取失败", + ErrorOrderFreightFee: "运费错误", ErrorOrderSubmit: "下单失败", ErrorOrderShipment: "无法配送", + ErrorOrderSkuPrice: "商品价格错误", + ErrorOrderAmount: "订单金额错误", } func (e Error) Error() string { diff --git a/supply/channel/order.go b/supply/channel/order.go index e5eab07..c2f2300 100644 --- a/supply/channel/order.go +++ b/supply/channel/order.go @@ -41,13 +41,23 @@ func (o *order) FreightFee(ctx context.Context, channelId string, args ArgsOrder return } +type SkuOrderItem struct { + SkuId uint // skuId + Price decimal.Decimal // 单价 + Quantity uint // 数量 +} type ArgsOrderSubmit struct { - Address string // 地址 - Skus []SkuFreightFeeItem // sku信息 - Receiver Receiver // 收件信息 - OrderFee decimal.Decimal // 订单金额-不含运费 - FreightFee decimal.Decimal // 运费 - UserIp string // 下单用户ip + Address string // 地址 + Skus []SkuOrderItem // sku信息 + Receiver Receiver // 收件信息 + OrderFee decimal.Decimal // 订单金额-不含运费 + FreightFees []OrderFreightFee // 运费 + UserIp string // 下单用户ip +} + +type OrderFreightFee struct { + SkuIds []uint `json:"skuIds"` + FreightFee decimal.Decimal `json:"freightFee"` } type Receiver struct { diff --git a/supply/interface/order.go b/supply/interface/order.go index db83557..c8c5d4a 100644 --- a/supply/interface/order.go +++ b/supply/interface/order.go @@ -23,11 +23,12 @@ type OrderFreightFeeSkuItem struct { } type ArgsOrderSubmit struct { - OrderSn uint64 // 订单号 - Skus []OrderFreightFeeSkuItem // 商品信息 - Address string // 地址 - Receiver OrderReceiver // 收件信息 - UserIp string // 用户ip + OrderSn uint64 // 订单号 + Skus []OrderFreightFeeSkuItem // 商品信息 + Address string // 地址 + FreightFee decimal.Decimal // 运费 + Receiver OrderReceiver // 收件信息 + UserIp string // 用户ip } type OrderReceiver struct {