This commit is contained in:
li 2022-02-28 17:08:37 +08:00
parent c3deaf9b47
commit 0322ba843a

View File

@ -95,6 +95,7 @@ func InitTestDB() {
&UserRedeemCode{},
&DepositRefundRecord{},
&GroupSendMessageTemplate{},
&Goods{},
)
@ -548,3 +549,37 @@ func MergingGameCards() {
}
}
func TestGoodsAdd(t *testing.T) {
GoodsAdd()
}
func GoodsAdd() {
InitTestDB()
for i := 0; i < 5; i++ {
goods := Goods{
GoodsId: 1 + uint32(i)+1,
SerialNo: "sdhfjskdhjk"+ fmt.Sprintf("%d", i+1),
CatId: 1,
Name: "宝可梦剑" + fmt.Sprintf("%d", i+1),
Title: "宝可梦剑",
MainImage: "https://minghui-oss.oss-cn-shenzhen.aliyuncs.com/eceec8e0-da21-11eb-8936-197fd3ba503d.jpg",
Images: "https://minghui-oss.oss-cn-shenzhen.aliyuncs.com/eceec8e0-da21-11eb-8936-197fd3ba503d.jpg",
Stock: 10,
Detail: "宝可梦剑 详情" + fmt.Sprintf("%d", i+1),
SoldCount: 0,
SaleStatus: 1,
PriceVm: 10 + uint32(i),
PriceRm: 29900,
PriceOriginal: 29900,
DeliveryFee: 1000,
VersionId: 0,
}
err := DBDev.Create(&goods).Error
if err != nil {
fmt.Println("err:", err)
}
}
}