- beta启动时自动运行netspider.GetAndStoreCitiesShops

This commit is contained in:
gazebo
2019-09-11 21:44:06 +08:00
parent 8e49f41227
commit 9345f12738
2 changed files with 11 additions and 3 deletions

View File

@@ -192,9 +192,11 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
}
}()
for _, v := range shopList {
tmpShop := *v
dao.DeleteEntity(db, &tmpShop, model.FieldVendorStoreID, model.FieldVendorID)
if err = dao.CreateEntity(db, v); err != nil {
if v.DistrictCode > 0 {
tmpShop := *v
dao.DeleteEntity(db, &tmpShop, model.FieldVendorStoreID, model.FieldVendorID)
}
if err = dao.CreateEntity(db, v); err != nil && !dao.IsDuplicateError(err) {
break
}
}