1
This commit is contained in:
parent
aa8d1e27cf
commit
ff4f33b972
@ -49,6 +49,7 @@ type PlayerMgr interface {
|
|||||||
type Mail interface {
|
type Mail interface {
|
||||||
GetMailId() int64
|
GetMailId() int64
|
||||||
IsValid(Player) bool
|
IsValid(Player) bool
|
||||||
|
HasAttachment() bool
|
||||||
GetExpireTime() int32
|
GetExpireTime() int32
|
||||||
TraverseAttachment(cb func(int32, int32))
|
TraverseAttachment(cb func(int32, int32))
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ const (
|
|||||||
INBOX_STATE_NONE = 0
|
INBOX_STATE_NONE = 0
|
||||||
INBOX_STATE_READ = 1
|
INBOX_STATE_READ = 1
|
||||||
INBOX_STATE_DELETED = 2
|
INBOX_STATE_DELETED = 2
|
||||||
|
INBOX_STATE_RECEIVED = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -77,6 +77,10 @@ func (this *mail) IsValid(hum common.Player) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *mail) HasAttachment() bool {
|
||||||
|
return len(this.attachments) > 0
|
||||||
|
}
|
||||||
|
|
||||||
func (this *mail) GetMailId() int64 {
|
func (this *mail) GetMailId() int64 {
|
||||||
return this.mailId
|
return this.mailId
|
||||||
}
|
}
|
||||||
|
@ -153,24 +153,28 @@ func (this *player) DeleteMails(mails []common.Mail) error {
|
|||||||
if m.IsValid(this) {
|
if m.IsValid(this) {
|
||||||
mi := this.getInbox(m.GetMailId())
|
mi := this.getInbox(m.GetMailId())
|
||||||
if mi == nil {
|
if mi == nil {
|
||||||
err := model.Inbox.Delete(this.GetAccountId(), m.GetMailId(), nowTime, m.GetExpireTime())
|
if m.HasAttachment() {
|
||||||
if err != nil {
|
err := model.Inbox.Delete(this.GetAccountId(), m.GetMailId(), nowTime, m.GetExpireTime())
|
||||||
resultErr = err
|
if err != nil {
|
||||||
break
|
resultErr = err
|
||||||
|
break
|
||||||
|
}
|
||||||
|
mi = new(inbox)
|
||||||
|
mi.mailId = m.GetMailId()
|
||||||
|
mi.state = constant.INBOX_STATE_DELETED
|
||||||
|
mi.expireTime = m.GetExpireTime()
|
||||||
|
this.inboxHash[mi.mailId] = mi
|
||||||
}
|
}
|
||||||
mi = new(inbox)
|
|
||||||
mi.mailId = m.GetMailId()
|
|
||||||
mi.state = constant.INBOX_STATE_DELETED
|
|
||||||
mi.expireTime = m.GetExpireTime()
|
|
||||||
this.inboxHash[mi.mailId] = mi
|
|
||||||
} else if mi.state != constant.INBOX_STATE_DELETED {
|
} else if mi.state != constant.INBOX_STATE_DELETED {
|
||||||
err := model.Inbox.Delete(this.GetAccountId(), m.GetMailId(), nowTime, m.GetExpireTime())
|
if !m.HasAttachment() || mi.state != constant.INBOX_STATE_RECEIVED {
|
||||||
if err != nil {
|
err := model.Inbox.Delete(this.GetAccountId(), m.GetMailId(), nowTime, m.GetExpireTime())
|
||||||
resultErr = err
|
if err != nil {
|
||||||
break
|
resultErr = err
|
||||||
|
break
|
||||||
|
}
|
||||||
|
mi.state = constant.INBOX_STATE_DELETED
|
||||||
|
mi.expireTime = m.GetExpireTime()
|
||||||
}
|
}
|
||||||
mi.state = constant.INBOX_STATE_DELETED
|
|
||||||
mi.expireTime = m.GetExpireTime()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user