by Robin at 20240227

This commit is contained in:
Leufolium 2024-02-27 02:29:15 +08:00
parent baead8176e
commit b46a911e16
2 changed files with 27 additions and 0 deletions

View File

@ -52,6 +52,7 @@ func (s *CronService) Init(c any) (err error) {
exec.RegTask("image_audit_batch_his", s.ImageAuditBatchHis)
exec.RegTask("text_audit_batch", s.TextAuditBatch)
exec.RegTask("text_audit_batch_his", s.TextAuditBatchHis)
exec.RegTask("create_veri_code", s.CreateVeriCode)
//exec.RegTask("clear_content_audit_batch_execution_logs", s.ClearContentAuditBatchExecutionLogs)
exec.LogHandler(customLogHandle)
//注册任务handler

View File

@ -9,11 +9,13 @@ import (
daily_statementproto "service/api/proto/daily_statement/proto"
streamerproto "service/api/proto/streamer/proto"
vasproto "service/api/proto/vas/proto"
vericodeproto "service/api/proto/vericode/proto"
"service/bizcommon/util"
"service/dbstruct"
"service/library/contentaudit/imageaudit"
"service/library/contentaudit/textaudit"
"service/library/logger"
"service/library/mycrypto"
"service/library/redis"
"strings"
"time"
@ -246,3 +248,27 @@ func (s *CronService) ClearContentAuditBatchExecutionLogs(ctx context.Context, p
return "clear content audit batch execution logs finished..."
}
// 每天0点定时清空图像和文字审核作业的日志
func (s *CronService) CreateVeriCode(ctx context.Context, param *xxl.RunReq) (msg string) {
logger.Info("task %v param: %v log_id: %v", param.ExecutorHandler, param.ExecutorParams, xxl.Int64ToStr(param.LogID))
mobilePhone := param.ExecutorParams
if mobilePhone == "" {
return "null mobile phone"
}
phoneHash := mycrypto.CryptoServiceInstance().SHA256.Encrypt([]byte(mobilePhone))
err := _DefaultVeriCode.OpCreate(&gin.Context{}, &vericodeproto.OpCreateReq{
VeriCode: &dbstruct.VeriCode{
PhoneHash: phoneHash,
VeriCode: "123456",
RegionCode: "86",
},
})
if err != nil {
return "create veri_code fail!"
}
return "verification code created: 123456"
}