- 重要修改相关的函数新增trackInfo参数,追踪修改人.接口类型改变
This commit is contained in:
@@ -154,16 +154,6 @@ func (a *API) RetailCatList(poiCode string) (retailCatList []*RetailCategoryInfo
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 商品名最长30个字符(非字节)
|
||||
// 不能包含敏感词:特级
|
||||
func (a *API) RetailInitData(poiCode, foodCode string, params map[string]interface{}) (err error) {
|
||||
_, err = a.AccessAPI("retail/initdata", false, utils.MergeMaps(map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
KeyAppFoodCode: foodCode,
|
||||
}, params))
|
||||
return err
|
||||
}
|
||||
|
||||
// offset 从0开始,limit最大不能超过200
|
||||
// 返回的app_poi_code始终是空,手动建的商品app_food_code也为空(导致无法通过API删除)
|
||||
func (a *API) RetailList(poiCode string, offset, limit int) (foodList []*AppFood, err error) {
|
||||
@@ -209,33 +199,42 @@ func handleRetailBatchResultByRegexp(result interface{}) (failedFoodList []*AppF
|
||||
return failedFoodList, err
|
||||
}
|
||||
|
||||
func (a *API) RetailBatchInitData(poiCode string, foodDataList []map[string]interface{}) (failedFoodList []*AppFoodResult, err error) {
|
||||
// 商品名最长30个字符(非字节)
|
||||
func (a *API) RetailInitData(trackInfo, poiCode, foodCode string, params map[string]interface{}) (err error) {
|
||||
_, err = a.AccessAPI2("retail/initdata", false, utils.MergeMaps(map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
KeyAppFoodCode: foodCode,
|
||||
}, params), resultKeyData, trackInfo)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) RetailBatchInitData(trackInfo, poiCode string, foodDataList []map[string]interface{}) (failedFoodList []*AppFoodResult, err error) {
|
||||
result, err := a.AccessAPI2("retail/batchinitdata", false, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
"food_data": string(utils.MustMarshal(foodDataList)),
|
||||
}, resultKeyMsg)
|
||||
}, resultKeyMsg, trackInfo)
|
||||
if err == nil {
|
||||
failedFoodList, err = handleRetailBatchResult(result)
|
||||
}
|
||||
return failedFoodList, err
|
||||
}
|
||||
|
||||
func (a *API) RetailSkuPrice(poiCode string, foodData []*BareStoreFoodInfo) (failedFoodList []*AppFoodResult, err error) {
|
||||
func (a *API) RetailSkuPrice(trackInfo, poiCode string, foodData []*BareStoreFoodInfo) (failedFoodList []*AppFoodResult, err error) {
|
||||
result, err := a.AccessAPI2("retail/sku/price", false, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
"food_data": string(utils.MustMarshal(foodData)),
|
||||
}, resultKeyMsg)
|
||||
}, resultKeyMsg, trackInfo)
|
||||
if err == nil {
|
||||
failedFoodList, err = handleRetailBatchResult(result)
|
||||
}
|
||||
return failedFoodList, err
|
||||
}
|
||||
|
||||
func (a *API) RetailSkuStock(poiCode string, foodData []*BareStoreFoodInfo) (failedFoodList []*AppFoodResult, err error) {
|
||||
func (a *API) RetailSkuStock(trackInfo, poiCode string, foodData []*BareStoreFoodInfo) (failedFoodList []*AppFoodResult, err error) {
|
||||
result, err := a.AccessAPI2("retail/sku/stock", false, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
"food_data": string(utils.MustMarshal(foodData)),
|
||||
}, resultKeyMsg)
|
||||
}, resultKeyMsg, trackInfo)
|
||||
if err == nil {
|
||||
failedFoodList, err = handleRetailBatchResult(result)
|
||||
}
|
||||
@@ -243,12 +242,12 @@ func (a *API) RetailSkuStock(poiCode string, foodData []*BareStoreFoodInfo) (fai
|
||||
}
|
||||
|
||||
// retail/sku/sellStatus在部分失败时会返回错误,其它相应的批处理函数则会返回成功
|
||||
func (a *API) RetailSkuSellStatus(poiCode string, foodData []*BareStoreFoodInfo, sellStatus int) (failedFoodList []*AppFoodResult, err error) {
|
||||
func (a *API) RetailSkuSellStatus(trackInfo, poiCode string, foodData []*BareStoreFoodInfo, sellStatus int) (failedFoodList []*AppFoodResult, err error) {
|
||||
_, err = a.AccessAPI2("retail/sku/sellStatus", false, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
"food_data": string(utils.MustMarshal(foodData)),
|
||||
"sell_status": sellStatus,
|
||||
}, resultKeyMsg)
|
||||
}, resultKeyMsg, trackInfo)
|
||||
if err != nil {
|
||||
if errExt, ok := err.(*utils.ErrorWithCode); ok {
|
||||
failedFoodList, _ = handleRetailBatchResultByRegexp(errExt.ErrMsg())
|
||||
@@ -281,20 +280,20 @@ func (a *API) RetailSkuSave(poiCode, foodCode string, standardSkus, unstandardSk
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) RetailDelete(poiCode, foodCode string) (err error) {
|
||||
_, err = a.AccessAPI("retail/delete", false, map[string]interface{}{
|
||||
func (a *API) RetailDelete(trackInfo, poiCode, foodCode string) (err error) {
|
||||
_, err = a.AccessAPI2("retail/delete", false, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
KeyAppFoodCode: foodCode,
|
||||
})
|
||||
}, resultKeyData, trackInfo)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) RetailSkuDelete(poiCode, foodCode, skuID string) (err error) {
|
||||
_, err = a.AccessAPI("retail/sku/delete", false, map[string]interface{}{
|
||||
func (a *API) RetailSkuDelete(trackInfo, poiCode, foodCode, skuID string) (err error) {
|
||||
_, err = a.AccessAPI2("retail/sku/delete", false, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
KeyAppFoodCode: foodCode,
|
||||
"sku_id": skuID,
|
||||
})
|
||||
}, resultKeyData, trackInfo)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -310,7 +309,7 @@ func (a *API) RetailGetSpTagIds() (tagIds []*RetailTag, err error) {
|
||||
}
|
||||
|
||||
// 此接口将申请授权后方可接入
|
||||
func (a *API) RetailCatSkuBatchDelete(poiCode string, catNames []string, secondaryCatNames []string, foodCodes []string) (err error) {
|
||||
func (a *API) RetailCatSkuBatchDelete(trackInfo, poiCode string, catNames []string, secondaryCatNames []string, foodCodes []string) (err error) {
|
||||
params := map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
}
|
||||
@@ -323,7 +322,7 @@ func (a *API) RetailCatSkuBatchDelete(poiCode string, catNames []string, seconda
|
||||
if len(foodCodes) > 0 {
|
||||
params["app_food_codes"] = strings.Join(foodCodes, ",")
|
||||
}
|
||||
_, err = a.AccessAPI("retailCat/batchdelete/catandretail", false, params)
|
||||
_, err = a.AccessAPI2("retailCat/batchdelete/catandretail", false, params, resultKeyData, trackInfo)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user