Merge pull request 'mainconflict' (#179) from mainconflict into main

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/179
This commit is contained in:
chenhao 2024-03-15 00:45:53 +08:00
commit a9231869d8
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.RegTask("send_contact_customer_services_of_last_minute", s.SendContactCustomerServicesOfLastMinute)
exec.LogHandler(customLogHandle)

View File

@ -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"
}