fix: 全量-批量添加商详2

master
howell 4 years ago
parent 37e8b248f2
commit 6319ba64b8

@ -223,18 +223,16 @@ func (n *noticeLogic) Add(title string, img []string, noticeType int, vendorId u
start := 0
total := len(noticeGoods)
temp := make([][]goods.RecookGoodsNoticeGoodsModel, 0)
for {
if start > total {
if start >= total {
break
}
if total < step {
temp = append(temp, noticeGoods[start:])
break
} else {
temp = append(temp, noticeGoods[start:step])
start += step
if total-start < step {
step = total - start
}
temp = append(temp, noticeGoods[start:start+step])
start = start + step
}
for _, v := range temp {
if err := tx.Create(&v).Error; err != nil {

Loading…
Cancel
Save