This commit is contained in:
殷勇 2023-11-01 14:10:50 +08:00
parent 0c69679e5d
commit 90da74ed6c
2 changed files with 27 additions and 33 deletions

View File

@ -63,7 +63,7 @@ func (api *MailMgrApi) SendMail(c *gin.Context) {
return
}
sql := fmt.Sprintf("INSERT INTO mailbox SET gameid=%d, mailid=%d, mailtype=%d, mailsubtype=%d, _to=%s, subject=%s, content=%s, deleted=0, attachments=%s, sendtime=%d, expiretime=%d, createtime=%d, modifytime=%d, ext=%s, usertype=%d",
sql := fmt.Sprintf("INSERT INTO mailbox SET gameid=%d, mailid=%d, mailtype=%d, mailsubtype=%d, _to='%s', subject='%s', content='%s', deleted=0, attachments='%s', sendtime=%d, expiretime=%d, createtime=%d, modifytime=%d, ext='%s', usertype=%d",
req.GameId,
mailId,
req.MailType,
@ -86,7 +86,6 @@ func (api *MailMgrApi) SendMail(c *gin.Context) {
f5.GetSysLog().Info("SendMail err:%v \n", err)
return
}
if rows.Next() {
newMail := mail.NewMail()
newMail.GameId = req.GameId
newMail.MailId = mailId
@ -103,7 +102,6 @@ func (api *MailMgrApi) SendMail(c *gin.Context) {
newMail.Ext = req.EXT
newMail.ParseAttachments(req.Attachments)
GetMailMgr().AddMail(newMail)
}
},
)
@ -151,9 +149,7 @@ func (api *MailMgrApi) DeleteMail(c *gin.Context) {
f5.GetSysLog().Info("DeleteMail err:%v \n", err)
return
}
if rows.Next() {
GetMailMgr().InternalGMDeleteMail(req.MailId)
}
},
)
@ -206,7 +202,7 @@ func (api *MailMgrApi) UpdateMail(c *gin.Context) {
return
}
sql := fmt.Sprintf("UPDATE mailbox SET content=%s,subject=%s,sendtime=%d,expiretime=%d,ext=%s, attachments=%s, WHERE mailid=%d", req.Content, req.Subject, req.SendTime, req.ExpireTime, req.EXT, req.Attachments, req.MailId)
sql := fmt.Sprintf("UPDATE mailbox SET content='%s',subject='%s',sendtime=%d,expiretime=%d,ext='%s', attachments='%s' WHERE mailid=%d", req.Content, req.Subject, req.SendTime, req.ExpireTime, req.EXT, req.Attachments, req.MailId)
f5.GetGoStyleDb().SyncSelectCustomQuery(
constant.MAIL_DB,
sql,
@ -215,14 +211,12 @@ func (api *MailMgrApi) UpdateMail(c *gin.Context) {
f5.GetSysLog().Info("UpdateMail err:%v \n", err)
return
}
if rows.Next() {
m.Content = req.Content
m.Subject = req.Subject
m.SendTime = req.SendTime
m.ExpireTime = req.ExpireTime
m.Ext = req.EXT
m.ParseAttachments(req.Attachments)
}
},
)

View File

@ -16,7 +16,7 @@ type Attachment struct {
// GMMail mail mgr
type GMMail struct {
GameId int `json:"gameid"`
MailId int64 `json:"mailid"`
MailId int64 `json:"mailid,string"`
From string `json:"from"`
To string `json:"to"`
Subject string `json:"subject"`
@ -31,7 +31,7 @@ type GMMail struct {
type Mail struct {
GameId int `json:"-"`
MailId int64 `json:"mailid"`
MailId int64 `json:"mailid,string"`
From string `json:"from"`
To string `json:"to"`
Subject string `json:"subject"`