终极测试
This commit is contained in:
@@ -229,7 +229,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
|
||||
var failedList []*partner.StoreSkuInfoWithErr
|
||||
handler := v.GetStoreHandler(loopMapInfo.VendorID)
|
||||
if handler != nil {
|
||||
if len(loopMapInfo.StoreMapList) > 0 {
|
||||
if len(loopMapInfo.StoreMapList) > 1 {
|
||||
loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
var resultList []interface{}
|
||||
@@ -272,25 +272,43 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
|
||||
}, loopMapInfo.StoreMapList)
|
||||
t.AddChild(loopStoreTask).Run()
|
||||
resultList, err = loopStoreTask.GetResult(0)
|
||||
} else {
|
||||
var resultList []interface{}
|
||||
db2 := db
|
||||
var vendorStoreID string
|
||||
storeMap := loopMapInfo.StoreMapList[0]
|
||||
if model.IsSyncStatusNew(storeMap.SyncStatus) {
|
||||
if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName); err == nil {
|
||||
resultList = append(resultList, 1)
|
||||
} else {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店")
|
||||
}
|
||||
} else if model.IsSyncStatusDelete(storeMap.SyncStatus) {
|
||||
if err = handler.DeleteStore(db2, storeMap.StoreID, userName); err == nil {
|
||||
resultList = append(resultList, 1)
|
||||
} else {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "删除门店")
|
||||
}
|
||||
} else {
|
||||
if err = handler.UpdateStore(db, storeMap.StoreID, userName); err == nil {
|
||||
storeMap.SyncStatus = 0
|
||||
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
|
||||
} else {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "更新门店")
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
resultList = []interface{}{1}
|
||||
if model.IsSyncStatusNew(storeMap.SyncStatus) {
|
||||
storeMap.VendorStoreID = vendorStoreID
|
||||
storeMap.SyncStatus = 0
|
||||
_, err = dao.UpdateEntity(db, storeMap, "VendorStoreID", model.FieldSyncStatus)
|
||||
} else {
|
||||
storeMap.SyncStatus = 0
|
||||
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// storeMap := loopMapInfo.StoreMapList[0]
|
||||
// if model.IsSyncStatusNew(storeMap.SyncStatus) {
|
||||
|
||||
// } else if model.IsSyncStatusDelete(storeMap.SyncStatus) {
|
||||
|
||||
// } else {
|
||||
// if err = handler.UpdateStore(db, storeMap.StoreID, userName); err == nil {
|
||||
// storeMap.SyncStatus = 0
|
||||
// _, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
|
||||
// } else {
|
||||
// failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "更新门店")
|
||||
// }
|
||||
// }
|
||||
// if err == nil {
|
||||
// resultList = []interface{}{1}
|
||||
// }
|
||||
// }
|
||||
err = partner.AddVendorInfo2Err(err, loopMapInfo.VendorID)
|
||||
}
|
||||
if len(failedList) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user