调整
This commit is contained in:
parent
1429e48d52
commit
5b379b66b0
@ -138,11 +138,7 @@ func (this *MailApi) AddMail(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if data, err := json.Marshal(reqJson.Recipients); err != nil || len(data) > 0xFFFF {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 2,
|
||||
"message": "收件人过多",
|
||||
})
|
||||
if !this.CheckRecipients(reqJson.Recipients, c) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -230,11 +226,7 @@ func (this *MailApi) EditMail(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if data, err := json.Marshal(reqJson.Recipients); err != nil || len(data) > 0xFFFF {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 2,
|
||||
"message": "收件人过多",
|
||||
})
|
||||
if !this.CheckRecipients(reqJson.Recipients, c) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -317,7 +309,7 @@ func (this *MailApi) DelMail(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (this *MailApi) CheckAttachment(list []common.Attachment, c *gin.Context) bool {
|
||||
if len(list) > 7 {
|
||||
if data, err := json.Marshal(list); err != nil || len(data) > 0xFF {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 2,
|
||||
"message": "附件过多",
|
||||
@ -325,7 +317,16 @@ func (this *MailApi) CheckAttachment(list []common.Attachment, c *gin.Context) b
|
||||
return false
|
||||
}
|
||||
|
||||
passeditem := map[int32]int32{}
|
||||
for _, item := range list {
|
||||
if _, exist := passeditem[item.ItemId]; exist {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 2,
|
||||
"message": "重复的item id:" + q5.SafeToString(item.ItemId),
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
if !mt.Table.Item.Search(item.ItemId) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 2,
|
||||
@ -341,6 +342,20 @@ func (this *MailApi) CheckAttachment(list []common.Attachment, c *gin.Context) b
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
passeditem[item.ItemId] = item.ItemNum
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
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,
|
||||
"message": "收件人过多",
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user