This commit is contained in:
aozhiwei 2024-05-09 16:20:05 +08:00
parent 2792145d0f
commit 4b546e7709
2 changed files with 25 additions and 3 deletions

View File

@ -108,6 +108,24 @@ func (this *mail) fillMailDto(p *common.MailDto) bool {
return true
}
func (this* mail) isMailUser(accountId string) bool {
{
p := this.recipients
if p != nil {
if _, ok := p.Load(accountId); ok {
return true
}
}
}
{
this.traverseUserGroup(
func (groupId int64, group *userGroup) bool {
return true
})
}
return false
}
func (this *mail) traverseRecipients(cb func(string) bool) {
p := this.recipients
if p != nil {
@ -117,11 +135,15 @@ func (this *mail) traverseRecipients(cb func(string) bool) {
}
}
func (this *mail) traverseUserGroup(cb func(int64) bool) {
func (this *mail) traverseUserGroup(cb func(int64, *userGroup) bool) {
p := this.userGroups
if p != nil {
p.Range(func (k, v interface{}) bool {
return cb(k.(int64))
if v != nil {
return cb(k.(int64), v.(*userGroup))
} else {
return cb(k.(int64), nil)
}
})
}
}

View File

@ -234,7 +234,7 @@ func (this *mailMgr) addMail(m *mail) {
this.wholeMails.Store(m.mailId, m)
} else if m.isType(constant.MAIL_TYPE_GROUP) {
m.traverseUserGroup(
func (int64) bool {
func (int64, *userGroup) bool {
this.groupMails.Store(m.mailId, m)
return false
})