sdk_LinkedMall-20260828161641/types.go

519 lines
17 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package sdk_LinkedMall
import "encoding/json"
// CommonResponse 是所有接口统一返回的外层结构体。
//
// 注意HTTP 200 不代表业务成功,必须判断 Success 字段是否为 true。
// Code 为 SUCCESS 表示业务调用成功;否则看 SubCode、SubMessage 定位失败原因。
// Data 为业务数据,不同接口 Data 内部结构不同,可配合各接口的响应数据类型使用,
// 或调用 DataAs 方法解码到目标结构体。
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"`
}
// DataAs 将 Data 字段解码到目标结构体 out 中。
func (r *CommonResponse) DataAs(out interface{}) error {
if r == nil || r.Data == nil {
return nil
}
b, err := json.Marshal(r.Data)
if err != nil {
return err
}
return json.Unmarshal(b, out)
}
// rawResponse 用于内部解析响应Data 使用 json.RawMessage 以支持按接口类型解码。
type rawResponse 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"`
}
// ---------- 采购方店铺 ----------
// ListPurchaserShopsRequest 分页获取采购方店铺列表请求。
type ListPurchaserShopsRequest struct {
PageNum int `json:"PageNum"`
PageSize int `json:"PageSize"`
}
// 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"`
}
// GetPurchaserShopRequest 获取单个采购店铺详情请求。
type GetPurchaserShopRequest struct {
ShopId string `json:"-"`
}
// GetPurchaserShopRespData 获取单个采购店铺详情响应数据。
type GetPurchaserShopRespData struct {
ShopId string `json:"ShopId"`
PurchaserId string `json:"PurchaserId"`
ShopName string `json:"ShopName"`
ShopStatus string `json:"ShopStatus"`
ContactInfo string `json:"ContactInfo"`
}
// ---------- 选品池商品 ----------
// ListSelectionProductsRequest 分页查询选品池商品列表请求。
type ListSelectionProductsRequest struct {
PageNum int `json:"PageNum"`
PageSize int `json:"PageSize"`
PurchaserId string `json:"PurchaserId"`
}
// 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"`
}
// GetSelectionProductRequest 查询选品池商品详情请求。
type GetSelectionProductRequest struct {
ProductId string `json:"-"`
PurchaserId string `json:"PurchaserId"`
DivisionCode string `json:"DivisionCode"`
}
// 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"`
}
// ---------- 类目 ----------
// ListCategoriesRequest 查询类目列表请求。
type ListCategoriesRequest struct {
PurchaserId string `json:"PurchaserId"`
ParentCategoryId string `json:"ParentCategoryId"`
}
// 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"`
Leaf bool `json:"Leaf"`
}
// ---------- 搜索 ----------
// SearchProductsRequest 搜索选品池商品请求。
type SearchProductsRequest struct {
Keyword string `json:"Keyword"`
CategoryId string `json:"CategoryId"`
PageNum int `json:"PageNum"`
PageSize int `json:"PageSize"`
PurchaserId string `json:"PurchaserId"`
}
// SearchProductsRespData 搜索选品池商品响应数据。
type SearchProductsRespData struct {
Total int64 `json:"Total"`
PageNum int `json:"PageNum"`
PageSize int `json:"PageSize"`
ProductList []SelectionProductItem `json:"ProductList"`
}
// ---------- 选品池入库/出库 ----------
// SelectionGroupAddProductRequest 选品池商品入库请求。
type SelectionGroupAddProductRequest struct {
PurchaserId string `json:"PurchaserId"`
ShopId string `json:"ShopId"`
ProductIdList []string `json:"ProductIdList"`
}
// SelectionGroupRemoveProductRequest 选品池商品出库请求。
type SelectionGroupRemoveProductRequest struct {
PurchaserId string `json:"PurchaserId"`
ShopId string `json:"ShopId"`
ProductIdList []string `json:"ProductIdList"`
}
// SelectionGroupChangeProductRespData 选品池商品入库/出库响应数据。
type SelectionGroupChangeProductRespData struct {
SuccessCount int `json:"SuccessCount"`
}
// ---------- 采购单渲染 ----------
// RenderPurchaseOrderReq 采购单渲染(下单预校验)请求。
// SplitPurchaseOrder 请求体结构与之一致。
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 收货人信息。DivisionCode 必须使用五级(乡镇街道)编码。
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 {
CanSale bool `json:"CanSale"`
UnSaleReason string `json:"UnSaleReason"`
TotalAmount int64 `json:"TotalAmount"`
FreightAmount int64 `json:"FreightAmount"`
ItemList []RenderResultItem `json:"ItemList"`
}
// RenderResultItem 渲染结果中的商品明细。
type RenderResultItem struct {
SkuId string `json:"SkuId"`
ProductId string `json:"ProductId"`
Quantity int64 `json:"Quantity"`
SalePrice int64 `json:"SalePrice"`
CanSale bool `json:"CanSale"`
UnSaleReason string `json:"UnSaleReason"`
}
// ---------- 拆单 ----------
// SplitPurchaseOrderRespData 采购单渲染并拆单响应数据。
type SplitPurchaseOrderRespData struct {
SubOrderList []SplitSubOrderItem `json:"SubOrderList"`
}
// SplitSubOrderItem 拆单后的子单商品项。
type SplitSubOrderItem struct {
ShopId string `json:"ShopId"`
SkuId string `json:"SkuId"`
Quantity int64 `json:"Quantity"`
SalePrice int64 `json:"SalePrice"`
}
// ---------- 创建采购单 ----------
// 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"`
}
// 采购单状态枚举。
const (
PurchaseOrderStatusInit = "INIT"
PurchaseOrderStatusProcess = "PROCESS"
PurchaseOrderStatusSuccess = "SUCCESS"
PurchaseOrderStatusFail = "FAIL"
PurchaseOrderStatusClosed = "CLOSED"
)
// GetPurchaseOrderStatusRequest 获取采购单状态请求。
type GetPurchaseOrderStatusRequest struct {
PurchaseOrderId string `json:"-"`
PurchaserId string `json:"PurchaserId"`
}
// GetPurchaseOrderStatusRespData 获取采购单状态响应数据。
type GetPurchaseOrderStatusRespData struct {
PurchaseOrderId string `json:"PurchaseOrderId"`
Status string `json:"Status"`
OrderIdList []string `json:"OrderIdList"`
}
// ---------- 订单 ----------
// GetOrderRequest 获取订单详情请求。
type GetOrderRequest struct {
OrderId string `json:"-"`
PurchaserId string `json:"PurchaserId"`
}
// GetOrderRespData 获取订单详情响应数据。
type GetOrderRespData struct {
OrderId string `json:"OrderId"`
PurchaseOrderId string `json:"PurchaseOrderId"`
Status string `json:"Status"`
TotalAmount int64 `json:"TotalAmount"`
PayAmount int64 `json:"PayAmount"`
FreightAmount int64 `json:"FreightAmount"`
CreateTime string `json:"CreateTime"`
ItemList []OrderItem `json:"ItemList"`
ReceiverInfo OrderReceiverInfo `json:"ReceiverInfo"`
}
// OrderItem 订单商品明细。
type OrderItem struct {
OrderItemId string `json:"OrderItemId"`
ProductId string `json:"ProductId"`
SkuId string `json:"SkuId"`
SkuSpec string `json:"SkuSpec"`
Title string `json:"Title"`
Quantity int64 `json:"Quantity"`
PayAmount int64 `json:"PayAmount"`
}
// OrderReceiverInfo 订单收货信息。
type OrderReceiverInfo 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"`
}
// QueryOrdersRequest 查询订单列表请求。
type QueryOrdersRequest struct {
PurchaserId string `json:"PurchaserId"`
PurchaseOrderId string `json:"PurchaseOrderId"`
PageNum int `json:"PageNum"`
PageSize int `json:"PageSize"`
StartTime string `json:"StartTime"`
EndTime string `json:"EndTime"`
}
// QueryOrdersRespData 查询订单列表响应数据。
type QueryOrdersRespData struct {
Total int64 `json:"Total"`
PageNum int `json:"PageNum"`
PageSize int `json:"PageSize"`
OrderList []OrderSummary `json:"OrderList"`
}
// OrderSummary 订单列表项。
type OrderSummary struct {
OrderId string `json:"OrderId"`
Status string `json:"Status"`
PayAmount int64 `json:"PayAmount"`
CreateTime string `json:"CreateTime"`
}
// ---------- 物流 ----------
// ListLogisticsOrdersRequest 查询订单物流信息请求。
type ListLogisticsOrdersRequest struct {
OrderId string `json:"-"`
PurchaserId string `json:"PurchaserId"`
}
// ListLogisticsOrdersRespData 查询订单物流信息响应数据。
type ListLogisticsOrdersRespData struct {
LogisticsList []LogisticsInfo `json:"LogisticsList"`
}
// LogisticsInfo 物流信息。
type LogisticsInfo struct {
TrackingNumber string `json:"TrackingNumber"`
CompanyName string `json:"CompanyName"`
Traces []LogisticsTrace `json:"Traces"`
}
// LogisticsTrace 物流轨迹节点。
type LogisticsTrace struct {
Time string `json:"Time"`
Location string `json:"Location"`
Description string `json:"Description"`
}
// ---------- 确认收货 ----------
// ConfirmDisburseRequest 确认收货请求。
type ConfirmDisburseRequest struct {
OrderId string `json:"-"`
PurchaserId string `json:"PurchaserId"`
}
// ---------- 售后 ----------
// 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"`
MaxRefundQuantity int64 `json:"MaxRefundQuantity"`
UnRefundReason string `json:"UnRefundReason"`
}
// 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"`
}
// CancelRefundOrderRequest 取消售后单请求。
type CancelRefundOrderRequest struct {
RefundOrderId string `json:"-"`
PurchaserId string `json:"PurchaserId"`
}
// GetRefundOrderRequest 获取售后单详情请求。
type GetRefundOrderRequest struct {
RefundOrderId string `json:"-"`
PurchaserId string `json:"PurchaserId"`
}
// GetRefundOrderRespData 获取售后单详情响应数据。
type GetRefundOrderRespData struct {
RefundOrderId string `json:"RefundOrderId"`
OrderId string `json:"OrderId"`
OrderItemId string `json:"OrderItemId"`
Status string `json:"Status"`
RefundQuantity int64 `json:"RefundQuantity"`
RefundAmount int64 `json:"RefundAmount"`
RefundType string `json:"RefundType"`
RefundReason string `json:"RefundReason"`
}
// CreateGoodsShippingNoticeReq 回填退货物流运单请求。
type CreateGoodsShippingNoticeReq struct {
PurchaserId string `json:"PurchaserId"`
LogisticsCompany string `json:"LogisticsCompany"`
TrackingNumber string `json:"TrackingNumber"`
}
// ---------- 区域 ----------
// QueryChildDivisionCodeRequest 查询子区域编码请求。
type QueryChildDivisionCodeRequest struct {
ParentDivisionCode string `json:"ParentDivisionCode"`
}
// QueryChildDivisionCodeRespData 查询子区域编码响应数据。
type QueryChildDivisionCodeRespData struct {
DivisionList []DivisionItem `json:"DivisionList"`
}
// DivisionItem 区域编码项。
type DivisionItem struct {
DivisionCode string `json:"DivisionCode"`
DivisionName string `json:"DivisionName"`
Level int `json:"Level"`
ParentCode string `json:"ParentCode"`
}
// ---------- 回调通知 ----------
// CallbackEvent 阿里云消息回调事件。
// 业务侧消费成功后需返回 {"success":true},否则阿里云会重试推送。
type CallbackEvent 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"
)
```
```go