+ SyncStoresQualify
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user