From eb3249ccf3004983592a8491d0462a10722d84da Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 16 Jan 2020 10:44:28 +0800 Subject: [PATCH] +mtwmapi.RetailDiscountBatchSave2 --- platformapi/mtwmapi/act.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/platformapi/mtwmapi/act.go b/platformapi/mtwmapi/act.go index cf7358ba..1eb8c1cc 100644 --- a/platformapi/mtwmapi/act.go +++ b/platformapi/mtwmapi/act.go @@ -12,6 +12,9 @@ const ( RetailActTypeDirectDown = 1001 // 折扣活动 RetailActTypeSecKill = 56 // 爆品活动 + + MaxRetailDiscountCreateBatchSize = 200 + MaxRetailDiscountDeleteBatchSize = 100 ) const ( @@ -345,6 +348,25 @@ func (a *API) RetailDiscountBatchSave(poiCode string, actType int, actData []*Re return actResult /*failedList, */, err } +func (a *API) RetailDiscountBatchSave2(poiCode string, actType int, actData []*RetailDiscountActData) (actResult []*RetailDiscountActResult, failedList []*AppFoodResult, err error) { + if actType == 0 { + actType = RetailActTypeDirectDown + } + result, err := a.AccessAPI2("act/retail/discount/batchsave", false, map[string]interface{}{ + KeyAppPoiCode: poiCode, + "act_data": string(utils.MustMarshal(actData)), + "act_type": actType, + }, "", "") + if err == nil { + resultMap := result.(map[string]interface{}) + err = utils.UnmarshalUseNumber([]byte(resultMap[resultKeySuccessMsg].(string)), &actResult) + if err == nil { + failedList, err = handleRetailBatchResult(resultMap[resultKeyMsg]) + } + } + return actResult, failedList, err +} + // 查询门店零售折扣商品 // http://developer.waimai.meituan.com/home/docDetail/288 func (a *API) RetailDiscountList(poiCode string, actType int) (actList []*RetailDiscountActData, err error) { @@ -379,6 +401,7 @@ func (a *API) RetailDiscountList(poiCode string, actType int) (actList []*Retail // 批量删除零售折扣商品 // http://developer.waimai.meituan.com/home/docDetail/289 +// TODO 部分成功未处理 func (a *API) RetailDiscountDelete(poiCode string, actType int, actIDList []string) (err error) { if actType == 0 { actType = RetailActTypeDirectDown