- optimize jd SyncStoresSkus
This commit is contained in:
@@ -25,9 +25,6 @@ type tStoreSkuBindExt struct {
|
|||||||
// 京东到家,以有库存表示关注(认领)
|
// 京东到家,以有库存表示关注(认领)
|
||||||
func (p *PurchaseHandler) SyncStoresSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, db *dao.DaoDB, storeIDs []int, skuIDs []int, isAsync bool) (hint string, err error) {
|
func (p *PurchaseHandler) SyncStoresSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, db *dao.DaoDB, storeIDs []int, skuIDs []int, isAsync bool) (hint string, err error) {
|
||||||
globals.SugarLogger.Debugf("jd SyncStoresSkus, storeIDs:%v, skuIDs:%v", storeIDs, skuIDs)
|
globals.SugarLogger.Debugf("jd SyncStoresSkus, storeIDs:%v, skuIDs:%v", storeIDs, skuIDs)
|
||||||
if len(skuIDs) == 0 {
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
parallelCount := 1
|
parallelCount := 1
|
||||||
if len(skuIDs) < MaxSkuBatchSize {
|
if len(skuIDs) < MaxSkuBatchSize {
|
||||||
@@ -36,14 +33,13 @@ func (p *PurchaseHandler) SyncStoresSkus(ctx *jxcontext.Context, parentTask task
|
|||||||
task := tasksch.NewParallelTask("SyncStoresSkus", tasksch.NewParallelConfig().SetParallelCount(parallelCount), ctx.GetUserName(), func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
task := tasksch.NewParallelTask("SyncStoresSkus", tasksch.NewParallelConfig().SetParallelCount(parallelCount), ctx.GetUserName(), func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||||
storeID := batchItemList[0].(int)
|
storeID := batchItemList[0].(int)
|
||||||
sqlWhere := `
|
sqlWhere := `
|
||||||
WHERE (t1.deleted_at = ? OR t1.jd_sync_status <> 0) AND t1.store_id = ?
|
WHERE (t1.jd_sync_status <> 0) AND t1.store_id = ?
|
||||||
`
|
`
|
||||||
sqlWhereParams := []interface{}{
|
sqlWhereParams := []interface{}{
|
||||||
utils.DefaultTimeValue,
|
|
||||||
storeID,
|
storeID,
|
||||||
}
|
}
|
||||||
|
|
||||||
if skuIDs != nil && len(skuIDs) > 0 {
|
if len(skuIDs) > 0 {
|
||||||
sqlWhere += " AND t1.sku_id IN (" + dao.GenQuestionMarks(len(skuIDs)) + ")"
|
sqlWhere += " AND t1.sku_id IN (" + dao.GenQuestionMarks(len(skuIDs)) + ")"
|
||||||
sqlWhereParams = append(sqlWhereParams, skuIDs)
|
sqlWhereParams = append(sqlWhereParams, skuIDs)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user