This commit is contained in:
aozhiwei 2024-04-13 21:40:08 +08:00
parent 822447799d
commit 244a12b318

View File

@ -115,31 +115,27 @@ func (this *mailMgr) caDeleteMails(hum common.Player, c *gin.Context) {
} }
func (this *mailMgr) traversePlayerMail(hum common.Player, cb func(*mail) bool) { func (this *mailMgr) traversePlayerMail(hum common.Player, cb func(*mail) bool) {
this.wholeMails.Range( stop := false
func (k, v interface {}) bool { traversFunc := func (k, v interface{}) bool {
m := v.(*mail) m := v.(*mail)
if m.isValid(hum) { if m.isValid(hum) {
cb(m) if !(cb(m)) {
stop = true
return false
} }
return true }
}) return true
this.groupMails.Range( }
func (k, v interface {}) bool { this.wholeMails.Range(traversFunc)
m := v.(*mail) if stop {
if m.isValid(hum) { return
cb(m) }
} this.groupMails.Range(traversFunc)
return true if stop {
}) return
}
if p, ok := this.personalMails.Load(hum.GetAccountId()); ok { if p, ok := this.personalMails.Load(hum.GetAccountId()); ok {
(p.(*sync.Map)).Range( (p.(*sync.Map)).Range(traversFunc)
func (k, v interface{}) bool {
m := v.(*mail)
if m.isValid(hum) {
cb(m)
}
return true
})
} }
} }