|
|
|
@ -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 {
|
|
|
|
|