京东商城订单初接入
This commit is contained in:
31
platformapi/jdshopapi/callback.go
Normal file
31
platformapi/jdshopapi/callback.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package jdshopapi
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
type CallBackResult struct {
|
||||
OrderCreateTime string `json:"orderCreateTime"`
|
||||
OrderType string `json:"orderType"`
|
||||
OrderPaymentType string `json:"orderPaymentType"`
|
||||
VenderID string `json:"venderId"`
|
||||
OrderStatus string `json:"orderStatus"`
|
||||
OrderID string `json:"orderId"`
|
||||
}
|
||||
|
||||
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)
|
||||
utils.Map2StructByJson(mapData, &call, false)
|
||||
return call, err
|
||||
}
|
||||
Reference in New Issue
Block a user