a
This commit is contained in:
@@ -1051,28 +1051,22 @@ func ResetJobTimers() {
|
|||||||
task := tasksch.NewParallelTask("ResetJobTimers", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), jxcontext.AdminCtx,
|
task := tasksch.NewParallelTask("ResetJobTimers", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), jxcontext.AdminCtx,
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
jobTimer := batchItemList[0].(*model.JobTimer)
|
jobTimer := batchItemList[0].(*model.JobTimer)
|
||||||
switch jobTimer.Type {
|
timer := time.NewTimer(jobTimer.StartAt.Add(time.Duration(jobTimer.LimitAt) * time.Hour).Sub(time.Now()))
|
||||||
case model.JobTimerTypeAccept:
|
jobOrders, err := dao.GetJobOrdersNoPage(db, jobTimer.JobID, jobTimer.JobOrderID, "", "", utils.ZeroTimeValue, utils.ZeroTimeValue, nil)
|
||||||
timer := time.NewTimer(jobTimer.StartAt.Add(time.Duration(jobTimer.LimitAt) * time.Hour).Sub(time.Now()))
|
if err != nil {
|
||||||
jobOrders, err := dao.GetJobOrdersNoPage(db, jobTimer.JobID, jobTimer.JobOrderID, "", "", utils.ZeroTimeValue, utils.ZeroTimeValue, nil)
|
|
||||||
if err != nil {
|
|
||||||
return retVal, err
|
|
||||||
}
|
|
||||||
utils.CallFuncAsync(func() {
|
|
||||||
select {
|
|
||||||
case <-timer.C:
|
|
||||||
switch jobTimer.Type {
|
|
||||||
case model.JobTimerTypeAccept:
|
|
||||||
UpdateLimitJobOrders(db, timer, jobTimer.JobID, jobOrders[0], jobTimer)
|
|
||||||
case model.JobTimerTypeSubmit:
|
|
||||||
UpdateLimitAuditJobOrders(db, timer, jobTimer.JobID, jobOrders[0], jobTimer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
case model.JobTimerTypeSubmit:
|
|
||||||
default:
|
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}
|
}
|
||||||
|
utils.CallFuncAsync(func() {
|
||||||
|
select {
|
||||||
|
case <-timer.C:
|
||||||
|
switch jobTimer.Type {
|
||||||
|
case model.JobTimerTypeAccept:
|
||||||
|
UpdateLimitJobOrders(db, timer, jobTimer.JobID, jobOrders[0], jobTimer)
|
||||||
|
case model.JobTimerTypeSubmit:
|
||||||
|
UpdateLimitAuditJobOrders(db, timer, jobTimer.JobID, jobOrders[0], jobTimer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}, jobTimers)
|
}, jobTimers)
|
||||||
tasksch.HandleTask(task, nil, true).Run()
|
tasksch.HandleTask(task, nil, true).Run()
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ const (
|
|||||||
|
|
||||||
JobCategoryIDwmtg = 3 //任务类型外卖推广
|
JobCategoryIDwmtg = 3 //任务类型外卖推广
|
||||||
JobCategoryIDOther = 4 //其他任务类型
|
JobCategoryIDOther = 4 //其他任务类型
|
||||||
|
|
||||||
|
JobSpanTop = 1 //置顶
|
||||||
|
JobSpanRecommend = 2 //推荐
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -57,7 +60,7 @@ type Job struct {
|
|||||||
|
|
||||||
UserID string `orm:"column(user_id)" json:"userID"` //发布人ID
|
UserID string `orm:"column(user_id)" json:"userID"` //发布人ID
|
||||||
JobCategoryID int `orm:"column(job_category_id)" json:"jobCategoryID"` //任务类型
|
JobCategoryID int `orm:"column(job_category_id)" json:"jobCategoryID"` //任务类型
|
||||||
JobSpan string `orm:"size(500)" json:"jobSpan"` //任务标签
|
JobSpan int `json:"jobSpan"` //任务标签
|
||||||
Title string `orm:"size(255)" json:"title"` //任务标题
|
Title string `orm:"size(255)" json:"title"` //任务标题
|
||||||
Content string `orm:"size(500)" json:"content"` //任务内容
|
Content string `orm:"size(500)" json:"content"` //任务内容
|
||||||
Count int `json:"count"` //任务数量
|
Count int `json:"count"` //任务数量
|
||||||
|
|||||||
Reference in New Issue
Block a user