diff --git a/app/mix/service/cronservice.go b/app/mix/service/cronservice.go index 691cb46d..a5b1a054 100644 --- a/app/mix/service/cronservice.go +++ b/app/mix/service/cronservice.go @@ -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 diff --git a/app/mix/service/xxljob_tasks.go b/app/mix/service/xxljob_tasks.go index d5aedafd..341d2e7a 100644 --- a/app/mix/service/xxljob_tasks.go +++ b/app/mix/service/xxljob_tasks.go @@ -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" +}