同步错误
This commit is contained in:
@@ -630,7 +630,7 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, db *dao.DaoDB, taskN
|
|||||||
if len(task.GetErrMsg()) > 10 {
|
if len(task.GetErrMsg()) > 10 {
|
||||||
err = WirteToExcelBySyncFailed(task, ctx)
|
err = WirteToExcelBySyncFailed(task, ctx)
|
||||||
} else {
|
} else {
|
||||||
err = errors.New(utils.Format4Output(task.GetErrMsg(), true))
|
err = buildErrMsg(task)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -638,24 +638,7 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, db *dao.DaoDB, taskN
|
|||||||
if !isAsync {
|
if !isAsync {
|
||||||
resultList, err2 := task.GetResult(0)
|
resultList, err2 := task.GetResult(0)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
var resultL []*SyncErrResult
|
err2 = buildErrMsg(task)
|
||||||
failedList := task.GetErrMsg()
|
|
||||||
for _, v := range failedList {
|
|
||||||
for _, vv := range v.([]*partner.StoreSkuInfoWithErr) {
|
|
||||||
result := &SyncErrResult{
|
|
||||||
SkuID: vv.StoreSkuInfo.SkuID,
|
|
||||||
StoreID: vv.StoreID,
|
|
||||||
VendorID: vv.VendoreID,
|
|
||||||
VendorSkuID: vv.StoreSkuInfo.VendorSkuID,
|
|
||||||
NameID: vv.StoreSkuInfo.NameID,
|
|
||||||
VendorPrice: vv.StoreSkuInfo.VendorPrice,
|
|
||||||
SyncType: vv.SyncType,
|
|
||||||
ErrMsg: vv.ErrMsg,
|
|
||||||
}
|
|
||||||
resultL = append(resultL, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err2 = fmt.Errorf(utils.Format4Output(resultL, true))
|
|
||||||
}
|
}
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
if len(resultList) == 0 {
|
if len(resultList) == 0 {
|
||||||
@@ -670,6 +653,28 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, db *dao.DaoDB, taskN
|
|||||||
return task, hint, err
|
return task, hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func buildErrMsg(task tasksch.ITask) (err error) {
|
||||||
|
var resultL []*SyncErrResult
|
||||||
|
failedList := task.GetErrMsg()
|
||||||
|
for _, v := range failedList {
|
||||||
|
for _, vv := range v.([]*partner.StoreSkuInfoWithErr) {
|
||||||
|
result := &SyncErrResult{
|
||||||
|
SkuID: vv.StoreSkuInfo.SkuID,
|
||||||
|
StoreID: vv.StoreID,
|
||||||
|
VendorID: vv.VendoreID,
|
||||||
|
VendorSkuID: vv.StoreSkuInfo.VendorSkuID,
|
||||||
|
NameID: vv.StoreSkuInfo.NameID,
|
||||||
|
VendorPrice: vv.StoreSkuInfo.VendorPrice,
|
||||||
|
SyncType: vv.SyncType,
|
||||||
|
ErrMsg: vv.ErrMsg,
|
||||||
|
}
|
||||||
|
resultL = append(resultL, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = fmt.Errorf(utils.Format4Output(resultL, true))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (v *VendorSync) LoopStoresMap(ctx *jxcontext.Context, db *dao.DaoDB, taskName string, isAsync, isManageIt bool, vendorIDs []int, storeIDs []int, handler tasksch.WorkFunc, isContinueWhenError bool) (hint string, err error) {
|
func (v *VendorSync) LoopStoresMap(ctx *jxcontext.Context, db *dao.DaoDB, taskName string, isAsync, isManageIt bool, vendorIDs []int, storeIDs []int, handler tasksch.WorkFunc, isContinueWhenError bool) (hint string, err error) {
|
||||||
_, hint, err = v.LoopStoresMap2(ctx, db, taskName, isAsync, isManageIt, vendorIDs, storeIDs, false, handler, isContinueWhenError)
|
_, hint, err = v.LoopStoresMap2(ctx, db, taskName, isAsync, isManageIt, vendorIDs, storeIDs, false, handler, isContinueWhenError)
|
||||||
return hint, err
|
return hint, err
|
||||||
|
|||||||
Reference in New Issue
Block a user