1
This commit is contained in:
parent
ad820a2f2b
commit
d3d6985a99
@ -17,3 +17,8 @@ const (
|
|||||||
MAIL_TYPE_GROUP = 2
|
MAIL_TYPE_GROUP = 2
|
||||||
MAIL_TYPE_ALL = 3
|
MAIL_TYPE_ALL = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
INBOX_STATE_READ = 1
|
||||||
|
INBOX_STATE_DELETED = 2
|
||||||
|
)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package player
|
package player
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"q5"
|
||||||
|
"f5"
|
||||||
"sync"
|
"sync"
|
||||||
"main/common"
|
"main/common"
|
||||||
|
"main/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mail struct {
|
type mail struct {
|
||||||
@ -26,6 +29,9 @@ func (this *player) init() {
|
|||||||
|
|
||||||
func (this *player) Lock() {
|
func (this *player) Lock() {
|
||||||
this.lock.Lock()
|
this.lock.Lock()
|
||||||
|
if !this.loaded {
|
||||||
|
this.load()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) UnLock() {
|
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 {
|
func newPlayer() *player {
|
||||||
p := new(player)
|
p := new(player)
|
||||||
p.init()
|
p.init()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user