This commit is contained in:
aozhiwei 2024-04-27 19:52:52 +08:00
parent 2a69d7d586
commit 9ced4ea440
3 changed files with 38 additions and 3 deletions

View File

@ -41,8 +41,8 @@ CREATE TABLE `t_mail` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`mail_id` bigint NOT NULL COMMENT '邮件id',
`mail_type` int(11) NOT NULL DEFAULT '0' COMMENT '邮件类型',
`subject` mediumblob COMMENT 'subject',
`content` mediumblob COMMENT '消息内容',
`subject` text NOT NULL DEFAULT '' COMMENT 'subject',
`content` text NOT NULL DEFAULT '' COMMENT '消息内容',
`reciver` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '收件人',
`attachments` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '附件',
`deleted` int(11) NOT NULL DEFAULT '0' COMMENT '是否已删除',

View File

@ -1,17 +1,46 @@
package system
import (
//"q5"
"f5"
"main/constant"
"main/model/system"
"net/http"
"github.com/gin-gonic/gin"
)
type MailApi struct {
}
func (this *MailApi) AddMail(c *gin.Context) {
reqJson := struct {
MailType int32 `binding:"required" json:"mailtype"`
SendTime int32 `binding:"required" json:"sendtime"`
ExpireTime int32 `binding:"required" json:"expiretime"`
UserRegStartTime int32 `binding:"required" json:"user_reg_start_time"`
UserRegEndTime int32 `binding:"required" json:"user_reg_end_time"`
Subject string `binding:"required" json:"subject"`
Content string `binding:"required" json:"content"`
Attachments string `binding:"required" json:"attachments"`
//To string `binding:"required" json:"to"`
}{}
if err := c.ShouldBindJSON(&reqJson); err != nil {
c.JSON(http.StatusOK, gin.H{
"code": 1,
"message": err.Error(),
})
return
}
mail := new(system.Mail)
f5.GetSysLog().Info("AddMail")
mail.MailId = f5.GetApp().NewLockNodeUuid()
mail.MailType = reqJson.MailType
mail.SendTime = reqJson.SendTime
mail.ExpireTime = reqJson.ExpireTime
mail.UserRegStartTime = reqJson.UserRegStartTime
mail.UserRegEndTime = reqJson.UserRegEndTime
mail.Subject = reqJson.Subject
mail.Content = reqJson.Content
mail.Attachments = reqJson.Attachments
f5.GetApp().GetOrmDb(constant.MAIL_DB).Create(mail)
}

View File

@ -24,3 +24,9 @@ const (
API_MAIL_HOST_DEV = "localhost:9992"
EMAIL_KEY = "520d8eeb8cf1d833a42c820432c020b2fd60f4b7|" + EMAIL_URL_DEV
)
const (
MAIL_TYPE_PERSONAL = 1
MAIL_TYPE_GROUP = 2
MAIL_TYPE_ALL = 3
)