1
This commit is contained in:
parent
ad820a2f2b
commit
d3d6985a99
@ -17,3 +17,8 @@ const (
|
||||
MAIL_TYPE_GROUP = 2
|
||||
MAIL_TYPE_ALL = 3
|
||||
)
|
||||
|
||||
const (
|
||||
INBOX_STATE_READ = 1
|
||||
INBOX_STATE_DELETED = 2
|
||||
)
|
||||
|
@ -1,8 +1,11 @@
|
||||
package player
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"sync"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type mail struct {
|
||||
@ -26,6 +29,9 @@ func (this *player) init() {
|
||||
|
||||
func (this *player) Lock() {
|
||||
this.lock.Lock()
|
||||
if !this.loaded {
|
||||
this.load()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *player) UnLock() {
|
||||
@ -54,6 +60,29 @@ func (this *player) checkLock() {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *player) load() {
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.MAIL_DB,
|
||||
"SELECT * FROM t_inbox WHERE account_id=? AND expiretime>?",
|
||||
[]string{
|
||||
this.GetAccountId(),
|
||||
q5.ToString(f5.GetApp().GetNowSeconds() - 3600 * 24 * 1),
|
||||
},
|
||||
func (err error, ds *f5.DataSet) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for ds.Next() {
|
||||
p := new(mail)
|
||||
p.mailId = q5.ToInt64(ds.GetByName("mail_id"))
|
||||
p.state = q5.ToInt32(ds.GetByName("state"))
|
||||
p.expireTime = q5.ToInt32(ds.GetByName("expiretime"))
|
||||
this.mailHash[p.mailId] = p
|
||||
}
|
||||
this.loaded = true
|
||||
})
|
||||
}
|
||||
|
||||
func newPlayer() *player {
|
||||
p := new(player)
|
||||
p.init()
|
||||
|
Loading…
x
Reference in New Issue
Block a user