save
This commit is contained in:
parent
0c69679e5d
commit
90da74ed6c
@ -63,7 +63,7 @@ func (api *MailMgrApi) SendMail(c *gin.Context) {
|
|||||||
return
|
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,
|
req.GameId,
|
||||||
mailId,
|
mailId,
|
||||||
req.MailType,
|
req.MailType,
|
||||||
@ -86,24 +86,22 @@ func (api *MailMgrApi) SendMail(c *gin.Context) {
|
|||||||
f5.GetSysLog().Info("SendMail err:%v \n", err)
|
f5.GetSysLog().Info("SendMail err:%v \n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rows.Next() {
|
newMail := mail.NewMail()
|
||||||
newMail := mail.NewMail()
|
newMail.GameId = req.GameId
|
||||||
newMail.GameId = req.GameId
|
newMail.MailId = mailId
|
||||||
newMail.MailId = mailId
|
newMail.From = req.From
|
||||||
newMail.From = req.From
|
newMail.To = req.To
|
||||||
newMail.To = req.To
|
newMail.Subject = req.Subject
|
||||||
newMail.Subject = req.Subject
|
newMail.Content = req.Content
|
||||||
newMail.Content = req.Content
|
newMail.MailType = req.MailType
|
||||||
newMail.MailType = req.MailType
|
newMail.MailSubType = req.MailSubType
|
||||||
newMail.MailSubType = req.MailSubType
|
newMail.UserType = req.UserType
|
||||||
newMail.UserType = req.UserType
|
newMail.SendTime = req.SendTime
|
||||||
newMail.SendTime = req.SendTime
|
newMail.ExpireTime = req.ExpireTime
|
||||||
newMail.ExpireTime = req.ExpireTime
|
newMail.CreateTime = nowUnixSec
|
||||||
newMail.CreateTime = nowUnixSec
|
newMail.Ext = req.EXT
|
||||||
newMail.Ext = req.EXT
|
newMail.ParseAttachments(req.Attachments)
|
||||||
newMail.ParseAttachments(req.Attachments)
|
GetMailMgr().AddMail(newMail)
|
||||||
GetMailMgr().AddMail(newMail)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -151,9 +149,7 @@ func (api *MailMgrApi) DeleteMail(c *gin.Context) {
|
|||||||
f5.GetSysLog().Info("DeleteMail err:%v \n", err)
|
f5.GetSysLog().Info("DeleteMail err:%v \n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rows.Next() {
|
GetMailMgr().InternalGMDeleteMail(req.MailId)
|
||||||
GetMailMgr().InternalGMDeleteMail(req.MailId)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -206,7 +202,7 @@ func (api *MailMgrApi) UpdateMail(c *gin.Context) {
|
|||||||
return
|
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(
|
f5.GetGoStyleDb().SyncSelectCustomQuery(
|
||||||
constant.MAIL_DB,
|
constant.MAIL_DB,
|
||||||
sql,
|
sql,
|
||||||
@ -215,14 +211,12 @@ func (api *MailMgrApi) UpdateMail(c *gin.Context) {
|
|||||||
f5.GetSysLog().Info("UpdateMail err:%v \n", err)
|
f5.GetSysLog().Info("UpdateMail err:%v \n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rows.Next() {
|
m.Content = req.Content
|
||||||
m.Content = req.Content
|
m.Subject = req.Subject
|
||||||
m.Subject = req.Subject
|
m.SendTime = req.SendTime
|
||||||
m.SendTime = req.SendTime
|
m.ExpireTime = req.ExpireTime
|
||||||
m.ExpireTime = req.ExpireTime
|
m.Ext = req.EXT
|
||||||
m.Ext = req.EXT
|
m.ParseAttachments(req.Attachments)
|
||||||
m.ParseAttachments(req.Attachments)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ type Attachment struct {
|
|||||||
// GMMail mail mgr
|
// GMMail mail mgr
|
||||||
type GMMail struct {
|
type GMMail struct {
|
||||||
GameId int `json:"gameid"`
|
GameId int `json:"gameid"`
|
||||||
MailId int64 `json:"mailid"`
|
MailId int64 `json:"mailid,string"`
|
||||||
From string `json:"from"`
|
From string `json:"from"`
|
||||||
To string `json:"to"`
|
To string `json:"to"`
|
||||||
Subject string `json:"subject"`
|
Subject string `json:"subject"`
|
||||||
@ -31,7 +31,7 @@ type GMMail struct {
|
|||||||
|
|
||||||
type Mail struct {
|
type Mail struct {
|
||||||
GameId int `json:"-"`
|
GameId int `json:"-"`
|
||||||
MailId int64 `json:"mailid"`
|
MailId int64 `json:"mailid,string"`
|
||||||
From string `json:"from"`
|
From string `json:"from"`
|
||||||
To string `json:"to"`
|
To string `json:"to"`
|
||||||
Subject string `json:"subject"`
|
Subject string `json:"subject"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user