This commit is contained in:
gazebo
2018-09-17 18:51:47 +08:00
parent f5e1f661f3
commit b1eb5325c7

View File

@@ -77,15 +77,19 @@ func (v *VendorSync) SyncCategory(db *dao.DaoDB, categoryID int, isForce bool, u
} }
func (v *VendorSync) SyncStore(db *dao.DaoDB, vendorID int, store *model.Store, isForce bool, userName string) (err error) { func (v *VendorSync) SyncStore(db *dao.DaoDB, vendorID int, store *model.Store, isForce bool, userName string) (err error) {
globals.SugarLogger.Debugf("SyncStore, %s", utils.Format4Output(store, true)) globals.SugarLogger.Debugf("SyncStore, store:%s", utils.Format4Output(store, true))
if db == nil { if db == nil {
db = dao.GetDB() db = dao.GetDB()
} }
err = v.LoopStoreMap(db, store.ID, func(batchItemList []interface{}, params ...interface{}) (interface{}, error) { err = v.LoopStoreMap(db, store.ID, func(batchItemList []interface{}, params ...interface{}) (interface{}, error) {
storeMap := batchItemList[0].(*model.StoreMap) storeMap := batchItemList[0].(*model.StoreMap)
globals.SugarLogger.Debugf("SyncStore, storeMap:%s", utils.Format4Output(store, true))
if (vendorID == -1 || vendorID == storeMap.VendorID) && (isForce || storeMap.SyncStatus != 0) { if (vendorID == -1 || vendorID == storeMap.VendorID) && (isForce || storeMap.SyncStatus != 0) {
globals.SugarLogger.Debug("f2")
if handler := GetPurchaseHandler(storeMap.VendorID); handler != nil { if handler := GetPurchaseHandler(storeMap.VendorID); handler != nil {
globals.SugarLogger.Debug("f3")
if err = handler.UpdateStore(store.ID, userName); err == nil { if err = handler.UpdateStore(store.ID, userName); err == nil {
globals.SugarLogger.Debug("f4")
storeMap.SyncStatus = 0 storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus) _, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
} }