This commit is contained in:
aozhiwei 2024-04-13 18:05:05 +08:00
parent 619efdb644
commit 5c0474861b

View File

@ -32,6 +32,8 @@ func (this *mailMgr) Init() {
this.allMails = make(map[int64]*mail)
this.groupHash = make(map[int64]*userGroup)
this.loadMails()
this.loadGroups()
this.loadGroupMembers()
}
func (this *mailMgr) UnInit() {
@ -56,6 +58,42 @@ func (this *mailMgr) loadMails() {
len(this.idHash))
}
func (this *mailMgr) loadGroups() {
f5.GetSysLog().Info("mailMgr.loadGroups begin")
lastIdx := f5.GetJsStyleDb().SyncBatchLoadFullTable(
constant.MAIL_DB,
"SELECT * FROM t_group WHERE idx > %d AND deleted = 0",
func (ds *f5.DataSet) {
p := newMail()
p.loadFromDb(ds)
this.addMail(p)
},
func (err error) {
panic(fmt.Sprintf("mailMgr.loadGroups dberror:%s", err))
})
f5.GetSysLog().Info("mailMgr.loadGroups end lastIdx:%d mailNum:%d",
lastIdx,
len(this.idHash))
}
func (this *mailMgr) loadGroupMembers() {
f5.GetSysLog().Info("mailMgr.loadGroupMembers begin")
lastIdx := f5.GetJsStyleDb().SyncBatchLoadFullTable(
constant.MAIL_DB,
"SELECT * FROM t_member WHERE idx > %d AND deleted = 0",
func (ds *f5.DataSet) {
p := newMail()
p.loadFromDb(ds)
this.addMail(p)
},
func (err error) {
panic(fmt.Sprintf("mailMgr.loadGroupMembers dberror:%s", err))
})
f5.GetSysLog().Info("mailMgr.loadGroupMembers end lastIdx:%d mailNum:%d",
lastIdx,
len(this.idHash))
}
func (this *mailMgr) caGetMailList(hum common.Player, c *gin.Context) {
}