This commit is contained in:
aozhiwei 2024-05-06 11:46:20 +08:00
parent be299ef07c
commit 9f395295f0
2 changed files with 23 additions and 0 deletions

View File

@ -53,6 +53,10 @@ SMLogin
用户组
增删改
事件类型
邮件:新增、变更、删除
用户组:新增、变更、删除
# 参考
https://gorm.io/zh_CN/docs/

View File

@ -21,9 +21,11 @@ type mailMgr struct {
groupMails sync.Map //int64 => *mail
personalMails sync.Map //string => sync.Map<int64, *mail>
groupHash sync.Map //int64 => *userGroup
lastSyncEventIdx int64
}
func (this *mailMgr) Init() {
this.syncEvent()
this.loadMails()
this.loadGroups()
this.loadGroupMembers()
@ -265,3 +267,20 @@ func (this *mailMgr) internalGetMail(mailId string) *mail {
return nil
}
}
func (this *mailMgr) syncEvent() {
f5.GetGoStyleDb().SyncSelectCustomQuery(
constant.MAIL_DB,
"SELECT MAX(idx) FROM t_event;",
func(err error, ds *f5.DataSet) {
if err != nil {
panic("sync event error")
return
}
if ds.Next() {
this.lastSyncEventIdx = q5.ToInt64(ds.GetByIndex(0))
} else {
panic("sync event error")
}
});
}