From 8ab089203d995a8b6eeeb9853c210043f533ac7f Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Thu, 27 Aug 2026 16:33:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6:=20sdk=5Ft?= =?UTF-8?q?b=5Flinkedmall/types.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk_tb_linkedmall/types.go | 607 +++++++++++++++++++++++++++++++++++++ 1 file changed, 607 insertions(+) create mode 100644 sdk_tb_linkedmall/types.go diff --git a/sdk_tb_linkedmall/types.go b/sdk_tb_linkedmall/types.go new file mode 100644 index 0000000..859bd20 --- /dev/null +++ b/sdk_tb_linkedmall/types.go @@ -0,0 +1,607 @@ +package sdk_tb_linkedmall + +// ============================================================ +// 公共响应结构体 +// ============================================================ + +// CommonResponse 是所有API的统一外层响应结构 +type CommonResponse struct { + RequestId string `json:"RequestId"` + Success bool `json:"Success"` + Code string `json:"Code"` + Message string `json:"Message"` + SubCode string `json:"SubCode"` + SubMessage string `json:"SubMessage"` + Data interface{} `json:"Data"` +} + +// ============================================================ +// 接口1:ListPurchaserShops - 获取采购方店铺列表 +// ============================================================ + +// ListPurchaserShopsReq 查询采购方店铺列表请求参数 +type ListPurchaserShopsReq struct { + PageNum int `json:"PageNum,omitempty"` + PageSize int `json:"PageSize,omitempty"` +} + +// ListPurchaserShopsRespData 查询采购方店铺列表响应数据 +type ListPurchaserShopsRespData struct { + Total int64 `json:"Total"` + PageNum int `json:"PageNum"` + PageSize int `json:"PageSize"` + ShopList []PurchaserShopItem `json:"ShopList"` +} + +// PurchaserShopItem 采购方店铺条目 +type PurchaserShopItem struct { + ShopId string `json:"ShopId"` + PurchaserId string `json:"PurchaserId"` + ShopName string `json:"ShopName"` + ShopStatus string `json:"ShopStatus"` +} + +// ============================================================ +// 接口2:GetPurchaserShop - 获取单个采购店铺详情 +// ============================================================ + +// GetPurchaserShopReq 获取采购店铺详情请求参数 +type GetPurchaserShopReq struct { + ShopId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId,omitempty"` // Query参数 +} + +// GetPurchaserShopRespData 获取采购店铺详情响应数据 +type GetPurchaserShopRespData struct { + ShopId string `json:"ShopId"` + PurchaserId string `json:"PurchaserId"` + ShopName string `json:"ShopName"` + ShopStatus string `json:"ShopStatus"` + ContactInfo string `json:"ContactInfo"` +} + +// ============================================================ +// 接口3:ListSelectionProducts - 查询选品池商品列表 +// ============================================================ + +// ListSelectionProductsReq 查询选品池商品列表请求参数 +type ListSelectionProductsReq struct { + PurchaserId string `json:"PurchaserId"` + PageNum int `json:"PageNum,omitempty"` + PageSize int `json:"PageSize,omitempty"` +} + +// ListSelectionProductsRespData 查询选品池商品列表响应数据 +type ListSelectionProductsRespData struct { + Total int64 `json:"Total"` + PageNum int `json:"PageNum"` + PageSize int `json:"PageSize"` + ProductList []SelectionProductItem `json:"ProductList"` +} + +// SelectionProductItem 选品池商品条目 +type SelectionProductItem struct { + ProductId string `json:"ProductId"` + Title string `json:"Title"` + MainImage string `json:"MainImage"` + BrandName string `json:"BrandName"` + CategoryId string `json:"CategoryId"` +} + +// ============================================================ +// 接口4:GetSelectionProduct - 查询选品池商品详情 +// ============================================================ + +// GetSelectionProductReq 查询选品池商品详情请求参数 +type GetSelectionProductReq struct { + ProductId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId"` + DivisionCode string `json:"DivisionCode,omitempty"` +} + +// GetSelectionProductRespData 查询选品池商品详情响应数据 +type GetSelectionProductRespData struct { + ProductId string `json:"ProductId"` + Title string `json:"Title"` + MainImage string `json:"MainImage"` + Images []string `json:"Images"` + BrandName string `json:"BrandName"` + CategoryId string `json:"CategoryId"` + Desc string `json:"Desc"` + SkuList []SelectionSkuItem `json:"SkuList"` + CanSale bool `json:"CanSale"` + StockQuantity int64 `json:"StockQuantity"` +} + +// SelectionSkuItem SKU条目 +type SelectionSkuItem struct { + SkuId string `json:"SkuId"` + SkuSpec string `json:"SkuSpec"` + SalePrice int64 `json:"SalePrice"` // 单位分 + MarketPrice int64 `json:"MarketPrice"` // 单位分 + StockQuantity int64 `json:"StockQuantity"` +} + +// ============================================================ +// 接口5:GetSelectionProductSaleInfo - 查询选品池商品销售信息 +// ============================================================ + +// GetSelectionProductSaleInfoReq 查询选品池商品销售信息请求参数 +type GetSelectionProductSaleInfoReq struct { + ProductId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId"` + DivisionCode string `json:"DivisionCode,omitempty"` +} + +// GetSelectionProductSaleInfoRespData 选品池商品销售信息 +type GetSelectionProductSaleInfoRespData struct { + ProductId string `json:"ProductId"` + CanSale bool `json:"CanSale"` + SalePrice int64 `json:"SalePrice"` + MarketPrice int64 `json:"MarketPrice"` + StockQuantity int64 `json:"StockQuantity"` +} + +// ============================================================ +// 接口6:ListSelectionProductSaleInfos - 批量查询商品销售信息 +// ============================================================ + +// ListSelectionProductSaleInfosReq 批量查询商品销售信息请求参数 +type ListSelectionProductSaleInfosReq struct { + PurchaserId string `json:"PurchaserId"` + ProductIdList []string `json:"ProductIdList"` + DivisionCode string `json:"DivisionCode,omitempty"` +} + +// ListSelectionProductSaleInfosRespData 批量查询商品销售信息响应数据 +type ListSelectionProductSaleInfosRespData struct { + ProductSaleInfoList []GetSelectionProductSaleInfoRespData `json:"ProductSaleInfoList"` +} + +// ============================================================ +// 接口7:ListSelectionSkuSaleInfos - 批量SKU销售信息 +// ============================================================ + +// ListSelectionSkuSaleInfosReq 批量SKU销售信息请求参数 +type ListSelectionSkuSaleInfosReq struct { + PurchaserId string `json:"PurchaserId"` + SkuIdList []string `json:"SkuIdList"` + DivisionCode string `json:"DivisionCode,omitempty"` +} + +// ListSelectionSkuSaleInfosRespData 批量SKU销售信息响应数据 +type ListSelectionSkuSaleInfosRespData struct { + SkuSaleInfoList []SelectionSkuItem `json:"SkuSaleInfoList"` +} + +// ============================================================ +// 接口8:ListCategories - 查询类目列表 +// ============================================================ + +// ListCategoriesReq 查询类目列表请求参数 +type ListCategoriesReq struct { + PurchaserId string `json:"PurchaserId"` + ParentCategoryId string `json:"ParentCategoryId,omitempty"` +} + +// ListCategoriesRespData 类目列表响应数据 +type ListCategoriesRespData struct { + CategoryList []CategoryItem `json:"CategoryList"` +} + +// CategoryItem 类目条目 +type CategoryItem struct { + CategoryId string `json:"CategoryId"` + CategoryName string `json:"CategoryName"` + ParentId string `json:"ParentId"` + Level int `json:"Level"` +} + +// ============================================================ +// 接口9:SearchProducts - 搜索选品池商品 +// ============================================================ + +// SearchProductsReq 搜索选品池商品请求参数 +type SearchProductsReq struct { + Keyword string `json:"Keyword,omitempty"` + CategoryId string `json:"CategoryId,omitempty"` + PageNum int `json:"PageNum,omitempty"` + PageSize int `json:"PageSize,omitempty"` + PurchaserId string `json:"PurchaserId"` +} + +// SearchProductsRespData 搜索选品池商品响应数据 +type SearchProductsRespData struct { + Total int64 `json:"Total"` + PageNum int `json:"PageNum"` + PageSize int `json:"PageSize"` + ProductList []SelectionProductItem `json:"ProductList"` +} + +// ============================================================ +// 接口10:SelectionGroupAddProduct - 选品池商品入库 +// ============================================================ + +// SelectionGroupAddProductReq 选品池商品入库请求参数 +type SelectionGroupAddProductReq struct { + PurchaserId string `json:"PurchaserId"` + ShopId string `json:"ShopId"` + ProductIdList []string `json:"ProductIdList"` +} + +// ============================================================ +// 接口11:SelectionGroupRemoveProduct - 选品池商品出库 +// ============================================================ + +// SelectionGroupRemoveProductReq 选品池商品出库请求参数 +type SelectionGroupRemoveProductReq struct { + PurchaserId string `json:"PurchaserId"` + ShopId string `json:"ShopId"` + ProductIdList []string `json:"ProductIdList"` +} + +// ============================================================ +// 接口12:RenderPurchaseOrder - 采购单渲染(下单预校验) +// ============================================================ + +// RenderPurchaseOrderReq 采购单渲染请求参数 +type RenderPurchaseOrderReq struct { + PurchaserId string `json:"PurchaserId"` + ShopId string `json:"ShopId"` + DivisionCode string `json:"DivisionCode"` + ItemList []RenderOrderItem `json:"ItemList"` + ReceiverInfo ReceiverInfo `json:"ReceiverInfo"` +} + +// RenderOrderItem 渲染商品条目 +type RenderOrderItem struct { + SkuId string `json:"SkuId"` + Quantity int64 `json:"Quantity"` +} + +// ReceiverInfo 收货人信息 +type ReceiverInfo struct { + ReceiverName string `json:"ReceiverName"` + ReceiverPhone string `json:"ReceiverPhone"` + ProvinceCode string `json:"ProvinceCode"` + CityCode string `json:"CityCode"` + DistrictCode string `json:"DistrictCode"` + TownCode string `json:"TownCode"` + DetailAddress string `json:"DetailAddress"` +} + +// RenderPurchaseOrderRespData 采购单渲染响应数据 +type RenderPurchaseOrderRespData struct { + TotalFee int64 `json:"TotalFee"` // 总金额,单位分 + TotalFreightFee int64 `json:"TotalFreightFee"` // 总运费,单位分 + ItemList []RenderResultItem `json:"ItemList"` + UnavailableList []UnavailableItem `json:"UnavailableList"` // 不可售商品列表 +} + +// RenderResultItem 渲染结果商品条目 +type RenderResultItem struct { + SkuId string `json:"SkuId"` + ProductId string `json:"ProductId"` + Title string `json:"Title"` + Quantity int64 `json:"Quantity"` + SalePrice int64 `json:"SalePrice"` // 实时单价,单位分 + TotalFee int64 `json:"TotalFee"` // 小计金额,单位分 + FreightFee int64 `json:"FreightFee"` // 运费,单位分 + CanSale bool `json:"CanSale"` + UnavailableReason string `json:"UnavailableReason,omitempty"` +} + +// UnavailableItem 不可售商品 +type UnavailableItem struct { + SkuId string `json:"SkuId"` + ProductId string `json:"ProductId"` + Reason string `json:"Reason"` +} + +// ============================================================ +// 接口13:SplitPurchaseOrder - 采购单渲染并拆单 +// ============================================================ + +// SplitPurchaseOrderReq 采购单渲染并拆单请求参数(与RenderPurchaseOrderReq相同) +type SplitPurchaseOrderReq = RenderPurchaseOrderReq + +// SplitPurchaseOrderRespData 采购单渲染并拆单响应数据 +type SplitPurchaseOrderRespData struct { + SubOrderList []SubOrderRenderResult `json:"SubOrderList"` +} + +// SubOrderRenderResult 子单渲染结果 +type SubOrderRenderResult struct { + ShopId string `json:"ShopId"` + ShopName string `json:"ShopName"` + TotalFee int64 `json:"TotalFee"` + FreightFee int64 `json:"FreightFee"` + ItemList []RenderResultItem `json:"ItemList"` +} + +// ============================================================ +// 接口14:CreatePurchaseOrder - 创建采购单【异步】 +// ============================================================ + +// CreatePurchaseOrderReq 创建采购单请求参数 +type CreatePurchaseOrderReq struct { + PurchaserId string `json:"PurchaserId"` + ShopId string `json:"ShopId"` + OuterPurchaseOrderId string `json:"OuterPurchaseOrderId"` // 外部业务唯一单号,幂等 + DivisionCode string `json:"DivisionCode"` + ReceiverInfo ReceiverInfo `json:"ReceiverInfo"` + SubOrderList []CreateSubOrderItem `json:"SubOrderList"` +} + +// CreateSubOrderItem 创建采购单子单条目 +type CreateSubOrderItem struct { + SkuId string `json:"SkuId"` + Quantity int64 `json:"Quantity"` +} + +// CreatePurchaseOrderRespData 创建采购单响应数据 +type CreatePurchaseOrderRespData struct { + PurchaseOrderId string `json:"PurchaseOrderId"` // 阿里云采购单号 +} + +// ============================================================ +// 接口15:GetPurchaseOrderStatus - 获取采购单状态 +// ============================================================ + +// GetPurchaseOrderStatusReq 获取采购单状态请求参数 +type GetPurchaseOrderStatusReq struct { + PurchaseOrderId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId"` +} + +// GetPurchaseOrderStatusRespData 获取采购单状态响应数据 +type GetPurchaseOrderStatusRespData struct { + PurchaseOrderId string `json:"PurchaseOrderId"` + Status string `json:"Status"` // INIT、PROCESS、SUCCESS、FAIL、CLOSED +} + +// 采购单状态常量 +const ( + PurchaseOrderStatusInit = "INIT" + PurchaseOrderStatusProcess = "PROCESS" + PurchaseOrderStatusSuccess = "SUCCESS" + PurchaseOrderStatusFail = "FAIL" + PurchaseOrderStatusClosed = "CLOSED" +) + +// ============================================================ +// 接口16:GetOrder - 获取订单详情 +// ============================================================ + +// GetOrderReq 获取订单详情请求参数 +type GetOrderReq struct { + OrderId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId"` +} + +// GetOrderRespData 获取订单详情响应数据 +type GetOrderRespData struct { + OrderId string `json:"OrderId"` + PurchaseOrderId string `json:"PurchaseOrderId"` + PurchaserId string `json:"PurchaserId"` + ShopId string `json:"ShopId"` + OrderStatus string `json:"OrderStatus"` + TotalFee int64 `json:"TotalFee"` // 实付金额,单位分 + FreightFee int64 `json:"FreightFee"` // 运费,单位分 + ReceiverInfo ReceiverInfo `json:"ReceiverInfo"` + OrderItemList []OrderItem `json:"OrderItemList"` + CreateTime string `json:"CreateTime"` + PayTime string `json:"PayTime,omitempty"` + DeliveryTime string `json:"DeliveryTime,omitempty"` + ConfirmReceiveTime string `json:"ConfirmReceiveTime,omitempty"` +} + +// OrderItem 订单商品明细 +type OrderItem struct { + OrderItemId string `json:"OrderItemId"` + SkuId string `json:"SkuId"` + ProductId string `json:"ProductId"` + Title string `json:"Title"` + Quantity int64 `json:"Quantity"` + SalePrice int64 `json:"SalePrice"` + TotalFee int64 `json:"TotalFee"` + ItemStatus string `json:"ItemStatus"` +} + +// ============================================================ +// 接口17:QueryOrders - 查询订单列表 +// ============================================================ + +// QueryOrdersReq 查询订单列表请求参数 +type QueryOrdersReq struct { + PurchaserId string `json:"PurchaserId"` + PurchaseOrderId string `json:"PurchaseOrderId,omitempty"` + PageNum int `json:"PageNum,omitempty"` + PageSize int `json:"PageSize,omitempty"` + StartTime string `json:"StartTime,omitempty"` + EndTime string `json:"EndTime,omitempty"` +} + +// QueryOrdersRespData 查询订单列表响应数据 +type QueryOrdersRespData struct { + Total int64 `json:"Total"` + PageNum int `json:"PageNum"` + PageSize int `json:"PageSize"` + OrderList []GetOrderRespData `json:"OrderList"` +} + +// ============================================================ +// 接口18:ListLogisticsOrders - 查询订单物流信息 +// ============================================================ + +// ListLogisticsOrdersReq 查询订单物流信息请求参数 +type ListLogisticsOrdersReq struct { + OrderId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId"` +} + +// ListLogisticsOrdersRespData 查询订单物流信息响应数据 +type ListLogisticsOrdersRespData struct { + LogisticsList []LogisticsInfo `json:"LogisticsList"` +} + +// LogisticsInfo 物流信息 +type LogisticsInfo struct { + LogisticsCompany string `json:"LogisticsCompany"` + TrackingNumber string `json:"TrackingNumber"` + TrajectoryList []LogisticsTrace `json:"TrajectoryList"` +} + +// LogisticsTrace 物流轨迹 +type LogisticsTrace struct { + Time string `json:"Time"` + Content string `json:"Content"` + Location string `json:"Location,omitempty"` +} + +// ============================================================ +// 接口19:ConfirmDisburse - 确认收货 +// ============================================================ + +// ConfirmDisburseReq 确认收货请求参数 +type ConfirmDisburseReq struct { + OrderId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId"` +} + +// ============================================================ +// 接口20:RenderRefundOrder - 售后渲染预校验 +// ============================================================ + +// RenderRefundOrderReq 售后渲染预校验请求参数 +type RenderRefundOrderReq struct { + PurchaserId string `json:"PurchaserId"` + OrderId string `json:"OrderId"` + OrderItemId string `json:"OrderItemId"` + RefundQuantity int64 `json:"RefundQuantity"` + RefundType string `json:"RefundType"` // 仅退款/退货退款 +} + +// RenderRefundOrderRespData 售后渲染预校验响应数据 +type RenderRefundOrderRespData struct { + CanRefund bool `json:"CanRefund"` + RefundAmount int64 `json:"RefundAmount"` // 可退金额,单位分 + RefundQuantity int64 `json:"RefundQuantity"` // 可退数量 + RefundType string `json:"RefundType"` + Reason string `json:"Reason,omitempty"` +} + +// ============================================================ +// 接口21:CreateRefundOrder - 创建售后单 +// ============================================================ + +// CreateRefundOrderReq 创建售后单请求参数 +type CreateRefundOrderReq struct { + PurchaserId string `json:"PurchaserId"` + OrderId string `json:"OrderId"` + OrderItemId string `json:"OrderItemId"` + RefundQuantity int64 `json:"RefundQuantity"` + RefundAmount int64 `json:"RefundAmount"` // 单位分 + RefundType string `json:"RefundType"` + RefundReason string `json:"RefundReason"` + OuterRefundNo string `json:"OuterRefundNo"` // 外部售后单号,幂等 +} + +// CreateRefundOrderRespData 创建售后单响应数据 +type CreateRefundOrderRespData struct { + RefundOrderId string `json:"RefundOrderId"` +} + +// ============================================================ +// 接口22:CancelRefundOrder - 取消售后单 +// ============================================================ + +// CancelRefundOrderReq 取消售后单请求参数 +type CancelRefundOrderReq struct { + RefundOrderId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId"` +} + +// ============================================================ +// 接口23:GetRefundOrder - 获取售后单详情 +// ============================================================ + +// GetRefundOrderReq 获取售后单详情请求参数 +type GetRefundOrderReq struct { + RefundOrderId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId"` +} + +// GetRefundOrderRespData 获取售后单详情响应数据 +type GetRefundOrderRespData struct { + RefundOrderId string `json:"RefundOrderId"` + OrderId string `json:"OrderId"` + OrderItemId string `json:"OrderItemId"` + PurchaserId string `json:"PurchaserId"` + RefundAmount int64 `json:"RefundAmount"` + RefundQuantity int64 `json:"RefundQuantity"` + RefundType string `json:"RefundType"` + RefundReason string `json:"RefundReason"` + RefundStatus string `json:"RefundStatus"` + OuterRefundNo string `json:"OuterRefundNo"` + CreateTime string `json:"CreateTime"` +} + +// ============================================================ +// 接口24:CreateGoodsShippingNotice - 回填退货物流运单 +// ============================================================ + +// CreateGoodsShippingNoticeReq 回填退货物流运单请求参数 +type CreateGoodsShippingNoticeReq struct { + RefundOrderId string `json:"-"` // Path参数 + PurchaserId string `json:"PurchaserId"` + LogisticsCompany string `json:"LogisticsCompany"` + TrackingNumber string `json:"TrackingNumber"` +} + +// ============================================================ +// 接口25:QueryChildDivisionCode - 查询子区域编码 +// ============================================================ + +// QueryChildDivisionCodeReq 查询子区域编码请求参数 +type QueryChildDivisionCodeReq struct { + ParentDivisionCode string `json:"ParentDivisionCode,omitempty"` +} + +// QueryChildDivisionCodeRespData 查询子区域编码响应数据 +type QueryChildDivisionCodeRespData struct { + DivisionList []DivisionInfo `json:"DivisionList"` +} + +// DivisionInfo 区域信息 +type DivisionInfo struct { + DivisionCode string `json:"DivisionCode"` + DivisionName string `json:"DivisionName"` + Level int `json:"Level"` + ParentCode string `json:"ParentCode,omitempty"` +} + +// ============================================================ +// 回调通知结构体 +// ============================================================ + +// CallbackMessage 回调通知消息体 +type CallbackMessage struct { + EventCode string `json:"EventCode"` + PurchaseOrderId string `json:"PurchaseOrderId"` + OrderIdList []string `json:"OrderIdList"` + Status string `json:"Status"` + RequestId string `json:"RequestId"` +} + +// 事件码常量 +const ( + EventCodePurchaseOrderChange = "PURCHASE_ORDER_CHANGE" + EventCodeOrderStatusChange = "ORDER_STATUS_CHANGE" + EventCodeRefundOrderChange = "REFUND_ORDER_CHANGE" +) + +// CallbackResponse 回调响应,告知阿里云消费成功 +type CallbackResponse struct { + Success bool `json:"success"` +} \ No newline at end of file