From 4aa68a959b6400cb67e2b0d9209d4555946b78fc Mon Sep 17 00:00:00 2001 From: kanade Date: Fri, 16 Dec 2022 11:22:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E5=8F=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc/error.go | 2 ++ wholesale/interface/order.go | 68 ++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 wholesale/interface/order.go diff --git a/rpc/error.go b/rpc/error.go index 203d156..c34fe1e 100644 --- a/rpc/error.go +++ b/rpc/error.go @@ -26,6 +26,7 @@ const ( ErrorOrderCancelError Error = 11020 // 订单取消失败 ErrorAfterServiceLogisticsAddressError Error = 11021 // 售后寄回地址获取失败 ErrorAfterServiceLogisticsAddressReturnError Error = 11022 // 售后寄回地址已回传 + ErrorWholesaleBatchOrderStartNumErr Error = 13101 // 商品未达到最小起批量 ) var ErrorCodes = map[Error]string{ @@ -51,6 +52,7 @@ var ErrorCodes = map[Error]string{ ErrorOrderCancelError: "订单取消失败", ErrorAfterServiceLogisticsAddressError: "售后寄回地址获取失败", ErrorAfterServiceLogisticsAddressReturnError: "售后寄回地址已回传", + ErrorWholesaleBatchOrderStartNumErr: "商品未达到最小起批量", } func (e Error) Error() string { diff --git a/wholesale/interface/order.go b/wholesale/interface/order.go new file mode 100644 index 0000000..56edcc0 --- /dev/null +++ b/wholesale/interface/order.go @@ -0,0 +1,68 @@ +package _interface + +import ( + "context" + "github.com/shopspring/decimal" +) + +type OrderInterface interface { + // FreightFee 获取运费 + FreightFee(ctx context.Context, args ArgsOrderFreightFee, freightFee *ReplyOrderFreightFee) error + // Submit 下单 + Submit(ctx context.Context, args ArgsOrderSubmit, sourceOrderSn *string) error + // LadingBill @Title 提单 + LadingBill(ctx context.Context, orderSn string, reply *int) error + // Close @Title 关闭订单 + Close(ctx context.Context, orderSn string, reply *int) error + // Cancel @Title 取消订单 + Cancel(ctx context.Context, args ArgsOrderCancel, reply *int) error + // Trajectory @Title 物流轨迹 + Trajectory(ctx context.Context, orderSn string, reply *[]ReplyTrajectory) error + // Finish @Title 确认收货 + Finish(ctx context.Context, orderSn string, reply *int) error +} +type ArgsOrderCancel struct { + OrderSn string // 订单编号 + Reason string // 取消原因 +} +type ArgsOrderFreightFee struct { + Skus []OrderFreightFeeSkuItem // 商品信息 + Address string // 地址 +} +type ReplyOrderFreightFee struct { + FreightFee decimal.Decimal // 运费 + ErrMsg string // 错误信息 +} + +type OrderFreightFeeSkuItem struct { + SourceSkuId string // 源skuId + SourceSkuPrice decimal.Decimal // 采购价 + Quantity uint // 数量(箱) +} + +type ArgsOrderSubmit struct { + OrderSn uint64 // 订单号 + Skus []OrderFreightFeeSkuItem // 商品信息 + Address string // 地址 + FreightFee decimal.Decimal // 运费 + Receiver OrderReceiver // 收件信息 + UserIp string // 用户ip +} + +type OrderReceiver struct { + Name string // 姓名 + Phone string // 手机号 + Email string // 邮件 + ZipCode string // 邮编 +} + +type ReplyTrajectory struct { + LogisticsName string `json:"logisticsName"` + WaybillCode string `json:"waybillCode"` + Steps []PackageStep `json:"steps"` +} +type PackageStep struct { + State string `json:"state"` + Content string `json:"content"` + OperatorAt int64 `json:"operatorAt"` +}