- elm and weixin token refresh added.

This commit is contained in:
gazebo
2018-06-26 18:49:26 +08:00
parent 8ca0584794
commit 294a208d6c
6 changed files with 160 additions and 39 deletions

View File

@@ -102,7 +102,11 @@ func (f *FreshFoodAPI) AccessFreshFood(apiStr string, params url.Values) error {
var response *http.Response
fullURL := f.baseURL + "/" + apiStr
for i := 0; i < retryCount; i++ {
response, err = f.client.PostForm(fullURL, params)
if params != nil {
response, err = f.client.PostForm(fullURL, params)
} else {
response, err = f.client.Get(fullURL)
}
// err = error(nil)
// globals.SugarLogger.Debug(fullURL)
// globals.SugarLogger.Debug(params)
@@ -172,12 +176,12 @@ func (f *FreshFoodAPI) NewELMOrder(order map[string]interface{}) error {
return f.AccessFreshFood(URL_FRESHFOOD_ORDER_CREATE_ELEME, params)
}
func (f *FreshFoodAPI) ELMOrderStatus(orderId string, status int, timestamp int64) error {
func (f *FreshFoodAPI) ELMOrderStatus(orderId string, status int, statusTime string) error {
params := make(url.Values)
params.Set(URL_FRESHFOOD_PARA_VENDERID, utils.Int2Str(ELM_VENDERID))
params.Set(URL_FRESHFOOD_PARA_ORDERID, orderId)
params.Set(URL_FRESHFOOD_PARA_ORDERSTATUS, utils.Int2Str(status))
params.Set(URL_FRESHFOOD_PARA_ORDERSTATUSTIME, utils.Timestamp2Str(timestamp))
params.Set(URL_FRESHFOOD_PARA_ORDERSTATUSTIME, statusTime)
return f.AccessFreshFood(URL_FRESHFOOD_PARA_ORDERSTATUS, params)
}