diff --git a/app/mix/service/cronservice.go b/app/mix/service/cronservice.go index fcc24b6b..4cc28e57 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.RegTask("send_contact_customer_services_of_last_minute", s.SendContactCustomerServicesOfLastMinute) exec.LogHandler(customLogHandle) diff --git a/app/mix/service/xxljob_tasks.go b/app/mix/service/xxljob_tasks.go index 94427118..fa8ad7d1 100644 --- a/app/mix/service/xxljob_tasks.go +++ b/app/mix/service/xxljob_tasks.go @@ -10,12 +10,14 @@ 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/dingtalk" "service/library/logger" + "service/library/mycrypto" "service/library/redis" "strings" "time" @@ -297,3 +299,27 @@ func (s *CronService) SendContactCustomerServicesOfLastMinute(ctx context.Contex return "Message send success" } + +// 每天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" +}