- AddStoreVendorMap同步失败后回滚本地数据

This commit is contained in:
gazebo
2019-08-13 19:56:06 +08:00
parent f8a5e1bc8d
commit 18ad339e0c
2 changed files with 8 additions and 3 deletions

View File

@@ -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