This commit is contained in:
aozhiwei 2024-06-05 15:39:21 +08:00
parent 67140971c4
commit 9cdd25b360
2 changed files with 20 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import (
"sync" "sync"
"time" "time"
"main/constant" "main/constant"
"main/model/system"
) )
type taskMgr struct { type taskMgr struct {
@ -91,6 +92,7 @@ func (this *taskMgr) pullSysMail() {
} }
func (this *taskMgr) writeMail(ds *f5.DataSet) bool { func (this *taskMgr) writeMail(ds *f5.DataSet) bool {
mailId := q5.ToString(f5.GetApp().NewLockNodeUuid())
unikey := ds.GetByName("unikey") unikey := ds.GetByName("unikey")
subject := ds.GetByName("subject") subject := ds.GetByName("subject")
content := ds.GetByName("content") content := ds.GetByName("content")
@ -112,7 +114,7 @@ func (this *taskMgr) writeMail(ds *f5.DataSet) bool {
[][]string{ [][]string{
}, },
[][]string{ [][]string{
{"mail_id", q5.ToString(f5.GetApp().NewLockNodeUuid())}, {"mail_id", mailId},
{"mail_type", q5.ToString(constant.MAIL_TYPE_GROUP)}, {"mail_type", q5.ToString(constant.MAIL_TYPE_GROUP)},
{"unikey", unikey}, {"unikey", unikey},
{"subject", subject}, {"subject", subject},
@ -130,6 +132,16 @@ func (this *taskMgr) writeMail(ds *f5.DataSet) bool {
ok = err == nil ok = err == nil
if err != nil { if err != nil {
f5.GetSysLog().Info("writeMail err:%s", err) f5.GetSysLog().Info("writeMail err:%s", err)
} else {
{
nowDaySeconds := int32(f5.GetApp().GetRealSeconds())
e := new(system.MailEvent)
e.EventName = constant.EVENT_MAIL_UPDATE
e.Param1 = q5.ToString(mailId)
e.CreateTime = nowDaySeconds
e.ModifyTime = nowDaySeconds
f5.GetApp().GetOrmDb(constant.MAIL_DB).Create(e)
}
} }
}) })
return ok return ok

View File

@ -52,13 +52,15 @@ func (this *mail) loadFromDb(ds *f5.DataSet) {
recipientsStr := ds.GetByName("recipients") recipientsStr := ds.GetByName("recipients")
if recipientsStr != "" { if recipientsStr != "" {
recipientsList := []string{} recipientsList := []string{}
if err := q5.DecodeJson(recipientsStr, recipientsList); err != nil { if err := q5.DecodeJson(recipientsStr, &recipientsList); err != nil {
panic("mail.loadFromDb parse recipients error " + q5.ToString(this.mailId)) panic("mail.loadFromDb parse recipients error " + q5.ToString(this.mailId))
} }
/* if len(recipientsList) > 0 {
this.recipients = new(sync.Map)
for _, recipient := range(recipientsList) { for _, recipient := range(recipientsList) {
//this.recipients[recipient] = 1 this.recipients.Store(recipient, 1)
}*/ }
}
} }
} }
} }