From 1e82e82da3688e9d58d720ae1c805dfe3063f00c Mon Sep 17 00:00:00 2001 From: yangduo Date: Mon, 12 Aug 2024 16:58:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/adminserver/api/v1/system/mail.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/server/adminserver/api/v1/system/mail.go b/server/adminserver/api/v1/system/mail.go index 80000edf..6ff1a12f 100644 --- a/server/adminserver/api/v1/system/mail.go +++ b/server/adminserver/api/v1/system/mail.go @@ -134,6 +134,18 @@ func (this *MailApi) AddMail(c *gin.Context) { return } + if !this.CheckAttachment(reqJson.Attachments, c) { + return + } + + if data, err := json.Marshal(reqJson.Recipients); err != nil || len(data) > 0xFFFF { + c.JSON(http.StatusOK, gin.H{ + "code": 2, + "message": "收件人过多", + }) + return + } + var count int64 = 0 if f5.GetApp().GetOrmDb(constant.MAIL_DB).Table("t_mail").Where("unikey = ?", reqJson.UniKey).Count(&count); count > 0 { c.JSON(http.StatusOK, gin.H{ @@ -143,10 +155,6 @@ func (this *MailApi) AddMail(c *gin.Context) { return } - if !this.CheckAttachment(reqJson.Attachments, c) { - return - } - s := c.MustGet("session").(common.Session) acc := s.GetAccountAddress()