seller id deadlock and delete elapsed time
This commit is contained in:
parent
3693589d66
commit
1280c05303
|
|
@ -312,7 +312,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(product.ColorVariants) > 0 {
|
if len(product.ColorVariants) > 0 {
|
||||||
product.ColorVariants = append(product.ColorVariants, product)
|
product.ColorVariants = append([]models.Product{product}, product.ColorVariants...)
|
||||||
|
|
||||||
for _, colorVariant := range product.ColorVariants {
|
for _, colorVariant := range product.ColorVariants {
|
||||||
weight, _ := strconv.ParseFloat(colorVariant.Weight, 64)
|
weight, _ := strconv.ParseFloat(colorVariant.Weight, 64)
|
||||||
|
|
@ -1003,7 +1003,13 @@ func UpdateProduct(product models.Product, db *gorm.DB, productFlat gm.ProductFl
|
||||||
productFlat.MaxPrice = maxPrice
|
productFlat.MaxPrice = maxPrice
|
||||||
}
|
}
|
||||||
|
|
||||||
errFlat := db.Omit("Product", "ParentID", "CreatedAt").Save(&productFlat).Error
|
var errFlat error
|
||||||
|
if productFlat.SpecialPrice != 0 {
|
||||||
|
|
||||||
|
errFlat = db.Omit("Product", "ParentID", "CreatedAt").Save(&productFlat).Error
|
||||||
|
} else {
|
||||||
|
errFlat = db.Omit("Product", "ParentID", "CreatedAt", "SpecialPrice").Save(&productFlat).Error
|
||||||
|
}
|
||||||
|
|
||||||
return errFlat
|
return errFlat
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue