- 达达与美团配送的接口修改为较正式参数

This commit is contained in:
gazebo
2019-07-23 09:12:33 +08:00
parent 7ac11981b3
commit 7242dd435e
9 changed files with 255 additions and 81 deletions

View File

@@ -13,9 +13,9 @@ type CallbackResponse struct {
}
type CallbackCommonMsg struct {
AppKey string
Timestamp int64
Sign string
AppKey string `json:"appkey"`
Timestamp int64 `json:"timestamp"`
Sign string `json:"sign"`
}
type CallbackOrderMsg struct {
@@ -35,6 +35,17 @@ type CallbackOrderExceptionMsg struct {
ExceptionTime int64
}
type CallbackShopStatusMsg struct {
ShopName string `json:"shop_name"`
ShopID string `json:"shop_id"`
Status int `json:"status"`
RejectMessage string `json:"reject_message"`
AppKey string `json:"appkey"`
Timestamp int64 `json:"timestamp"`
Sign string `json:"sign"`
}
var (
SuccessResponse = &CallbackResponse{Code: 0}
SignatureIsNotOk = &CallbackResponse{Code: -1}
@@ -117,6 +128,16 @@ func (a *API) GetOrderExceptionCallbackMsg(request *http.Request) (orderMsg *Cal
ExceptionDescr: request.FormValue("exception_descr"),
ExceptionTime: utils.Str2Int64(request.FormValue("exception_time")),
}
return orderMsg, nil
}
func (a *API) GetShopStatusCallbackMsg(request *http.Request) (shopStatusMsg *CallbackShopStatusMsg, callbackResponse *CallbackResponse) {
if callbackResponse = a.CheckCallbackValidation(request); callbackResponse != nil {
return nil, callbackResponse
}
err := utils.Map2StructByJson(utils.URLValues2Map(request.PostForm), &shopStatusMsg, false)
if err != nil {
callbackResponse = Err2CallbackResponse(err, "")
}
return shopStatusMsg, callbackResponse
}