Merge branch 'feat-IRONFANS-210-Robin' into conf-IRONFANS-210

This commit is contained in:
Leufolium 2024-10-17 11:24:22 +08:00
commit 2df2341e6b
3 changed files with 31 additions and 6 deletions

View File

@ -322,6 +322,13 @@ const (
VideoManuallyReview_Rejected = 2 //已复审拒绝
)
// 邮件
const (
Email_Created = 0 // 已创建
Email_Success = 1 // 已发送
Email_Fail = 2 // 发送失败
)
// 系统通知表的已读状态
const (
Notification_NotRead = 0 //未读

View File

@ -4256,6 +4256,7 @@ func (s *Service) ApiSendRavenIQTestResultAsEmail(ctx *gin.Context, req *emailpr
req.Email.From = goproto.String(emailInfoCfg.Address)
req.Email.Subject = goproto.String(emailContentCfg.Subject)
req.Email.Text = goproto.String(emailContentCfg.Text)
req.Email.Status = goproto.Int64(consts.Email_Created)
err = _DefaultEmail.OpCreate(ctx, &emailproto.OpCreateReq{
BaseRequest: req.BaseRequest,
@ -4275,12 +4276,28 @@ func (s *Service) ApiSendRavenIQTestResultAsEmail(ctx *gin.Context, req *emailpr
return
}
err = email.SendRavenIQTestResult(req.Email, emailInfoCfg.Host, emailInfoCfg.Port, emailInfoCfg.Address, emailInfoCfg.Password)
if err != nil {
logger.Error("SendRavenIQTestResult fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeEmailSrvFail
return
}
go func() {
err = email.SendRavenIQTestResult(req.Email, emailInfoCfg.Host, emailInfoCfg.Port, emailInfoCfg.Address, emailInfoCfg.Password)
if err != nil {
logger.Error("SendRavenIQTestResult fail, req: %v, err: %v", util.ToJson(req), err)
// 更新状态为失败
_DefaultEmail.OpUpdate(ctx, &emailproto.OpUpdateReq{
Email: &dbstruct.Email{
Id: req.Id,
Status: goproto.Int64(consts.Email_Fail),
},
})
return
}
// 更新状态为成功
_DefaultEmail.OpUpdate(ctx, &emailproto.OpUpdateReq{
Email: &dbstruct.Email{
Id: req.Id,
Status: goproto.Int64(consts.Email_Success),
},
})
}()
return
}

View File

@ -8,6 +8,7 @@ type Email struct {
Subject *string `json:"subject" bson:"subject"` // 标题
Text *string `json:"text" bson:"text"` // 文本
MediaComponent *MediaComponent `json:"media_component" bson:"media_component"` // 媒体
Status *int64 `json:"status" bson:"status"` // 状态
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记