1
This commit is contained in:
parent
c70a922a8c
commit
360f7a0666
@ -44,6 +44,7 @@ type PlayerMgr interface {
|
|||||||
|
|
||||||
type Mail interface {
|
type Mail interface {
|
||||||
GetMailId() int64
|
GetMailId() int64
|
||||||
|
IsValid(Player) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type MailMgr interface{
|
type MailMgr interface{
|
||||||
|
@ -38,7 +38,7 @@ func (this *mail) isType(mailType int32) bool {
|
|||||||
return this.mailType == mailType
|
return this.mailType == mailType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *mail) isValid(hum common.Player) bool {
|
func (this *mail) IsValid(hum common.Player) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ func (this *mailMgr) caGetMailList(hum common.Player, c *gin.Context) {
|
|||||||
this.traversePlayerMail(
|
this.traversePlayerMail(
|
||||||
hum,
|
hum,
|
||||||
func (m *mail) bool {
|
func (m *mail) bool {
|
||||||
if m.isValid(hum) {
|
if m.IsValid(hum) {
|
||||||
mailDto := new(common.MailDto)
|
mailDto := new(common.MailDto)
|
||||||
if m.fillMailDto(mailDto) {
|
if m.fillMailDto(mailDto) {
|
||||||
q5.AppendSlice(&rspObj.MailList, mailDto)
|
q5.AppendSlice(&rspObj.MailList, mailDto)
|
||||||
@ -119,7 +119,7 @@ func (this *mailMgr) caMarkMail(hum common.Player, c *gin.Context) {
|
|||||||
mails := []common.Mail{}
|
mails := []common.Mail{}
|
||||||
for _, str := range(mailIds) {
|
for _, str := range(mailIds) {
|
||||||
m := this.getMail(str)
|
m := this.getMail(str)
|
||||||
if m != nil {
|
if m != nil && m.IsValid(hum) {
|
||||||
q5.AppendSlice(&mails, m)
|
q5.AppendSlice(&mails, m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ func (this *mailMgr) caGetUnreadMailCnt(hum common.Player, c *gin.Context) {
|
|||||||
this.traversePlayerMail(
|
this.traversePlayerMail(
|
||||||
hum,
|
hum,
|
||||||
func (m *mail) bool {
|
func (m *mail) bool {
|
||||||
if m.isValid(hum) {
|
if m.IsValid(hum) {
|
||||||
rspObj.UnreadMailCnt++
|
rspObj.UnreadMailCnt++
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ func (this *mailMgr) traversePlayerMail(hum common.Player, cb func(*mail) bool)
|
|||||||
stop := false
|
stop := false
|
||||||
traversFunc := 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) {
|
||||||
if !(cb(m)) {
|
if !(cb(m)) {
|
||||||
stop = true
|
stop = true
|
||||||
return false
|
return false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user