link parse fx5
This commit is contained in:
parent
88006a8ed0
commit
59078c7a93
|
|
@ -5,6 +5,7 @@ import (
|
||||||
helper "db_service/pkg"
|
helper "db_service/pkg"
|
||||||
"db_service/repositories"
|
"db_service/repositories"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gorm.io/driver/mysql"
|
"gorm.io/driver/mysql"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
@ -56,14 +57,10 @@ func ParseLink(w http.ResponseWriter, route *http.Request) {
|
||||||
//Preload("Proudct.AttributeValues","attribute_id in(11,13)").
|
//Preload("Proudct.AttributeValues","attribute_id in(11,13)").
|
||||||
First(&productFlat, "sku = ?", jsonProduct.ProductGroupID).Error
|
First(&productFlat, "sku = ?", jsonProduct.ProductGroupID).Error
|
||||||
|
|
||||||
if err != nil {
|
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
helper.Error(err)
|
helper.Error(err)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if productFlat.Sku == "" {
|
|
||||||
err = ImportProduct(jsonProduct, baza)
|
err = ImportProduct(jsonProduct, baza)
|
||||||
} else {
|
} else if err == nil {
|
||||||
err = UpdateProduct(jsonProduct, baza, productFlat)
|
err = UpdateProduct(jsonProduct, baza, productFlat)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue