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"
"time"
"main/constant"
"main/model/system"
)
type taskMgr struct {
@ -91,6 +92,7 @@ func (this *taskMgr) pullSysMail() {
}
func (this *taskMgr) writeMail(ds *f5.DataSet) bool {
mailId := q5.ToString(f5.GetApp().NewLockNodeUuid())
unikey := ds.GetByName("unikey")
subject := ds.GetByName("subject")
content := ds.GetByName("content")
@ -112,7 +114,7 @@ func (this *taskMgr) writeMail(ds *f5.DataSet) bool {
[][]string{
},
[][]string{
{"mail_id", q5.ToString(f5.GetApp().NewLockNodeUuid())},
{"mail_id", mailId},
{"mail_type", q5.ToString(constant.MAIL_TYPE_GROUP)},
{"unikey", unikey},
{"subject", subject},
@ -130,6 +132,16 @@ func (this *taskMgr) writeMail(ds *f5.DataSet) bool {
ok = err == nil
if err != nil {
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

View File

@ -52,13 +52,15 @@ func (this *mail) loadFromDb(ds *f5.DataSet) {
recipientsStr := ds.GetByName("recipients")
if recipientsStr != "" {
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))
}
/*
if len(recipientsList) > 0 {
this.recipients = new(sync.Map)
for _, recipient := range(recipientsList) {
//this.recipients[recipient] = 1
}*/
this.recipients.Store(recipient, 1)
}
}
}
}
}