From 7bb01961f28381a64c03c4fbe3b0980636ce49ab Mon Sep 17 00:00:00 2001 From: kanade Date: Wed, 10 Aug 2022 16:25:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd/task.go | 10 ++++++++++ rpc/error.go | 24 ++++++++++++++++++++++++ supply/interface/order.go | 9 +++++---- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 rpc/error.go diff --git a/jd/task.go b/jd/task.go index 5a3b0a6..9017f45 100644 --- a/jd/task.go +++ b/jd/task.go @@ -27,3 +27,13 @@ func (t *task) SkuAdd(ctx context.Context) error { } return xClient.Call(ctx, "SkuAdd", 0, &a) } + +// RefreshToken @Title 更新token +func (t *task) RefreshToken(ctx context.Context) error { + a := 0 + xClient, err := client.GetClient(t) + if err != nil { + return err + } + return xClient.Call(ctx, "RefreshToken", 0, &a) +} diff --git a/rpc/error.go b/rpc/error.go new file mode 100644 index 0000000..0525ee9 --- /dev/null +++ b/rpc/error.go @@ -0,0 +1,24 @@ +package rpc + +type Error uint + +const ( + ErrorSystem Error = 11001 // 系统错误 + + ErrorOrderRepeat Error = 11002 // 重复下单 + ErrorOrderFreightFee Error = 11003 // 运费获取失败 + ErrorOrderSubmit Error = 11004 // 下单失败 + ErrorOrderShipment Error = 11005 // 无法配送 +) + +var ErrorCodes = map[Error]string{ + ErrorSystem: "系统错误", + ErrorOrderRepeat: "重复下单", + ErrorOrderFreightFee: "运费获取失败", + ErrorOrderSubmit: "下单失败", + ErrorOrderShipment: "无法配送", +} + +func (e Error) Error() string { + return ErrorCodes[e] +} diff --git a/supply/interface/order.go b/supply/interface/order.go index bd97851..db83557 100644 --- a/supply/interface/order.go +++ b/supply/interface/order.go @@ -23,10 +23,11 @@ type OrderFreightFeeSkuItem struct { } type ArgsOrderSubmit struct { - OrderSn string // 订单号 - Skus []OrderFreightFeeSkuItem // 商品信息 - Address string // 地址 - FreightFee decimal.Decimal // 运费 + OrderSn uint64 // 订单号 + Skus []OrderFreightFeeSkuItem // 商品信息 + Address string // 地址 + Receiver OrderReceiver // 收件信息 + UserIp string // 用户ip } type OrderReceiver struct {