fnps
This commit is contained in:
42
platformapi/fnpsapi/callback.go
Normal file
42
platformapi/fnpsapi/callback.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package fnpsapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
type CallBackInfo struct {
|
||||
AppID string `json:"app_id"`
|
||||
Data string `json:"data"`
|
||||
Salt int `json:"salt"`
|
||||
Signature string `json:"signature"`
|
||||
}
|
||||
|
||||
type WayBillInfo struct {
|
||||
PartnerOrderCode string `json:"partner_order_code"`
|
||||
OrderStatus int `json:"order_status"`
|
||||
PushTime int64 `json:"push_time"`
|
||||
CarrierDriverName string `json:"carrier_driver_name"`
|
||||
CarrierDriverPhone string `json:"carrier_driver_phone"`
|
||||
OpenOrderCode string `json:"open_order_code"`
|
||||
PlatformCode string `json:"platform_code"`
|
||||
ErrorScene string `json:"error_scene"`
|
||||
Description string `json:"description"`
|
||||
ErrorCode string `json:"error_code"`
|
||||
DetailDescription string `json:"detail_description"`
|
||||
}
|
||||
|
||||
func (a *API) GetOrderCallbackMsg(request *http.Request) (orderMsg *WayBillInfo) {
|
||||
err := request.ParseForm()
|
||||
if err == nil {
|
||||
params := make(url.Values)
|
||||
for k := range request.PostForm {
|
||||
decodedValue, _ := url.QueryUnescape(request.PostFormValue(k))
|
||||
params.Set(k, decodedValue)
|
||||
}
|
||||
utils.Map2StructByJson(params.Get("data"), &orderMsg, false)
|
||||
}
|
||||
return orderMsg
|
||||
}
|
||||
Reference in New Issue
Block a user