This commit is contained in:
邹宗楠
2024-02-28 18:41:19 +08:00
parent cd893ad98a
commit a69daacbee
2 changed files with 47 additions and 13 deletions

View File

@@ -453,21 +453,50 @@ func (a *API) RetailDiscountDelete2(poiCode string, actType int, actIDList []str
if actType == 0 {
actType = RetailActTypeDirectDown
}
globals.SugarLogger.Debugf("=========poiCode : %s ,%d ,%s", poiCode, actType, utils.Format4Output(actIDList, false))
result, err := a.AccessAPI("act/retail/discount/batchdelete", false, map[string]interface{}{
KeyAppPoiCode: poiCode,
"act_type": actType,
"item_ids": strings.Join(actIDList, ","),
})
globals.SugarLogger.Debugf("==============resullt := %s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("==============err := %v", err)
var msg string
if err == nil {
msg = getMsgFromResult(result)
if len(actIDList) > 100 {
actList := len(actIDList) % 100
if actList != 0 {
actList = len(actIDList)/100 + 1
} else {
actList = len(actIDList)
}
for i := 0; i < actList; i++ {
actParamList := ""
if i+1 == actList {
actParamList = strings.Join(actIDList[i*100:], ",")
} else {
actParamList = strings.Join(actIDList[i*100:(i+1)*100], ",")
}
result, err := a.AccessAPI("act/retail/discount/batchdelete", false, map[string]interface{}{
KeyAppPoiCode: poiCode,
"act_type": actType,
"item_ids": actParamList,
})
globals.SugarLogger.Debugf("==============resullt := %s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("==============err := %v", err)
var msg string
if err == nil {
msg = getMsgFromResult(result)
} else {
msg = getMsgFromError(err)
}
failedList = append(failedList, parseErr4RetailDiscountDelete(msg)...)
}
} else {
msg = getMsgFromError(err)
result, err := a.AccessAPI("act/retail/discount/batchdelete", false, map[string]interface{}{
KeyAppPoiCode: poiCode,
"act_type": actType,
"item_ids": strings.Join(actIDList, ","),
})
var msg string
if err == nil {
msg = getMsgFromResult(result)
} else {
msg = getMsgFromError(err)
}
failedList = append(failedList, parseErr4RetailDiscountDelete(msg)...)
}
failedList = parseErr4RetailDiscountDelete(msg)
return failedList, err
}

View File

@@ -262,3 +262,8 @@ func TestDeleteActSku(t *testing.T) {
fmt.Println(err2)
}
func TestCEA(t *testing.T) {
a := []int{1, 2, 3, 4, 5}
fmt.Println(a[2:])
}