This commit is contained in:
aozhiwei 2024-04-20 22:20:31 +08:00
parent 360f7a0666
commit 1f4d3b2853
2 changed files with 41 additions and 7 deletions

View File

@ -30,12 +30,11 @@ type App interface {
type Player interface {
Lock()
UnLock()
GetHashCode() uint32
GetAccountId() string
MarkMails([]Mail)
GetAttachment([]Mail)
DeleteMails([]Mail)
MarkMails([]Mail) error
GetAttachment([]Mail) error
DeleteMails([]Mail) error
}
type PlayerMgr interface {

View File

@ -42,16 +42,43 @@ func (this *player) GetAccountId() string {
return this.accountId
}
func (this *player) MarkMails(mails []common.Mail) {
func (this *player) MarkMails(mails []common.Mail) error {
this.checkLock()
var resultErr error
for _, m := range(mails) {
if m.IsValid(this) {
mi := this.getInbox(m.GetMailId())
if mi == nil {
f5.GetGoStyleDb().Upsert(
constant.MAIL_DB,
"t_inbox",
[][]string{
},
[][]string{
},
[][]string{
},
func (err error, lastInsertId int64, rowsAffected int64) {
})
}
}
}
return resultErr
}
func (this *player) GetAttachment(mails []common.Mail) {
func (this *player) GetAttachment(mails []common.Mail) error {
this.checkLock()
var resultErr error
return resultErr
}
func (this *player) DeleteMails(mails []common.Mail) {
func (this *player) DeleteMails(mails []common.Mail) error {
this.checkLock()
var resultErr error
return resultErr
}
func (this *player) checkLock() {
@ -83,6 +110,14 @@ func (this *player) load() {
})
}
func (this *player) getInbox(mailId int64) *inbox {
if m, ok := this.inboxHash[mailId]; ok {
return m
} else {
return nil
}
}
func newPlayer() *player {
p := new(player)
p.init()