by Robin at 20241017
This commit is contained in:
parent
8c4579d749
commit
ee3a73d695
|
@ -321,3 +321,10 @@ const (
|
|||
VideoManuallyReview_Passed = 1 //已复审通过
|
||||
VideoManuallyReview_Rejected = 2 //已复审拒绝
|
||||
)
|
||||
|
||||
// 邮件
|
||||
const (
|
||||
Email_Created = 0 // 已创建
|
||||
Email_Success = 1 // 已发送
|
||||
Email_Fail = 2 // 发送失败
|
||||
)
|
||||
|
|
|
@ -4040,6 +4040,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,
|
||||
|
@ -4059,12 +4060,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
|
||||
}
|
||||
|
||||
|
|
|
@ -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"` // 删除标记
|
||||
|
|
Loading…
Reference in New Issue