Merge branch 'feat-hjj-AutoManuallyConfirmWorkTask'

This commit is contained in:
jiaji.H 2025-12-18 14:29:07 +08:00
commit 8127a14106

View File

@ -3,6 +3,7 @@ package dao
import (
"errors"
"fmt"
"math/rand"
"micro-bundle/internal/model"
"micro-bundle/pb/bundle"
"micro-bundle/pkg/app"
@ -537,13 +538,14 @@ func ConfirmWork(req *bundle.ConfirmWorkReq) error {
}
func GetWaitConfirmWorkList() (data []model.CastWork, err error) {
twentyFourHoursAgo := time.Now().Add(-24 * time.Hour).Format("2006-01-02 15:04:05")
randomHours := rand.Intn(22) + 1 // 1-22小时
randomTimeAgo := time.Now().Add(-time.Duration(randomHours) * time.Hour).Format("2006-01-02 15:04:05")
err = app.ModuleClients.BundleDB.Model(&model.CastWork{}).
Where("deleted_at = 0").
Where("status = ?", 4).
Where("submit_time >= ?", twentyFourHoursAgo).
Where("submit_time >= ?", randomTimeAgo).
Order("submit_time asc").
Limit(10).
Limit(5).
Find(&data).Error
if err != nil {
return