提交 cb0eaddd authored 作者: 屈传平's avatar 屈传平

wandian

上级 d50d8663
......@@ -23,6 +23,7 @@ const (
Tmv3 = 20 //天猫优选
Suning = 21 //苏宁有货
Yonghui = 22 //永辉
Wandian = 24 //万店通
)
var (
......@@ -116,6 +117,10 @@ func GetUpstreamList() (res interface{}, err error) {
"key": Yonghui,
"name": GetUpstreamName(Yonghui),
},
g.Map{
"key": Wandian,
"name": GetUpstreamName(Wandian),
},
}
return
}
......@@ -158,6 +163,8 @@ func GetUpstreamName(source int) string {
return "苏宁易购"
case Yonghui:
return "永辉"
case Wandian:
return "万店通"
default:
return "未知来源"
}
......
package wandian
import (
"context"
"crypto/md5"
"encoding/hex"
"fmt"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/util/gconv"
"net/url"
"sort"
"strings"
"time"
"unicode/utf8"
)
var server *Config
//万店
const pkgName = "wandian"
type Config struct {
Sid string
Appkey string
AppSecret string
ApiUrl string
}
func New(req *Config) {
server = req
return
}
func packData(req map[string]interface{}) string {
// 1. 提取并排序键名
keys := make([]string, 0, len(req))
for k := range req {
if k == "sign" {
continue
}
keys = append(keys, k)
}
sort.Strings(keys)
// 2. 使用 strings.Builder 高效拼接字符串
var builder strings.Builder
// 3. 遍历排序后的键
for i, key := range keys {
val := req[key]
// 非首个元素时添加分隔符
if i > 0 {
builder.WriteString(";")
}
// 4. 处理键部分
keyLen := utf8.RuneCountInString(key)
builder.WriteString(fmt.Sprintf("%02d-", keyLen))
builder.WriteString(key)
builder.WriteString(":")
// 5. 处理值部分
valLen := utf8.RuneCountInString(gconv.String(val))
builder.WriteString(fmt.Sprintf("%04d-", valLen))
builder.WriteString(gconv.String(val))
}
return builder.String()
}
// 带错误处理的增强版本
func makeSignSecure(req map[string]interface{}, appSecret string) map[string]interface{} {
data := packData(req)
if data == "" {
return req
}
combined := data + appSecret
hash := md5.Sum([]byte(combined))
req["sign"] = hex.EncodeToString(hash[:])
return req
}
//除空数组
func deleteZeroValues(req map[string]interface{}) map[string]interface{} {
param := g.Map{}
for k, v := range req {
if gconv.String(v) != "" {
param[k] = v
}
}
return param
}
func post(ctx context.Context, method string, req interface{}) (res string, err error) {
Start := gtime.TimestampMilli()
reqMap := gconv.Map(req)
reqMap["sid"] = server.Sid
reqMap["appkey"] = server.Appkey
reqMap["timestamp"] = time.Now().Unix()
reqMap = deleteZeroValues(reqMap)
reqMap = makeSignSecure(reqMap, server.AppSecret)
param := gjson.New(reqMap)
Url := server.ApiUrl + method
Request := g.Client()
Request.SetHeader("Content-Type", "application/x-www-form-urlencoded")
Request.SetHeader("Content-length", fmt.Sprintf("%d", len(param.MustToJsonString())))
postData := url.Values{}
for k, v := range param.Map() {
postData.Add(k, gconv.String(v))
}
encoded := postData.Encode()
resp, err := Request.Timeout(time.Second*10).Post(Url, encoded)
defer func() {
_ = resp.Close()
ctx = context.WithValue(ctx, "Method", "POST")
ctx = context.WithValue(ctx, "URI", Url)
if err != nil {
g.Log().Ctx(ctx).Cat(pkgName).Cat("error").Infof("参数【%v】错误【%v】响应时间【%v ms】", param.MustToJsonString(), err.Error(), gtime.TimestampMilli()-Start)
} else {
g.Log().Ctx(ctx).Cat(pkgName).Infof("参数【%v】响应【%v】响应时间【%v ms】", param.MustToJsonString(), res, gtime.TimestampMilli()-Start)
}
}()
res = resp.ReadAllString()
return
}
package wandian
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
var Goods = new(goods)
type goods struct {
}
type GoodsListReq struct {
SpecNo string `json:"spec_no"`
GoodsNo string `json:"goods_no"`
BrandNo string `json:"brand_no"`
ClassName string `json:"class_name"`
Barcode string `json:"barcode"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
PageSize string `json:"page_size"`
PageNo string `json:"page_no"`
}
type GoodsListRes struct {
Code int `json:"code"`
Message string `json:"message"`
TotalCount string `json:"total_count"`
GoodsList []struct {
GoodsId string `json:"goods_id"`
GoodsNo string `json:"goods_no"`
GoodsName string `json:"goods_name"`
ShortName string `json:"short_name"`
Alias string `json:"alias"`
GoodsType string `json:"goods_type"`
SpecCount string `json:"spec_count"`
Pinyin string `json:"pinyin"`
BrandNo string `json:"brand_no"`
BrandName string `json:"brand_name"`
Remark string `json:"remark"`
Prop1 string `json:"prop1"`
Prop2 string `json:"prop2"`
Prop3 string `json:"prop3"`
Prop4 string `json:"prop4"`
Prop5 string `json:"prop5"`
Prop6 string `json:"prop6"`
Origin string `json:"origin"`
ClassName string `json:"class_name"`
ClassId string `json:"class_id"`
UnitName interface{} `json:"unit_name"`
AuxUnitName interface{} `json:"aux_unit_name"`
FlagName interface{} `json:"flag_name"`
GoodsCreated string `json:"goods_created"`
GoodsModified string `json:"goods_modified"`
SpecList []struct {
SpecId string `json:"spec_id"`
GoodsId string `json:"goods_id"`
SpecNo string `json:"spec_no"`
SpecCode string `json:"spec_code"`
Barcode string `json:"barcode"`
SpecName string `json:"spec_name"`
LowestPrice string `json:"lowest_price"`
RetailPrice string `json:"retail_price"`
WholesalePrice string `json:"wholesale_price"`
MemberPrice string `json:"member_price"`
MarketPrice string `json:"market_price"`
CustomPrice1 string `json:"custom_price1"`
CustomPrice2 string `json:"custom_price2"`
SaleScore string `json:"sale_score"`
PackScore string `json:"pack_score"`
PickScore string `json:"pick_score"`
ValidityDays string `json:"validity_days"`
SalesDays string `json:"sales_days"`
ReceiveDays string `json:"receive_days"`
Weight string `json:"weight"`
Length string `json:"length"`
Width string `json:"width"`
Height string `json:"height"`
IsSnEnable string `json:"is_sn_enable"`
IsAllowNegStock string `json:"is_allow_neg_stock"`
IsNotNeedExamine string `json:"is_not_need_examine"`
IsZeroCost string `json:"is_zero_cost"`
IsLowerCost string `json:"is_lower_cost"`
IsNotUseAir string `json:"is_not_use_air"`
TaxRate string `json:"tax_rate"`
LargeType string `json:"large_type"`
Remark string `json:"remark"`
SpecCreated string `json:"spec_created"`
SpecModified string `json:"spec_modified"`
Prop1 string `json:"prop1"`
Prop2 string `json:"prop2"`
Prop3 string `json:"prop3"`
Prop4 string `json:"prop4"`
Prop5 string `json:"prop5"`
Prop6 string `json:"prop6"`
ImgUrl string `json:"img_url"`
SpecAuxUnitName interface{} `json:"spec_aux_unit_name"`
SpecUnitName interface{} `json:"spec_unit_name"`
} `json:"spec_list"`
} `json:"goods_list"`
}
/**
商品列表
*/
func (s *goods) List(ctx context.Context, req *GoodsListReq) (res *GoodsListRes, err error) {
result, err := post(ctx, "/openapi2/goods_query.php", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
package wandian
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
var Order = new(order)
type order struct {
}
type TradeListReq struct {
ProviderNo int `json:"provider_no"`
WarehouseNo string `json:"warehouse_no"`
OuterNo string `json:"outer_no"`
IsUseOuterNo int `json:"is_use_outer_no"`
IsCheck int `json:"is_check"`
Contact string `json:"contact"`
Telno string `json:"telno"`
ReceiveAddress string `json:"receive_address"`
LogisticsType int `json:"logistics_type"`
OtherFee float64 `json:"other_fee"`
PostFee float64 `json:"post_fee"`
Remark string `json:"remark"`
DetailsList []struct {
SpecNo string `json:"spec_no"`
Num int `json:"num"`
Price float64 `json:"price"`
Discount float64 `json:"discount"`
Tax float64 `json:"tax"`
Remark string `json:"remark"`
Prop1 string `json:"prop1"`
Prop2 string `json:"prop2"`
} `json:"details_list"`
}
type TradePushReq struct {
ShopNo string `json:"shop_no"`
Switch int `json:"switch"`
TradeList *TradeListReq `json:"trade_list"`
}
type TradePushRes struct {
Code int `json:"code"`
Message string `json:"message"`
NewCount int `json:"new_count"`
ChgCount int `json:"chg_count"`
}
/**
创建原始订单
*/
func (s *goods) TradePush(ctx context.Context, req *TradePushReq) (res *TradePushRes, err error) {
result, err := post(ctx, "/purchase_order_push.php", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type TradeQueryReq struct {
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
PageSize string `json:"page_size"`
PageNo string `json:"page_no"`
Status string `json:"status"`
}
type TradeQueryRes struct {
Code int `json:"code"`
Message string `json:"message"`
TotalCount int `json:"total_count"`
StockoutList []struct {
StockoutId string `json:"stockout_id"`
OrderNo string `json:"order_no"`
SrcOrderNo string `json:"src_order_no"`
WarehouseNo string `json:"warehouse_no"`
ConsignTime string `json:"consign_time"`
Status string `json:"status"`
OrderType string `json:"order_type"`
GoodsCount string `json:"goods_count"`
GoodsTotalAmount string `json:"goods_total_amount"`
GoodsTotalCost string `json:"goods_total_cost"`
PostFee string `json:"post_fee"`
LogisticsNo string `json:"logistics_no"`
PackageFee string `json:"package_fee"`
Receivable string `json:"receivable"`
ReceiverName string `json:"receiver_name"`
ReceiverCountry string `json:"receiver_country"`
ReceiverProvince string `json:"receiver_province"`
ReceiverCity string `json:"receiver_city"`
ReceiverDistrict string `json:"receiver_district"`
ReceiverAddress string `json:"receiver_address"`
ReceiverMobile string `json:"receiver_mobile"`
ReceiverTelno string `json:"receiver_telno"`
ReceiverZip string `json:"receiver_zip"`
Remark string `json:"remark"`
Weight string `json:"weight"`
StockoutReason string `json:"stockout_reason"`
Subtype string `json:"subtype"`
OuterNo string `json:"outer_no"`
OperatorName string `json:"operator_name"`
LogisticsType string `json:"logistics_type"`
LogisticsCode string `json:"logistics_code"`
LogisticsName string `json:"logistics_name"`
BadReason string `json:"bad_reason"`
ReceiverDtb string `json:"receiver_dtb"`
PrintRemark string `json:"print_remark"`
Paid string `json:"paid"`
RefundStatus string `json:"refund_status"`
TradeType string `json:"trade_type"`
SalesmanNo string `json:"salesman_no"`
Fullname string `json:"fullname"`
SalesmanName string `json:"salesman_name"`
TradeStatus string `json:"trade_status"`
WarehouseName string `json:"warehouse_name"`
BlockReason string `json:"block_reason"`
PrintBatchNo string `json:"print_batch_no"`
TradeNo string `json:"trade_no"`
SrcTradeNo string `json:"src_trade_no"`
NickName string `json:"nick_name"`
CustomerNo string `json:"customer_no"`
CustomerName string `json:"customer_name"`
TradeTime string `json:"trade_time"`
PayTime string `json:"pay_time"`
FlagName string `json:"flag_name"`
PostAmount string `json:"post_amount"`
IdCardType string `json:"id_card_type"`
IdCard string `json:"id_card"`
ReceiverArea string `json:"receiver_area"`
ShopName string `json:"shop_name"`
ShopNo string `json:"shop_no"`
ShopRemark string `json:"shop_remark"`
Modified string `json:"modified"`
BuyerMessage string `json:"buyer_message"`
CsRemark string `json:"cs_remark"`
InvoiceType string `json:"invoice_type"`
InvoiceTitle string `json:"invoice_title"`
InvoiceContent string `json:"invoice_content"`
InvoiceId string `json:"invoice_id"`
CodAmount string `json:"cod_amount"`
DeliveryTerm string `json:"delivery_term"`
FenxiaoType string `json:"fenxiao_type"`
FenxiaoNick string `json:"fenxiao_nick"`
PlatformId string `json:"platform_id"`
TradeId string `json:"trade_id"`
EmployeeNo string `json:"employee_no"`
CheckerName string `json:"checker_name"`
Discount string `json:"discount"`
SrcTids string `json:"src_tids"`
Tax string `json:"tax"`
TaxRate string `json:"tax_rate"`
Currency string `json:"currency"`
Created string `json:"created"`
StockCheckTime string `json:"stock_check_time"`
PackagerNo string `json:"packager_no"`
PackagerName string `json:"packager_name"`
PickerNo string `json:"picker_no"`
PickerName string `json:"picker_name"`
PrinterNo string `json:"printer_no"`
PrinterName string `json:"printer_name"`
ExaminerNo string `json:"examiner_no"`
ExaminerName string `json:"examiner_name"`
OrderTypeName string `json:"order_type_name"`
ReceiverProvinceCode string `json:"receiver_province_code"`
ReceiverCityCode string `json:"receiver_city_code"`
ReceiverDistrictCode string `json:"receiver_district_code"`
DetailsList []struct {
RecId string `json:"rec_id"`
StockoutId string `json:"stockout_id"`
SpecNo string `json:"spec_no"`
GoodsCount string `json:"goods_count"`
TotalAmount string `json:"total_amount"`
Paid string `json:"paid"`
SellPrice string `json:"sell_price"`
Remark string `json:"remark"`
GoodsName string `json:"goods_name"`
GoodsNo string `json:"goods_no"`
BrandNo string `json:"brand_no"`
BrandName string `json:"brand_name"`
SpecName string `json:"spec_name"`
SpecCode string `json:"spec_code"`
CostPrice string `json:"cost_price"`
Weight string `json:"weight"`
GoodsId string `json:"goods_id"`
SpecId string `json:"spec_id"`
Prop1 string `json:"prop1"`
Prop2 string `json:"prop2"`
Prop3 string `json:"prop3"`
Prop4 string `json:"prop4"`
Prop5 string `json:"prop5"`
Prop6 string `json:"prop6"`
PlatformId string `json:"platform_id"`
RefundStatus string `json:"refund_status"`
MarketPrice string `json:"market_price"`
Discount string `json:"discount"`
ShareAmount string `json:"share_amount"`
TaxRate string `json:"tax_rate"`
Barcode string `json:"barcode"`
UnitName interface{} `json:"unit_name"`
SaleOrderId string `json:"sale_order_id"`
SharePost string `json:"share_post"`
GiftType string `json:"gift_type"`
SrcOid string `json:"src_oid"`
SrcTid string `json:"src_tid"`
FromMask string `json:"from_mask"`
GoodsType string `json:"goods_type"`
BatchNo string `json:"batch_no"`
SuiteNo string `json:"suite_no"`
GoodProp1 string `json:"good_prop1"`
GoodProp2 string `json:"good_prop2"`
GoodProp3 string `json:"good_prop3"`
GoodProp4 string `json:"good_prop4"`
GoodProp5 string `json:"good_prop5"`
GoodProp6 string `json:"good_prop6"`
} `json:"details_list"`
} `json:"stockout_list"`
}
/**
查询销售出库单
*/
func (s *goods) TradeQuery(ctx context.Context, req *TradeQueryReq) (res *TradeQueryRes, err error) {
result, err := post(ctx, "/openapi2/purchase_order_query.php", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type SalesTradeQueryReq struct {
Status int `json:"status"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
PageSize int `json:"page_size"`
PageNo int `json:"page_no"`
ShopNo string `json:"shop_no"`
WarehouseNo string `json:"warehouse_no"`
Goodstax int `json:"goodstax"`
HasLogisticsNo int `json:"has_logistics_no"`
IsFuzzy int `json:"is_fuzzy"`
Src int `json:"src"`
ShopNos string `json:"shop_nos"`
}
type SalesTradeQueryRes struct {
Code int `json:"code"`
Message string `json:"message"`
TotalCount int `json:"total_count"`
Trades []struct {
TradeId string `json:"trade_id"`
TradeNo string `json:"trade_no"`
PlatformId string `json:"platform_id"`
WarehouseType string `json:"warehouse_type"`
SrcTids string `json:"src_tids"`
PayAccount string `json:"pay_account"`
TradeStatus string `json:"trade_status"`
ConsignStatus string `json:"consign_status"`
TradeType string `json:"trade_type"`
DeliveryTerm string `json:"delivery_term"`
FreezeReason string `json:"freeze_reason"`
RefundStatus string `json:"refund_status"`
FenxiaoType string `json:"fenxiao_type"`
FenxiaoNick string `json:"fenxiao_nick"`
TradeTime string `json:"trade_time"`
PayTime string `json:"pay_time"`
BuyerNick string `json:"buyer_nick"`
ReceiverName string `json:"receiver_name"`
ReceiverProvince string `json:"receiver_province"`
ReceiverCity string `json:"receiver_city"`
ReceiverDistrict string `json:"receiver_district"`
ReceiverAddress string `json:"receiver_address"`
ReceiverMobile string `json:"receiver_mobile"`
ReceiverTelno string `json:"receiver_telno"`
ReceiverZip string `json:"receiver_zip"`
ReceiverArea string `json:"receiver_area"`
ReceiverRing string `json:"receiver_ring"`
ReceiverDtb string `json:"receiver_dtb"`
ToDeliverTime string `json:"to_deliver_time"`
BadReason string `json:"bad_reason"`
LogisticsNo string `json:"logistics_no"`
BuyerMessage string `json:"buyer_message"`
CsRemark string `json:"cs_remark"`
RemarkFlag string `json:"remark_flag"`
PrintRemark string `json:"print_remark"`
GoodsTypeCount string `json:"goods_type_count"`
GoodsCount string `json:"goods_count"`
GoodsAmount string `json:"goods_amount"`
PostAmount string `json:"post_amount"`
OtherAmount string `json:"other_amount"`
Discount string `json:"discount"`
Receivable string `json:"receivable"`
DapAmount string `json:"dap_amount"`
CodAmount string `json:"cod_amount"`
ExtCodFee string `json:"ext_cod_fee"`
GoodsCost string `json:"goods_cost"`
PostCost string `json:"post_cost"`
Paid string `json:"paid"`
Weight string `json:"weight"`
Profit string `json:"profit"`
Tax string `json:"tax"`
TaxRate string `json:"tax_rate"`
Commission string `json:"commission"`
InvoiceType string `json:"invoice_type"`
InvoiceTitle string `json:"invoice_title"`
InvoiceContent string `json:"invoice_content"`
SalesmanId string `json:"salesman_id"`
CheckerId string `json:"checker_id"`
FcheckerId string `json:"fchecker_id"`
CheckouterId string `json:"checkouter_id"`
StockoutNo string `json:"stockout_no"`
FlagName string `json:"flag_name"`
TradeFrom string `json:"trade_from"`
SingleSpecNo string `json:"single_spec_no"`
RawGoodsCount string `json:"raw_goods_count"`
RawGoodsTypeCount string `json:"raw_goods_type_count"`
Currency string `json:"currency"`
SplitPackageNum string `json:"split_package_num"`
InvoiceId string `json:"invoice_id"`
VersionId string `json:"version_id"`
Modified string `json:"modified"`
Created string `json:"created"`
IdCardType string `json:"id_card_type"`
IdCard string `json:"id_card"`
ShopNo string `json:"shop_no"`
ShopName string `json:"shop_name"`
ShopRemark string `json:"shop_remark"`
WarehouseNo string `json:"warehouse_no"`
CustomerName string `json:"customer_name"`
CustomerNo string `json:"customer_no"`
LogisticsId string `json:"logistics_id"`
LogisticsName string `json:"logistics_name"`
LogisticsCode string `json:"logistics_code"`
LogisticsType string `json:"logistics_type"`
Fullname string `json:"fullname"`
CheckerName string `json:"checker_name"`
GoodsList []struct {
RecId string `json:"rec_id"`
TradeId string `json:"trade_id"`
SpecId string `json:"spec_id"`
PlatformId string `json:"platform_id"`
SrcOid string `json:"src_oid"`
SuiteId string `json:"suite_id"`
SrcTid string `json:"src_tid"`
GiftType string `json:"gift_type"`
RefundStatus string `json:"refund_status"`
GuaranteeMode string `json:"guarantee_mode"`
DeliveryTerm string `json:"delivery_term"`
BindOid string `json:"bind_oid"`
Num string `json:"num"`
Price string `json:"price"`
ActualNum string `json:"actual_num"`
RefundNum string `json:"refund_num"`
OrderPrice string `json:"order_price"`
SharePrice string `json:"share_price"`
Adjust string `json:"adjust"`
Discount string `json:"discount"`
ShareAmount string `json:"share_amount"`
SharePost string `json:"share_post"`
Paid string `json:"paid"`
GoodsName string `json:"goods_name"`
GoodsId string `json:"goods_id"`
GoodsNo string `json:"goods_no"`
SpecName string `json:"spec_name"`
SpecNo string `json:"spec_no"`
SpecCode string `json:"spec_code"`
SuiteNo string `json:"suite_no"`
Flag string `json:"flag"`
SuiteName string `json:"suite_name"`
SuiteNum string `json:"suite_num"`
SuiteAmount string `json:"suite_amount"`
SuiteDiscount string `json:"suite_discount"`
ApiGoodsName string `json:"api_goods_name"`
ApiSpecName string `json:"api_spec_name"`
Weight string `json:"weight"`
Commission string `json:"commission"`
GoodsType string `json:"goods_type"`
LargeType string `json:"large_type"`
InvoiceType string `json:"invoice_type"`
InvoiceContent string `json:"invoice_content"`
FromMask string `json:"from_mask"`
Cid string `json:"cid"`
Remark string `json:"remark"`
Modified string `json:"modified"`
Created string `json:"created"`
PlatformGoodsId string `json:"platform_goods_id"`
PlatformSpecId string `json:"platform_spec_id"`
Prop2 string `json:"prop2"`
TaxRate string `json:"tax_rate"`
} `json:"goods_list"`
} `json:"trades"`
}
/**
查询订单管理
*/
func (s *goods) SalesTradeQuery(ctx context.Context, req *SalesTradeQueryReq) (res *SalesTradeQueryRes, err error) {
result, err := post(ctx, "/openapi2/sales_trade_query.php", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type SalesApiTradeQueryReq struct {
Tid string `json:"tid"`
PlatformId int `json:"platform_id"`
ShopNo string `json:"shop_no"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
PageNo int `json:"page_no"`
PageSize int `json:"page_size"`
}
type SalesApiTradeQueryRes struct {
Code int `json:"code"`
Message string `json:"message"`
TotalCount string `json:"total_count"`
TradeList []struct {
PlatformId string `json:"platform_id"`
ShopNo string `json:"shop_no"`
Tid string `json:"tid"`
ProcessStatus string `json:"process_status"`
TradeStatus string `json:"trade_status"`
GuaranteeMode string `json:"guarantee_mode"`
PayStatus string `json:"pay_status"`
DeliveryTerm string `json:"delivery_term"`
PayMethod string `json:"pay_method"`
RefundStatus string `json:"refund_status"`
TradeTime string `json:"trade_time"`
PayTime string `json:"pay_time"`
BuyerMessage string `json:"buyer_message"`
Remark string `json:"remark"`
ToDeliverTime string `json:"to_deliver_time"`
Receivable string `json:"receivable"`
GoodsAmount string `json:"goods_amount"`
PostAmount string `json:"post_amount"`
OtherAmount string `json:"other_amount"`
Discount string `json:"discount"`
Paid string `json:"paid"`
PlatformCost string `json:"platform_cost"`
Received string `json:"received"`
DapAmount string `json:"dap_amount"`
CodAmount string `json:"cod_amount"`
PiAmount string `json:"pi_amount"`
RefundAmount string `json:"refund_amount"`
LogisticsType string `json:"logistics_type"`
InvoiceType string `json:"invoice_type"`
InvoiceTitle string `json:"invoice_title"`
InvoiceContent string `json:"invoice_content"`
TradeFrom string `json:"trade_from"`
FenxiaoType string `json:"fenxiao_type"`
EndTime string `json:"end_time"`
Modified string `json:"modified"`
Created string `json:"created"`
Currency string `json:"currency"`
Score string `json:"score"`
GoodsList []struct {
PlatformId string `json:"platform_id"`
Tid string `json:"tid"`
Oid string `json:"oid"`
Status string `json:"status"`
ProcessStatus string `json:"process_status"`
RefundStatus string `json:"refund_status"`
OrderType string `json:"order_type"`
InvoiceType string `json:"invoice_type"`
InvoiceContent string `json:"invoice_content"`
BindOid string `json:"bind_oid"`
GoodsId string `json:"goods_id"`
SpecId string `json:"spec_id"`
GoodsNo string `json:"goods_no"`
SpecNo string `json:"spec_no"`
GoodsName string `json:"goods_name"`
SpecName string `json:"spec_name"`
RefundId string `json:"refund_id"`
Num string `json:"num"`
Price string `json:"price"`
AdjustAmount string `json:"adjust_amount"`
Discount string `json:"discount"`
ShareDiscount string `json:"share_discount"`
TotalAmount string `json:"total_amount"`
ShareAmount string `json:"share_amount"`
SharePost string `json:"share_post"`
Paid string `json:"paid"`
RefundAmount string `json:"refund_amount"`
Modified string `json:"modified"`
Created string `json:"created"`
EndTime string `json:"end_time"`
Remark string `json:"remark"`
} `json:"goods_list"`
DiscountList []interface{} `json:"discount_list"`
} `json:"trade_list"`
}
/**
查询原始订单
*/
func (s *goods) SalesApiTradeQuery(ctx context.Context, req *SalesApiTradeQueryReq) (res *SalesApiTradeQueryRes, err error) {
result, err := post(ctx, "/openapi2/sales_api_trade_query.php", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type LogisticsMultiQueryReq struct {
StartModified string `json:"start_modified"`
EndModified string `json:"end_modified"`
PageSize int `json:"page_size"`
PageNo int `json:"page_no"`
LogisticsNo string `json:"logistics_no"`
TradeNo string `json:"trade_no"`
}
type LogisticsMultiQueryRes struct {
Code int `json:"code"`
Message string `json:"message"`
LogisticsMultiList []struct {
RecId string `json:"rec_id"`
OperatorId string `json:"operator_id"`
TradeId string `json:"trade_id"`
LogisticsNo string `json:"logistics_no"`
LogisticsId string `json:"logistics_id"`
PostCost string `json:"post_cost"`
PrintStatus string `json:"print_status"`
Weight string `json:"weight"`
Modified string `json:"modified"`
Created string `json:"created"`
GoodsInfo []struct {
SpecNo string `json:"spec_no"`
Num string `json:"num"`
} `json:"goods_info"`
} `json:"logistics_multi_list"`
}
/**
查询多物流单号
*/
func (s *goods) LogisticsMultiQuery(ctx context.Context, req *LogisticsMultiQueryReq) (res *LogisticsMultiQueryRes, err error) {
result, err := post(ctx, "/openapi2/logistics_multi_query.php", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论