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) {
|
func (this *mailMgr) traversePlayerMail(hum common.Player, cb func(*mail) bool) {
|
||||||
this.wholeMails.Range(
|
this.wholeMails.Range(
|
||||||
func (k, v interface {}) bool {
|
func (k, v interface {}) bool {
|
||||||
|
m := v.(*mail)
|
||||||
|
if m.isValid(hum) {
|
||||||
|
cb(m)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
this.groupMails.Range(
|
this.groupMails.Range(
|
||||||
func (k, v interface {}) bool {
|
func (k, v interface {}) bool {
|
||||||
|
m := v.(*mail)
|
||||||
|
if m.isValid(hum) {
|
||||||
|
cb(m)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
if hum, ok := this.personalMails.Load(hum.GetAccountId()); ok {
|
if p, ok := this.personalMails.Load(hum.GetAccountId()); ok {
|
||||||
(hum.(*sync.Map)).Range(
|
(p.(*sync.Map)).Range(
|
||||||
func (k, v interface{}) bool {
|
func (k, v interface{}) bool {
|
||||||
|
m := v.(*mail)
|
||||||
|
if m.isValid(hum) {
|
||||||
|
cb(m)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -138,8 +150,8 @@ func (this *mailMgr) addMail(m *mail) {
|
|||||||
} else if m.isType(constant.MAIL_TYPE_GROUP) {
|
} else if m.isType(constant.MAIL_TYPE_GROUP) {
|
||||||
this.groupMails.Store(m.mailId, m)
|
this.groupMails.Store(m.mailId, m)
|
||||||
} else if m.isType(constant.MAIL_TYPE_PERSONAL) {
|
} else if m.isType(constant.MAIL_TYPE_PERSONAL) {
|
||||||
if hum, ok := this.personalMails.Load(m.reciver); ok {
|
if p, ok := this.personalMails.Load(m.reciver); ok {
|
||||||
(hum.(*sync.Map)).Store(m.mailId, m)
|
(p.(*sync.Map)).Store(m.mailId, m)
|
||||||
} else {
|
} else {
|
||||||
p := new(sync.Map)
|
p := new(sync.Map)
|
||||||
p.Store(m.mailId, m)
|
p.Store(m.mailId, m)
|
||||||
|
@ -39,3 +39,7 @@ func (this *player) Lock() {
|
|||||||
func (this *player) UnLock() {
|
func (this *player) UnLock() {
|
||||||
this.lock.Unlock()
|
this.lock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *player) GetAccountId() string {
|
||||||
|
return this.accountId
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user