1
This commit is contained in:
parent
b74a5b808e
commit
822447799d
@ -117,15 +117,27 @@ func (this *mailMgr) caDeleteMails(hum common.Player, c *gin.Context) {
|
||||
func (this *mailMgr) traversePlayerMail(hum common.Player, cb func(*mail) bool) {
|
||||
this.wholeMails.Range(
|
||||
func (k, v interface {}) bool {
|
||||
m := v.(*mail)
|
||||
if m.isValid(hum) {
|
||||
cb(m)
|
||||
}
|
||||
return true
|
||||
})
|
||||
this.groupMails.Range(
|
||||
func (k, v interface {}) bool {
|
||||
m := v.(*mail)
|
||||
if m.isValid(hum) {
|
||||
cb(m)
|
||||
}
|
||||
return true
|
||||
})
|
||||
if hum, ok := this.personalMails.Load(hum.GetAccountId()); ok {
|
||||
(hum.(*sync.Map)).Range(
|
||||
if p, ok := this.personalMails.Load(hum.GetAccountId()); ok {
|
||||
(p.(*sync.Map)).Range(
|
||||
func (k, v interface{}) bool {
|
||||
m := v.(*mail)
|
||||
if m.isValid(hum) {
|
||||
cb(m)
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
@ -138,8 +150,8 @@ func (this *mailMgr) addMail(m *mail) {
|
||||
} else if m.isType(constant.MAIL_TYPE_GROUP) {
|
||||
this.groupMails.Store(m.mailId, m)
|
||||
} else if m.isType(constant.MAIL_TYPE_PERSONAL) {
|
||||
if hum, ok := this.personalMails.Load(m.reciver); ok {
|
||||
(hum.(*sync.Map)).Store(m.mailId, m)
|
||||
if p, ok := this.personalMails.Load(m.reciver); ok {
|
||||
(p.(*sync.Map)).Store(m.mailId, m)
|
||||
} else {
|
||||
p := new(sync.Map)
|
||||
p.Store(m.mailId, m)
|
||||
|
@ -39,3 +39,7 @@ func (this *player) Lock() {
|
||||
func (this *player) UnLock() {
|
||||
this.lock.Unlock()
|
||||
}
|
||||
|
||||
func (this *player) GetAccountId() string {
|
||||
return this.accountId
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user