1
This commit is contained in:
parent
87491cc9b6
commit
de3c55a8c5
@ -1,7 +1,6 @@
|
|||||||
package system
|
package system
|
||||||
|
|
||||||
import (
|
import (
|
||||||
//"q5"
|
|
||||||
"f5"
|
"f5"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
"main/model/system"
|
"main/model/system"
|
||||||
@ -16,29 +15,30 @@ type MailApi struct {
|
|||||||
func (this *MailApi) AddMail(c *gin.Context) {
|
func (this *MailApi) AddMail(c *gin.Context) {
|
||||||
reqJson := struct {
|
reqJson := struct {
|
||||||
MailType int32 `binding:"required" json:"mailtype"`
|
MailType int32 `binding:"required" json:"mailtype"`
|
||||||
SendTime int32 `binding:"required" json:"sendtime"`
|
SendTime int32 `json:"sendtime"`
|
||||||
ExpireTime int32 `binding:"required" json:"expiretime"`
|
ExpireTime int32 `json:"expiretime"`
|
||||||
UserRegStartTime int32 `binding:"required" json:"user_reg_start_time"`
|
UserRegStartTime int32 `json:"user_reg_start_time"`
|
||||||
UserRegEndTime int32 `binding:"required" json:"user_reg_end_time"`
|
UserRegEndTime int32 `json:"user_reg_end_time"`
|
||||||
Subject string `binding:"required" json:"subject"`
|
Subject string `json:"subject"`
|
||||||
Content string `binding:"required" json:"content"`
|
Content string `json:"content"`
|
||||||
Attachments string `binding:"required" json:"attachments"`
|
Attachments string `json:"attachments"`
|
||||||
Recipients string `binding:"required" json:"recipients"`
|
Recipients string `json:"recipients"`
|
||||||
}{}
|
}{}
|
||||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"code": 1,
|
"code": 1,
|
||||||
"message": err.Error(),
|
"message": err.Error(),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if reqJson.MailType <= constant.MAIL_TYPE_BEGIN || reqJson.MailType >= constant.MAIL_TYPE_END {
|
if reqJson.MailType <= constant.MAIL_TYPE_BEGIN || reqJson.MailType >= constant.MAIL_TYPE_END {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"code": 2,
|
"code": 2,
|
||||||
"message": "mail_type参数错误",
|
"message": "mail_type参数错误",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
nowDaySeconds := int32(f5.GetApp().GetRealSeconds())
|
||||||
mail := new(system.Mail)
|
mail := new(system.Mail)
|
||||||
mail.MailId = f5.GetApp().NewLockNodeUuid()
|
mail.MailId = f5.GetApp().NewLockNodeUuid()
|
||||||
mail.MailType = reqJson.MailType
|
mail.MailType = reqJson.MailType
|
||||||
@ -50,5 +50,11 @@ func (this *MailApi) AddMail(c *gin.Context) {
|
|||||||
mail.Content = reqJson.Content
|
mail.Content = reqJson.Content
|
||||||
mail.Attachments = reqJson.Attachments
|
mail.Attachments = reqJson.Attachments
|
||||||
mail.Recipients = reqJson.Recipients
|
mail.Recipients = reqJson.Recipients
|
||||||
|
mail.CreateTime = nowDaySeconds
|
||||||
|
mail.ModifyTime = nowDaySeconds
|
||||||
f5.GetApp().GetOrmDb(constant.MAIL_DB).Create(mail)
|
f5.GetApp().GetOrmDb(constant.MAIL_DB).Create(mail)
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": 0,
|
||||||
|
"message": "",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user