|
|
|
@ -3,14 +3,15 @@ package goods
|
|
|
|
|
import (
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
mysql2 "git.oa00.com/go/mysql"
|
|
|
|
|
gorm2 "gorm.io/gorm"
|
|
|
|
|
"recook/internal/dbc"
|
|
|
|
|
"recook/internal/libs/bean"
|
|
|
|
|
"recook/internal/v2/model/gys/enterprise"
|
|
|
|
|
"recook/internal/v2/model/recook/goods"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
mysql2 "git.oa00.com/go/mysql"
|
|
|
|
|
gorm2 "gorm.io/gorm"
|
|
|
|
|
|
|
|
|
|
"github.com/golangkit/formatime"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -215,9 +216,32 @@ func (n *noticeLogic) Add(title string, img []string, noticeType int, vendorId u
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if err := tx.Create(¬iceGoods).Error; err != nil {
|
|
|
|
|
return err
|
|
|
|
|
if len(noticeGoods) == 0 {
|
|
|
|
|
return errors.New("没有上架的商品")
|
|
|
|
|
}
|
|
|
|
|
step := 1000
|
|
|
|
|
start := 0
|
|
|
|
|
total := len(noticeGoods)
|
|
|
|
|
temp := make([][]goods.RecookGoodsNoticeGoodsModel, 0)
|
|
|
|
|
for {
|
|
|
|
|
if start > total {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
if total < step {
|
|
|
|
|
temp = append(temp, noticeGoods[start:])
|
|
|
|
|
break
|
|
|
|
|
} else {
|
|
|
|
|
temp = append(temp, noticeGoods[start:step])
|
|
|
|
|
start += step
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
for _, v := range temp {
|
|
|
|
|
if err := tx.Create(&v).Error; err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//recookGoodsNoticeGoodsModel := &goods.RecookGoodsNoticeGoodsModel{}
|
|
|
|
|
////recookGoodsNoticeGoodsModel.SetDb(tx)
|
|
|
|
|
//row := recookGoodsNoticeGoodsModel.CreateAll(¬iceGoods)
|
|
|
|
|