This commit is contained in:
aozhiwei 2024-04-27 20:48:07 +08:00
parent b7b3ff3598
commit 87491cc9b6
2 changed files with 11 additions and 1 deletions

View File

@ -23,7 +23,7 @@ func (this *MailApi) AddMail(c *gin.Context) {
Subject string `binding:"required" json:"subject"`
Content string `binding:"required" json:"content"`
Attachments string `binding:"required" json:"attachments"`
//To string `binding:"required" json:"to"`
Recipients string `binding:"required" json:"recipients"`
}{}
if err := c.ShouldBindJSON(&reqJson); err != nil {
c.JSON(http.StatusOK, gin.H{
@ -32,6 +32,13 @@ func (this *MailApi) AddMail(c *gin.Context) {
})
return
}
if reqJson.MailType <= constant.MAIL_TYPE_BEGIN || reqJson.MailType >= constant.MAIL_TYPE_END {
c.JSON(http.StatusOK, gin.H{
"code": 2,
"message": "mail_type参数错误",
})
return
}
mail := new(system.Mail)
mail.MailId = f5.GetApp().NewLockNodeUuid()
mail.MailType = reqJson.MailType
@ -42,5 +49,6 @@ func (this *MailApi) AddMail(c *gin.Context) {
mail.Subject = reqJson.Subject
mail.Content = reqJson.Content
mail.Attachments = reqJson.Attachments
mail.Recipients = reqJson.Recipients
f5.GetApp().GetOrmDb(constant.MAIL_DB).Create(mail)
}

View File

@ -26,6 +26,8 @@ const (
)
const (
MAIL_TYPE_BEGIN = 0
MAIL_TYPE_GROUP = 1
MAIL_TYPE_ALL = 2
MAIL_TYPE_END
)