- return result even error in dada api
This commit is contained in:
@@ -50,8 +50,11 @@ func (a *API) ShopAdd(originShopID, stationName string, business int, cityName,
|
||||
if addParams != nil {
|
||||
params = utils.MergeMaps(params, addParams)
|
||||
}
|
||||
successList, _, err := a.BatchShopAdd([]map[string]interface{}{params})
|
||||
successList, failedList, err := a.BatchShopAdd([]map[string]interface{}{params})
|
||||
if err != nil {
|
||||
if len(failedList) == 1 {
|
||||
return "", utils.NewErrorIntCode(failedList[0]["msg"].(string), int(utils.MustInterface2Int64(failedList[0]["code"])))
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
return utils.Interface2String(successList[0]["originShopId"]), nil
|
||||
@@ -59,9 +62,6 @@ func (a *API) ShopAdd(originShopID, stationName string, business int, cityName,
|
||||
|
||||
func (a *API) BatchShopAdd(shopInfoList []map[string]interface{}) (successList, failedList []map[string]interface{}, err error) {
|
||||
result, err := a.AccessAPI("api/shop/add", shopInfoList)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
mapResult := result.Result.(map[string]interface{})
|
||||
if successList2 := mapResult["successList"]; successList2 != nil {
|
||||
successList = utils.Slice2MapSlice(successList2.([]interface{}))
|
||||
@@ -69,7 +69,7 @@ func (a *API) BatchShopAdd(shopInfoList []map[string]interface{}) (successList,
|
||||
if failedList2 := mapResult["failedList"]; failedList2 != nil {
|
||||
failedList = utils.Slice2MapSlice(failedList2.([]interface{}))
|
||||
}
|
||||
return successList, failedList, nil
|
||||
return successList, failedList, err
|
||||
}
|
||||
|
||||
func (a *API) ShopUpdate(originShopID string, shopInfo map[string]interface{}) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user