This commit is contained in:
aozhiwei 2024-04-20 21:38:27 +08:00
parent c70a922a8c
commit 360f7a0666
3 changed files with 6 additions and 5 deletions

View File

@ -44,6 +44,7 @@ type PlayerMgr interface {
type Mail interface {
GetMailId() int64
IsValid(Player) bool
}
type MailMgr interface{

View File

@ -38,7 +38,7 @@ func (this *mail) isType(mailType int32) bool {
return this.mailType == mailType
}
func (this *mail) isValid(hum common.Player) bool {
func (this *mail) IsValid(hum common.Player) bool {
return true
}

View File

@ -103,7 +103,7 @@ func (this *mailMgr) caGetMailList(hum common.Player, c *gin.Context) {
this.traversePlayerMail(
hum,
func (m *mail) bool {
if m.isValid(hum) {
if m.IsValid(hum) {
mailDto := new(common.MailDto)
if m.fillMailDto(mailDto) {
q5.AppendSlice(&rspObj.MailList, mailDto)
@ -119,7 +119,7 @@ func (this *mailMgr) caMarkMail(hum common.Player, c *gin.Context) {
mails := []common.Mail{}
for _, str := range(mailIds) {
m := this.getMail(str)
if m != nil {
if m != nil && m.IsValid(hum) {
q5.AppendSlice(&mails, m)
}
}
@ -140,7 +140,7 @@ func (this *mailMgr) caGetUnreadMailCnt(hum common.Player, c *gin.Context) {
this.traversePlayerMail(
hum,
func (m *mail) bool {
if m.isValid(hum) {
if m.IsValid(hum) {
rspObj.UnreadMailCnt++
return false
}
@ -187,7 +187,7 @@ func (this *mailMgr) traversePlayerMail(hum common.Player, cb func(*mail) bool)
stop := false
traversFunc := func (k, v interface{}) bool {
m := v.(*mail)
if m.isValid(hum) {
if m.IsValid(hum) {
if !(cb(m)) {
stop = true
return false