LCW IMPORTER GOSHULDY2
This commit is contained in:
parent
f5ad77ba52
commit
ff7d82bad6
|
|
@ -43,12 +43,6 @@ func ParseLinkLCW(link string,w http.ResponseWriter) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonProduct, err := linkParser.GetProductDetailWithOptions(product.ID, product.ProductGroupID)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
helper.Error(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
importRepo, err := repositories.ImporterInstance()
|
importRepo, err := repositories.ImporterInstance()
|
||||||
|
|
||||||
|
|
@ -59,14 +53,14 @@ func ParseLinkLCW(link string,w http.ResponseWriter) {
|
||||||
//wait until initialization data is loaded to memory
|
//wait until initialization data is loaded to memory
|
||||||
importRepo.ImportWGroup.Wait()
|
importRepo.ImportWGroup.Wait()
|
||||||
|
|
||||||
if err = importRepo.UpdateOrCreate(jsonProduct).Error; err != nil {
|
if err = importRepo.UpdateOrCreate(product).Error; err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
json.NewEncoder(w).Encode(map[string]string{
|
json.NewEncoder(w).Encode(map[string]string{
|
||||||
"msg": "Link parsed successfully",
|
"msg": "Link parsed successfully",
|
||||||
"productGroupId": strconv.Itoa(product.ID),
|
"productGroupId": product.ProductNumber,
|
||||||
})
|
})
|
||||||
|
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue