- AddStoreVendorMap同步失败后回滚本地数据
This commit is contained in:
@@ -796,7 +796,6 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID
|
||||
}
|
||||
}()
|
||||
if err = dao.CreateEntity(db, storeMap); err == nil {
|
||||
dao.Commit(db)
|
||||
outStoreMap = storeMap
|
||||
if store != nil {
|
||||
_, err = CurVendorSync.SyncStore(ctx, db, storeMap.VendorID, storeID, false, userName)
|
||||
@@ -804,6 +803,8 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID
|
||||
}
|
||||
if err != nil {
|
||||
dao.Rollback(db)
|
||||
} else {
|
||||
dao.Commit(db)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -221,9 +221,13 @@ func (v *VendorSync) SyncStore(ctx *jxcontext.Context, db *dao.DaoDB, vendorID,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
var resultList []interface{}
|
||||
storeMap := batchItemList[0].(*model.StoreMap)
|
||||
if err = handler.UpdateStore(db, storeMap.StoreID, userName); err == nil {
|
||||
db2 := db
|
||||
if len(loopMapInfo.StoreMapList) > 1 {
|
||||
db2 = dao.GetDB()
|
||||
}
|
||||
if err = handler.UpdateStore(db2, storeMap.StoreID, userName); err == nil {
|
||||
storeMap.SyncStatus = 0
|
||||
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
|
||||
_, err = dao.UpdateEntity(db2, storeMap, model.FieldSyncStatus)
|
||||
resultList = append(resultList, 1)
|
||||
}
|
||||
return resultList, err
|
||||
|
||||
Reference in New Issue
Block a user