ready link import fx 1
This commit is contained in:
parent
9753896fe5
commit
b2649c95d9
|
|
@ -48,6 +48,7 @@ func ImporterInstance() (instance *Importer, err error) {
|
||||||
go func(db *gorm.DB) {
|
go func(db *gorm.DB) {
|
||||||
defer instance.ImportWGroup.Done()
|
defer instance.ImportWGroup.Done()
|
||||||
instance.mainCategories, instance.Error = gm.GetMainCategories(db)
|
instance.mainCategories, instance.Error = gm.GetMainCategories(db)
|
||||||
|
log.Println(instance.mainCategories)
|
||||||
}(db)
|
}(db)
|
||||||
|
|
||||||
//load families to memory
|
//load families to memory
|
||||||
|
|
@ -353,9 +354,9 @@ func (importer *Importer) importVariant(product models.Product) (*gm.Product, er
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sProduct := importer.createSellerProduct(&mainFlat,product.Vendor)
|
sProduct := importer.createSellerProduct(&mainFlat, product.Vendor)
|
||||||
|
|
||||||
if errSProduct := tx.Create(&sProduct).Error; errSProduct != nil{
|
if errSProduct := tx.Create(&sProduct).Error; errSProduct != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return nil, errSProduct
|
return nil, errSProduct
|
||||||
}
|
}
|
||||||
|
|
@ -564,7 +565,7 @@ func (importer *Importer) updatePrice(price models.Price, flat *gm.ProductFlat)
|
||||||
func (importer *Importer) UpdateOrCreate(product models.Product) (instance *Importer) {
|
func (importer *Importer) UpdateOrCreate(product models.Product) (instance *Importer) {
|
||||||
|
|
||||||
firstProduct, err := importer.importVariant(product)
|
firstProduct, err := importer.importVariant(product)
|
||||||
var newProducts []gm.Product
|
newProducts := make([]gm.Product, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.Error(err)
|
helper.Error(err)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue