diff --git a/supply/channel/mq.go b/supply/channel/mq.go new file mode 100644 index 0000000..28ccbee --- /dev/null +++ b/supply/channel/mq.go @@ -0,0 +1,25 @@ +package channel + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "github.com/smallnest/rpcx/share" +) + +type mq struct { +} + +type ArgsMqSubscribe struct { + Name string // 队列名称 +} + +// Subscribe @Title 订阅mq +func (m *mq) Subscribe(ctx context.Context, channelId string, args ArgsMqSubscribe) (err error) { + reply := 0 + xClient, err := client.GetClient(m) + if err != nil { + return + } + err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Subscribe", args, &reply) + return +} diff --git a/supply/channel/order.go b/supply/channel/order.go index c2c2608..1b4cec3 100644 --- a/supply/channel/order.go +++ b/supply/channel/order.go @@ -3,6 +3,7 @@ package channel import ( "context" "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" "github.com/shopspring/decimal" "github.com/smallnest/rpcx/share" ) @@ -20,7 +21,9 @@ const ( OrderSubStatusSendOutGoods = 3 // 出库/发货 OrderSubStatusDelivered = 4 // 妥投 OrderSubStatusFinal = 5 // 完成 - OrderSubStatusCancel = 6 // 取消 + + OrderCancelSubStatusFalse = 1 // 未取消 + OrderCancelSubStatusTrue = 2 // 已取消 OrderSubIsSplitFalse = 1 // 无 OrderSubIsSplitTrue = 2 // 被拆单 @@ -126,3 +129,71 @@ func (o *order) Cancel(ctx context.Context, channelId string, orderSn string) (e } return xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Cancel", orderSn, &reply) } + +type OrderListsSearch struct { + Status []uint // 订单状态 + CancelStatus uint // 订单取消状态 + OrderSn string // 订单编号 + ReceiverName string // 收件人 + ReceiverMobile string // 手机号 + LadingBillDateStart string // 提单日期 + LadingBillDateEnd string // 提单日期 + FinishDateStart string // 完成日期 + FinishDateEnd string // 完成日期 +} +type ArgsOrderLists struct { + Search OrderListsSearch + Page bean.Page +} + +type OrderItem struct { + OrderId uint `json:"orderId"` + OrderSn uint64 `json:"orderSn"` + ReceiverName string `json:"receiverName"` + ReceiverMobile string `json:"receiverMobile"` + Address string `json:"address"` + FreightFee decimal.Decimal `json:"freightFee"` + OrderFee decimal.Decimal `json:"orderFee"` + LadingBillAt int64 `json:"ladingBillAt"` + FinishAt int64 `json:"finishAt"` + Status uint `json:"status"` + CancelStatus uint `json:"cancelStatus"` + CreatedAt int64 `json:"createdAt"` + Skus []OrderSku `json:"skus"` +} + +type OrderSku struct { + Id uint `json:"id"` + SkuId uint `json:"skuId"` + Name string `json:"name"` + GuidePrice decimal.Decimal `json:"guidePrice"` + ImgUrl string `json:"imgUrl"` + Size string `json:"size"` + Color string `json:"color"` + Quantity uint `json:"quantity"` +} + +type ReplyOrderList struct { + Lists []OrderItem `json:"lists"` + Total int64 `json:"total"` +} + +// Lists @Title 订单列表 +func (o *order) Lists(ctx context.Context, channelId string, args ArgsOrderLists) (reply ReplyOrderList, err error) { + xClient, err := client.GetClient(o) + if err != nil { + return + } + err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Lists", args, &reply) + return +} + +// Detail @Title 订单详情 +func (o *order) Detail(ctx context.Context, channelId string, orderSn string) (reply OrderItem, err error) { + xClient, err := client.GetClient(o) + if err != nil { + return + } + err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Detail", orderSn, &reply) + return +} diff --git a/supply/channel/sku.go b/supply/channel/sku.go index 265225f..4eaa6b4 100644 --- a/supply/channel/sku.go +++ b/supply/channel/sku.go @@ -46,6 +46,7 @@ type SkuItem struct { CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } + type ReplySkuList struct { Lists []SkuItem `json:"lists"` Total int64 `json:"total"`