调整邮件限制
This commit is contained in:
parent
0fd598d7a4
commit
867c237e87
@ -10,6 +10,7 @@ import (
|
||||
"main/mt"
|
||||
"net/http"
|
||||
"q5"
|
||||
"strings"
|
||||
|
||||
"fmt"
|
||||
|
||||
@ -138,7 +139,7 @@ func (this *MailApi) AddMail(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if !this.CheckRecipients(reqJson.Recipients, c) {
|
||||
if reqJson.MailType == jccommon.MAIL_TYPE_GROUP && !this.CheckRecipients(&reqJson.Recipients, c) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -226,7 +227,7 @@ func (this *MailApi) EditMail(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if !this.CheckRecipients(reqJson.Recipients, c) {
|
||||
if reqJson.MailType == jccommon.MAIL_TYPE_GROUP && !this.CheckRecipients(&reqJson.Recipients, c) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -343,13 +344,21 @@ func (this *MailApi) CheckAttachment(list []common.Attachment, c *gin.Context) b
|
||||
return false
|
||||
}
|
||||
|
||||
if item.ItemNum < 1 {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 2,
|
||||
"message": "item 数量错误 :" + q5.SafeToString(item.ItemId),
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
passeditem[item.ItemId] = item.ItemNum
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *MailApi) CheckRecipients(list []string, c *gin.Context) bool {
|
||||
func (this *MailApi) CheckRecipients(list *[]string, c *gin.Context) bool {
|
||||
if data, err := json.Marshal(list); err != nil || len(data) > 0xFFFF {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 2,
|
||||
@ -358,5 +367,23 @@ func (this *MailApi) CheckRecipients(list []string, c *gin.Context) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
newlist := []string{}
|
||||
for idx := range *list {
|
||||
(*list)[idx] = strings.ReplaceAll((*list)[idx], " ", "")
|
||||
if (*list)[idx] != "" {
|
||||
newlist = append(newlist, (*list)[idx])
|
||||
}
|
||||
}
|
||||
|
||||
if len(newlist) == 0 {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 2,
|
||||
"message": "收件人错误",
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
list = &newlist
|
||||
|
||||
return true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user