1
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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:])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user