30 lines
595 B
Go
30 lines
595 B
Go
package textaudit
|
|
|
|
import (
|
|
"fmt"
|
|
"service/library/configcenter"
|
|
"time"
|
|
)
|
|
|
|
var defaultTextAuditTaskScheduler *TextAuditTaskScheduler
|
|
|
|
// 文字审核任务调度器
|
|
type TextAuditTaskScheduler struct {
|
|
// 状态记录
|
|
batchId string // 当前批次号
|
|
}
|
|
|
|
func initScheduler(cfg *configcenter.TextAuditConfig) {
|
|
defaultTextAuditTaskScheduler = &TextAuditTaskScheduler{
|
|
batchId: genereteBatchId(),
|
|
}
|
|
}
|
|
|
|
// 生成批次号
|
|
func genereteBatchId() string {
|
|
now := time.Now()
|
|
y, m, d := now.Date()
|
|
h, mi, s := now.Clock()
|
|
return fmt.Sprintf("%d%02d%02d%02d%02d%02d", y, m, d, h, mi, s)
|
|
}
|