85 lines
3.2 KiB
Go
85 lines
3.2 KiB
Go
package jdshopapi
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
"net/http"
|
|
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
)
|
|
|
|
type CallBackResult struct {
|
|
OrderStateRemark string `json:"orderStateRemark"`
|
|
OrderRemark string `json:"orderRemark"`
|
|
OrderSellerPrice string `json:"orderSellerPrice"`
|
|
OrderState string `json:"orderState"`
|
|
OrderType string `json:"orderType"`
|
|
OrderPayment string `json:"orderPayment"`
|
|
PayType string `json:"payType"`
|
|
StoreID string `json:"storeId"`
|
|
OrderTotalPrice string `json:"orderTotalPrice"`
|
|
OrderExt string `json:"orderExt"`
|
|
StoreOrder string `json:"storeOrder"`
|
|
OrderStartTime string `json:"orderStartTime"`
|
|
OrderID string `json:"orderId"`
|
|
OrderSource string `json:"orderSource"`
|
|
FreightPrice string `json:"freightPrice"`
|
|
MsgType string `json:"msgType"`
|
|
Pin string `json:"pin"`
|
|
IDSopShipmenttype string `json:"idSopShipmenttype"`
|
|
ScDT string `json:"scDT"`
|
|
SellerDiscount string `json:"sellerDiscount"`
|
|
ConsigneeInfo *CallBackConsigneeInfo `json:"consigneeInfo"`
|
|
ItemInfoList []*CallBackItemInfoList `json:"itemInfoList"`
|
|
VendorOrgCode string `json:"vendorOrgCode"`
|
|
MenDianID string `json:"menDianId"`
|
|
BalanceUsed string `json:"balanceUsed"`
|
|
}
|
|
|
|
type CallBackConsigneeInfo struct {
|
|
ProvinceID string `json:"provinceId"`
|
|
FullAddress string `json:"fullAddress"`
|
|
CityID string `json:"cityId"`
|
|
TownID string `json:"townId"`
|
|
City string `json:"city"`
|
|
County string `json:"county"`
|
|
Province string `json:"province"`
|
|
Town string `json:"town"`
|
|
Telephone string `json:"telephone"`
|
|
Fullname string `json:"fullname"`
|
|
CountyID string `json:"countyId"`
|
|
Mobile string `json:"mobile"`
|
|
}
|
|
|
|
type CallBackItemInfoList struct {
|
|
ProductNo string `json:"productNo"`
|
|
ItemTotal string `json:"itemTotal"`
|
|
JdPrice string `json:"jdPrice"`
|
|
SkuName string `json:"skuName"`
|
|
InvoiceContentID string `json:"invoiceContentId"`
|
|
ItemExt string `json:"itemExt"`
|
|
NewStoreID string `json:"newStoreId"`
|
|
OuterSkuID string `json:"outerSkuId"`
|
|
SkuID string `json:"skuId"`
|
|
WareID string `json:"wareId"`
|
|
GiftPoint string `json:"giftPoint"`
|
|
}
|
|
|
|
func (a *API) GetCallbackMsg(request *http.Request) (call *CallBackResult, err error) {
|
|
data, err := ioutil.ReadAll(request.Body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
values, err := utils.HTTPBody2Values(data, false)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
mapData := utils.URLValues2Map(values)
|
|
if err = json.Unmarshal([]byte(mapData["orderInfo"].(string)), &call); err != nil {
|
|
return nil, err
|
|
}
|
|
call.MsgType = mapData["msgType"].(string)
|
|
call.VendorOrgCode = mapData["vendorOrgCode"].(string)
|
|
return call, err
|
|
}
|