- 美团外卖满减,直降,运费活动API完成

This commit is contained in:
gazebo
2019-04-03 22:01:17 +08:00
parent f105cfed62
commit 21818bd78d
6 changed files with 365 additions and 58 deletions

View File

@@ -31,6 +31,10 @@ const (
KeyOrderID = "order_id"
)
const (
resultKeyData = "data"
resultKeyMsg = "success_msg"
)
const (
GeneralMaxLimit = 200 // 大多数的API的批处理最大条数
)
@@ -82,7 +86,7 @@ func (a *API) signParams(signURL string, params map[string]interface{}) string {
return fmt.Sprintf("%x", md5.Sum([]byte(finalStr)))
}
func (a *API) AccessAPI(cmd string, isGet bool, bizParams map[string]interface{}) (retVal interface{}, err error) {
func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{}, resultKey string) (retVal interface{}, err error) {
params := make(map[string]interface{})
params["timestamp"] = time.Now().Unix()
params["app_id"] = a.appID
@@ -136,7 +140,7 @@ func (a *API) AccessAPI(cmd string, isGet bool, bizParams map[string]interface{}
newErr := utils.NewErrorIntCode(errorInfo["msg"].(string), int(utils.MustInterface2Int64(errorInfo["code"])))
return platformapi.ErrLevelCodeIsNotOK, newErr
}
retVal = jsonResult1["data"]
retVal = jsonResult1[resultKey]
return platformapi.ErrLevelSuccess, nil
})
err = platformapi.RebuildError(err, bizParams, []string{
@@ -146,3 +150,7 @@ func (a *API) AccessAPI(cmd string, isGet bool, bizParams map[string]interface{}
})
return retVal, err
}
func (a *API) AccessAPI(cmd string, isGet bool, bizParams map[string]interface{}) (retVal interface{}, err error) {
return a.AccessAPI2(cmd, isGet, bizParams, resultKeyData)
}