+ SyncStoresQualify

This commit is contained in:
gazebo
2019-08-15 12:40:14 +08:00
parent c607fa931c
commit 3c5f25b839
6 changed files with 169 additions and 1 deletions

View File

@@ -1707,3 +1707,35 @@ func SaveAndSendAlarmVendorSnapshot(ctx *jxcontext.Context, vendorIDs, storeIDs
}
return err
}
func SyncStoresQualify(ctx *jxcontext.Context, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
if len(storeIDs) > 0 {
db := dao.GetDB()
task := tasksch.NewParallelTask("上传门店资质", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
vendorID := model.VendorIDJD
if handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreSyncQualifyHandler); handler != nil {
storeID := batchItemList[0].(int)
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID)
if err == nil {
if err = handler.SyncQualify(ctx, storeDetail); err == nil {
retVal = []int{1}
}
}
} else {
err = fmt.Errorf("平台%s不支持此操作", model.VendorChineseNames[vendorID])
}
return retVal, err
}, storeIDs)
tasksch.HandleTask(task, nil, true).Run()
if isAsync {
hint = task.GetID()
} else {
resultList, err2 := task.GetResult(0)
if err = err2; err == nil {
hint = utils.Int2Str(len(resultList))
}
}
}
return hint, err
}