diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 2ff8e0a2c..77c3e1e39 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -1,6 +1,7 @@ package misc import ( + "git.rosy.net.cn/jx-callback/business/jxstore/partner/pdd" "time" "git.rosy.net.cn/jx-callback/business/jxstore/event" @@ -24,6 +25,12 @@ var ( func Init() { if globals.IsProductEnv() { + + //拼多多订单轮询 + ScheduleTimerFuncByInterval(func() { + pdd.GetUnionOrders() + }, 5*time.Second, 5*time.Minute) + ScheduleTimerFunc("doDailyWork", doDailyWork, dailyWorkTimeList) ScheduleTimerFunc("InitStation", func() { diff --git a/business/jxstore/partner/pdd/union.go b/business/jxstore/partner/pdd/union.go index ff7c1a0f5..ac86c404b 100644 --- a/business/jxstore/partner/pdd/union.go +++ b/business/jxstore/partner/pdd/union.go @@ -5,10 +5,14 @@ import ( "git.rosy.net.cn/baseapi/platformapi/pddapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxstore/partner" + "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" + "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" "git.rosy.net.cn/jx-callback/business/model" + "git.rosy.net.cn/jx-callback/business/model/dao" "git.rosy.net.cn/jx-callback/globals/api" "strings" + "time" ) var ( @@ -181,3 +185,22 @@ func (s *UnionHandler) GetUnionMatterListRcmmd(ctx *jxcontext.Context, goodsID s } return list, err } + +func GetUnionOrders() { + var ( + page = 1 + pageSize = 50 + ) + orders, err := api.PddAPI.OrderListIncrementGet(time.Now().Add(-time.Minute*5).Unix(), time.Now().Unix(), page, pageSize) + if err != nil { + return + } + task := tasksch.NewParallelTask("TempJob1", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + order := batchItemList[0].(*pddapi.OrderListIncrementGetResult) + + return retVal, err + }, orders) + tasksch.HandleTask(task, nil, true).Run() + task.GetResult(0) +}