mtunion回调
This commit is contained in:
43
platformapi/mtunionapi/callback.go
Normal file
43
platformapi/mtunionapi/callback.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package mtunionapi
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type CallBack struct {
|
||||
Errcode string `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
}
|
||||
|
||||
type CallBackResult struct {
|
||||
Smstitle string `json:"smstitle"`
|
||||
Quantity string `json:"quantity"`
|
||||
Orderid string `json:"orderid"`
|
||||
Dealid string `json:"dealid"`
|
||||
Paytime string `json:"paytime"`
|
||||
Type string `json:"type"`
|
||||
Ordertime string `json:"ordertime"`
|
||||
Sid string `json:"sid"`
|
||||
UID string `json:"uid"`
|
||||
Status string `json:"status"`
|
||||
Total string `json:"total"`
|
||||
Direct string `json:"direct"`
|
||||
Ratio string `json:"ratio"`
|
||||
Sign string `json:"sign"`
|
||||
}
|
||||
|
||||
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