From 06140f25302dfe44cb5bdd9c98b04654b9dd1b96 Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Fri, 28 Aug 2026 09:34:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6:=20sdk=5FL?= =?UTF-8?q?inkedMall/types.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk_LinkedMall/types.go | 533 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 533 insertions(+) create mode 100644 sdk_LinkedMall/types.go diff --git a/sdk_LinkedMall/types.go b/sdk_LinkedMall/types.go new file mode 100644 index 0000000..cfdcf60 --- /dev/null +++ b/sdk_LinkedMall/types.go @@ -0,0 +1,533 @@ +package sdk_LinkedMall + +import "encoding/json" + +// ============================================================ +// 公共响应结构体 +// ============================================================ + +// CommonResponse 是所有接口返回的统一外层包装 +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 json.RawMessage `json:"Data"` +} + +// ============================================================ +// 采购方店铺 (Purchaser Shop) +// ============================================================ + +// ListPurchaserShopsReq 分页获取采购方店铺列表的请求参数(Query) +type ListPurchaserShopsReq struct { + PageNum int `json:"PageNum,omitempty"` // 页码,默认1 + PageSize int `json:"PageSize,omitempty"` // 每页条数,最大100 +} + +// ListPurchaserShopsRespData 分页获取采购方店铺列表的响应Data +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"` +} + +// GetPurchaserShopRespData 获取单个采购店铺详情的响应Data +type GetPurchaserShopRespData struct { + ShopId string `json:"ShopId"` + PurchaserId string `json:"PurchaserId"` + ShopName string `json:"ShopName"` + ShopStatus string `json:"ShopStatus"` + ContactInfo string `json:"ContactInfo"` +} + +// ============================================================ +// 选品池商品 (Selection Product) +// ============================================================ + +// ListSelectionProductsReq 分页查询选品池商品列表的请求参数(Query) +type ListSelectionProductsReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID,必填 + PageNum int `json:"PageNum,omitempty"` // 页码 + PageSize int `json:"PageSize,omitempty"` // 每页条数,最大100 +} + +// ListSelectionProductsRespData 分页查询选品池商品列表的响应Data +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"` +} + +// GetSelectionProductRespData 查询选品池商品详情的响应Data +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"` // 传入divisionCode才有效,该区域是否可售 + 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"` // 库存数量 +} + +// GetSelectionProductSaleInfoRespData 查询选品池商品销售信息的响应Data +type GetSelectionProductSaleInfoRespData struct { + CanSale bool `json:"CanSale"` + StockQuantity int64 `json:"StockQuantity"` + SkuList []SelectionSkuItem `json:"SkuList"` +} + +// ListSelectionProductSaleInfosReq 批量查询商品销售信息的请求Body +type ListSelectionProductSaleInfosReq struct { + PurchaserId string `json:"PurchaserId"` + ProductIdList []string `json:"ProductIdList"` + DivisionCode string `json:"DivisionCode,omitempty"` +} + +// ProductSaleInfo 商品销售信息 +type ProductSaleInfo struct { + ProductId string `json:"ProductId"` + CanSale bool `json:"CanSale"` + StockQuantity int64 `json:"StockQuantity"` + SkuList []SelectionSkuItem `json:"SkuList"` +} + +// ListSelectionProductSaleInfosRespData 批量查询商品销售信息的响应Data +type ListSelectionProductSaleInfosRespData struct { + ProductSaleInfoList []ProductSaleInfo `json:"ProductSaleInfoList"` +} + +// ListSelectionSkuSaleInfosReq 批量查询SKU销售信息的请求Body +type ListSelectionSkuSaleInfosReq struct { + PurchaserId string `json:"PurchaserId"` + SkuIdList []string `json:"SkuIdList"` + DivisionCode string `json:"DivisionCode,omitempty"` +} + +// SkuSaleInfo SKU销售信息 +type SkuSaleInfo struct { + SkuId string `json:"SkuId"` + SalePrice int64 `json:"SalePrice"` + MarketPrice int64 `json:"MarketPrice"` + StockQuantity int64 `json:"StockQuantity"` + CanSale bool `json:"CanSale"` +} + +// ListSelectionSkuSaleInfosRespData 批量查询SKU销售信息的响应Data +type ListSelectionSkuSaleInfosRespData struct { + SkuSaleInfoList []SkuSaleInfo `json:"SkuSaleInfoList"` +} + +// SearchProductsReq 搜索选品池商品的请求Body +type SearchProductsReq struct { + Keyword string `json:"Keyword,omitempty"` // 关键词 + CategoryId string `json:"CategoryId,omitempty"` // 类目ID + PageNum int `json:"PageNum,omitempty"` // 页码 + PageSize int `json:"PageSize,omitempty"` // 每页条数 + PurchaserId string `json:"PurchaserId"` // 采购方ID,必填 +} + +// SearchProductsRespData 搜索选品池商品的响应Data +type SearchProductsRespData struct { + Total int64 `json:"Total"` + PageNum int `json:"PageNum"` + PageSize int `json:"PageSize"` + ProductList []SelectionProductItem `json:"ProductList"` +} + +// ============================================================ +// 类目 (Category) +// ============================================================ + +// ListCategoriesReq 查询类目列表的请求参数(Query) +type ListCategoriesReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID,必填 + ParentCategoryId string `json:"ParentCategoryId,omitempty"` // 父类目ID,不传查一级类目 +} + +// CategoryItem 类目信息 +type CategoryItem struct { + CategoryId string `json:"CategoryId"` + CategoryName string `json:"CategoryName"` + ParentId string `json:"ParentId"` + Level int `json:"Level"` +} + +// ListCategoriesRespData 查询类目列表的响应Data +type ListCategoriesRespData struct { + CategoryList []CategoryItem `json:"CategoryList"` +} + +// ============================================================ +// 选品池入库/出库 (Selection Group) +// ============================================================ + +// SelectionGroupAddProductReq 选品池商品入库请求Body +type SelectionGroupAddProductReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID,必填 + ShopId string `json:"ShopId"` // 店铺ID,必填 + ProductIdList []string `json:"ProductIdList"` // 商品ID列表,必填 +} + +// SelectionGroupRemoveProductReq 选品池商品出库请求Body +type SelectionGroupRemoveProductReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID,必填 + ShopId string `json:"ShopId"` // 店铺ID,必填 + ProductIdList []string `json:"ProductIdList"` // 商品ID列表,必填 +} + +// ============================================================ +// 采购单 (Purchase Order) +// ============================================================ + +// RenderPurchaseOrderReq 采购单渲染请求Body +type RenderPurchaseOrderReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID + ShopId string `json:"ShopId"` // 店铺ID + DivisionCode string `json:"DivisionCode"` // 五级乡镇编码 + ItemList []RenderOrderItem `json:"ItemList"` // 商品列表 + ReceiverInfo ReceiverInfo `json:"ReceiverInfo"` // 收货人信息 +} + +// RenderOrderItem 渲染采购单的商品条目 +type RenderOrderItem struct { + SkuId string `json:"SkuId"` // SKU ID + 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 采购单渲染的响应Data +type RenderPurchaseOrderRespData struct { + TotalAmount int64 `json:"TotalAmount"` // 总金额,单位分 + TotalFreight int64 `json:"TotalFreight"` // 总运费,单位分 + ItemValidResult []ItemValidResultItem `json:"ItemValidResult"` // 商品校验结果 + RenderItemList []RenderOrderItemResult `json:"RenderItemList"` // 渲染后的商品列表 +} + +// ItemValidResultItem 商品校验结果 +type ItemValidResultItem struct { + SkuId string `json:"SkuId"` + Valid bool `json:"Valid"` // 是否有效 + Reason string `json:"Reason"` // 不可售原因 +} + +// RenderOrderItemResult 渲染后的商品条目 +type RenderOrderItemResult struct { + SkuId string `json:"SkuId"` + SalePrice int64 `json:"SalePrice"` // 实时售价,单位分 + Quantity int64 `json:"Quantity"` + SubTotal int64 `json:"SubTotal"` // 小计,单位分 +} + +// SplitPurchaseOrderReq 采购单渲染并拆单的请求Body(与RenderPurchaseOrderReq结构一致) +type SplitPurchaseOrderReq = RenderPurchaseOrderReq + +// SplitOrderItem 拆单后的子单 +type SplitOrderItem struct { + SubOrderId string `json:"SubOrderId"` // 子单ID + SkuId string `json:"SkuId"` + Quantity int64 `json:"Quantity"` + SalePrice int64 `json:"SalePrice"` // 单位分 + SubTotal int64 `json:"SubTotal"` // 单位分 + Freight int64 `json:"Freight"` // 运费,单位分 +} + +// SplitPurchaseOrderRespData 采购单渲染并拆单的响应Data +type SplitPurchaseOrderRespData struct { + TotalAmount int64 `json:"TotalAmount"` // 总金额,单位分 + TotalFreight int64 `json:"TotalFreight"` // 总运费,单位分 + SubOrderList []SplitOrderItem `json:"SubOrderList"` // 子单列表 +} + +// CreatePurchaseOrderReq 创建采购单请求Body +type CreatePurchaseOrderReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID + ShopId string `json:"ShopId"` // 店铺ID + 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 创建采购单的响应Data +type CreatePurchaseOrderRespData struct { + PurchaseOrderId string `json:"PurchaseOrderId"` // 阿里云采购单号 +} + +// GetPurchaseOrderStatusReq 获取采购单状态的请求参数(Query + Path) +type GetPurchaseOrderStatusReq struct { + PurchaseOrderId string `json:"-"` // 采购单ID,Path参数 + PurchaserId string `json:"PurchaserId"` // 采购方ID,Query参数 +} + +// GetPurchaseOrderStatusRespData 获取采购单状态的响应Data +type GetPurchaseOrderStatusRespData struct { + PurchaseOrderId string `json:"PurchaseOrderId"` + Status string `json:"Status"` // INIT / PROCESS / SUCCESS / FAIL / CLOSED +} + +// ============================================================ +// 订单 (Order) +// ============================================================ + +// GetOrderReq 获取订单详情的请求参数 +type GetOrderReq struct { + OrderId string `json:"-"` // 订单ID,Path参数 + PurchaserId string `json:"PurchaserId"` // 采购方ID,Query参数 +} + +// GetOrderRespData 获取订单详情的响应Data +type GetOrderRespData struct { + OrderId string `json:"OrderId"` + PurchaseOrderId string `json:"PurchaseOrderId"` + PurchaserId string `json:"PurchaserId"` + ShopId string `json:"ShopId"` + OrderStatus string `json:"OrderStatus"` + TotalAmount int64 `json:"TotalAmount"` // 实付金额,单位分 + TotalFreight int64 `json:"TotalFreight"` // 运费,单位分 + ReceiverInfo ReceiverInfo `json:"ReceiverInfo"` + OrderItemList []OrderItemDetail `json:"OrderItemList"` + CreateTime string `json:"CreateTime"` + PayTime string `json:"PayTime"` +} + +// OrderItemDetail 订单商品明细 +type OrderItemDetail struct { + OrderItemId string `json:"OrderItemId"` + SkuId string `json:"SkuId"` + ProductId string `json:"ProductId"` + ProductName string `json:"ProductName"` + Quantity int64 `json:"Quantity"` + SalePrice int64 `json:"SalePrice"` // 单位分 + SubTotal int64 `json:"SubTotal"` // 单位分 + ItemStatus string `json:"ItemStatus"` + RefundQuantity int64 `json:"RefundQuantity"` +} + +// QueryOrdersReq 查询订单列表的请求参数(Query) +type QueryOrdersReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID,必填 + PurchaseOrderId string `json:"PurchaseOrderId,omitempty"` // 采购单ID + PageNum int `json:"PageNum,omitempty"` // 页码 + PageSize int `json:"PageSize,omitempty"` // 每页条数 + StartTime string `json:"StartTime,omitempty"` // 开始时间 + EndTime string `json:"EndTime,omitempty"` // 结束时间 +} + +// QueryOrdersRespData 查询订单列表的响应Data +type QueryOrdersRespData struct { + Total int64 `json:"Total"` + PageNum int `json:"PageNum"` + PageSize int `json:"PageSize"` + OrderList []OrderSummaryItem `json:"OrderList"` +} + +// OrderSummaryItem 订单摘要信息 +type OrderSummaryItem struct { + OrderId string `json:"OrderId"` + PurchaseOrderId string `json:"PurchaseOrderId"` + OrderStatus string `json:"OrderStatus"` + TotalAmount int64 `json:"TotalAmount"` // 单位分 + CreateTime string `json:"CreateTime"` + PayTime string `json:"PayTime"` +} + +// ============================================================ +// 物流 (Logistics) +// ============================================================ + +// ListLogisticsOrdersReq 查询订单物流信息的请求参数 +type ListLogisticsOrdersReq struct { + OrderId string `json:"-"` // 订单ID,Path参数 + PurchaserId string `json:"PurchaserId"` // 采购方ID,Query参数 +} + +// ListLogisticsOrdersRespData 查询订单物流信息的响应Data +type ListLogisticsOrdersRespData struct { + LogisticsList []LogisticsInfo `json:"LogisticsList"` +} + +// LogisticsInfo 物流信息 +type LogisticsInfo struct { + LogisticsCompany string `json:"LogisticsCompany"` // 物流公司 + TrackingNumber string `json:"TrackingNumber"` // 运单号 + Traces []LogisticsTrace `json:"Traces"` // 物流轨迹 +} + +// LogisticsTrace 物流轨迹 +type LogisticsTrace struct { + Time string `json:"Time"` // 轨迹时间 + Location string `json:"Location"` // 轨迹地点 + Action string `json:"Action"` // 轨迹描述 +} + +// ============================================================ +// 确认收货 (Confirm Disburse) +// ============================================================ + +// ConfirmDisburseReq 确认收货的请求Body +type ConfirmDisburseReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID +} + +// ============================================================ +// 售后单 (Refund Order) +// ============================================================ + +// RenderRefundOrderReq 售后渲染预校验的请求Body +type RenderRefundOrderReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID + OrderId string `json:"OrderId"` // 订单ID + OrderItemId string `json:"OrderItemId"` // 订单商品明细ID + RefundQuantity int64 `json:"RefundQuantity"` // 退款数量 + RefundType string `json:"RefundType"` // 退款类型(仅退款/退货退款) +} + +// RenderRefundOrderRespData 售后渲染预校验的响应Data +type RenderRefundOrderRespData struct { + Valid bool `json:"Valid"` // 是否可售后 + MaxRefundQuantity int64 `json:"MaxRefundQuantity"` // 最大可退数量 + MaxRefundAmount int64 `json:"MaxRefundAmount"` // 最大可退金额,单位分 + RefundReason string `json:"RefundReason"` // 不可售原因 +} + +// CreateRefundOrderReq 创建售后单的请求Body +type CreateRefundOrderReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID + OrderId string `json:"OrderId"` // 订单ID + OrderItemId string `json:"OrderItemId"` // 订单商品明细ID + RefundQuantity int64 `json:"RefundQuantity"` // 退款数量 + RefundAmount int64 `json:"RefundAmount"` // 退款金额,单位分 + RefundType string `json:"RefundType"` // 退款类型 + RefundReason string `json:"RefundReason"` // 退款原因 + OuterRefundNo string `json:"OuterRefundNo"` // 外部售后单号 +} + +// CreateRefundOrderRespData 创建售后单的响应Data +type CreateRefundOrderRespData struct { + RefundOrderId string `json:"RefundOrderId"` // 售后单ID +} + +// CancelRefundOrderReq 取消售后单的请求Body +type CancelRefundOrderReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID +} + +// CancelRefundOrderRespData 取消售后单的响应Data +type CancelRefundOrderRespData struct { + RefundOrderId string `json:"RefundOrderId"` + Status string `json:"Status"` +} + +// GetRefundOrderReq 获取售后单详情的请求参数 +type GetRefundOrderReq struct { + RefundOrderId string `json:"-"` // 售后单ID,Path参数 + PurchaserId string `json:"PurchaserId"` // 采购方ID,Query参数 +} + +// GetRefundOrderRespData 获取售后单详情的响应Data +type GetRefundOrderRespData struct { + RefundOrderId string `json:"RefundOrderId"` + OrderId string `json:"OrderId"` + OrderItemId string `json:"OrderItemId"` + PurchaserId string `json:"PurchaserId"` + RefundType string `json:"RefundType"` + RefundStatus string `json:"RefundStatus"` + RefundQuantity int64 `json:"RefundQuantity"` + RefundAmount int64 `json:"RefundAmount"` // 单位分 + RefundReason string `json:"RefundReason"` + OuterRefundNo string `json:"OuterRefundNo"` + CreateTime string `json:"CreateTime"` +} + +// CreateGoodsShippingNoticeReq 回填退货物流运单的请求Body +type CreateGoodsShippingNoticeReq struct { + PurchaserId string `json:"PurchaserId"` // 采购方ID + LogisticsCompany string `json:"LogisticsCompany"` // 物流公司 + TrackingNumber string `json:"TrackingNumber"` // 运单号 +} + +// CreateGoodsShippingNoticeRespData 回填退货物流运单的响应Data +type CreateGoodsShippingNoticeRespData struct { + Result bool `json:"Result"` +} + +// ============================================================ +// 区域编码 (Division Code) +// ============================================================ + +// QueryChildDivisionCodeReq 查询子区域编码的请求参数(Query) +type QueryChildDivisionCodeReq struct { + ParentDivisionCode string `json:"ParentDivisionCode,omitempty"` // 父区域编码,不传返回省级 +} + +// DivisionInfo 区域编码信息 +type DivisionInfo struct { + DivisionCode string `json:"DivisionCode"` // 区域编码 + DivisionName string `json:"DivisionName"` // 区域名称 + Level int `json:"Level"` // 层级:1-省,2-市,3-区,4-乡镇 + ParentCode string `json:"ParentCode"` // 父区域编码 +} + +// QueryChildDivisionCodeRespData 查询子区域编码的响应Data +type QueryChildDivisionCodeRespData struct { + DivisionList []DivisionInfo `json:"DivisionList"` +} + +// ============================================================ +// 通用操作响应 +// ============================================================ + +// OperationRespData 通用操作响应Data(入库/出库/确认收货等) +type OperationRespData struct { + Result bool `json:"Result"` +} \ No newline at end of file