This commit is contained in:
aozhiwei 2024-04-13 19:46:46 +08:00
parent 0842cce776
commit 2e4eb3a61c
3 changed files with 13 additions and 22 deletions

View File

@ -43,6 +43,11 @@ SMLogin
用户群创建时间range(开始时间,结束时间)
用户群指定账号列表
邮件
增删改
用户组
增删改
# 参考
https://gorm.io/zh_CN/docs/

View File

@ -2,7 +2,6 @@ package mail
import (
"f5"
"sync"
//"main/common"
//"main/constant"
//"q5"
@ -15,7 +14,6 @@ type attachment struct {
}
type mail struct {
lock sync.Mutex
mailId int64
mailType int32
subject string
@ -25,7 +23,7 @@ type mail struct {
userRegStart int32
userRegEnd int32
attachments []*attachment
userGroups map[int64]*userGroup
userGroups []int64
reciver string
}
@ -33,14 +31,6 @@ func (this *mail) init() {
}
func (this *mail) Lock() {
this.lock.Lock()
}
func (this *mail) Unlock() {
this.lock.Unlock()
}
func (this *mail) loadFromDb(ds *f5.DataSet) {
}

View File

@ -17,20 +17,17 @@ type groupMail struct {
type userGroup struct {
groupId int64
mailHash map[int64]*mail
userHash map[string]int64
}
type mailMgr struct {
idHash map[int64]*mail
wholeMails map[int64]*mail
idHash sync.Map
wholeMails sync.Map
groupMails [1024]*groupMail
groupHash map[int64]*userGroup
}
func (this *mailMgr) Init() {
this.idHash = make(map[int64]*mail)
this.wholeMails = make(map[int64]*mail)
this.groupHash = make(map[int64]*userGroup)
this.loadMails()
this.loadGroups()
@ -56,7 +53,7 @@ func (this *mailMgr) loadMails() {
})
f5.GetSysLog().Info("mailMgr.loadMails end lastIdx:%d mailNum:%d",
lastIdx,
len(this.idHash))
q5.GetSyncMapSize(this.idHash))
}
func (this *mailMgr) loadGroups() {
@ -71,7 +68,6 @@ func (this *mailMgr) loadGroups() {
}
p := new(userGroup)
p.groupId = groupId
p.mailHash = make(map[int64]*mail)
p.userHash = make(map[string]int64)
this.groupHash[p.groupId] = p
},
@ -80,7 +76,7 @@ func (this *mailMgr) loadGroups() {
})
f5.GetSysLog().Info("mailMgr.loadGroups end lastIdx:%d mailNum:%d",
lastIdx,
len(this.idHash))
q5.GetSyncMapSize(this.idHash))
}
func (this *mailMgr) loadGroupMembers() {
@ -101,7 +97,7 @@ func (this *mailMgr) loadGroupMembers() {
})
f5.GetSysLog().Info("mailMgr.loadGroupMembers end lastIdx:%d mailNum:%d",
lastIdx,
len(this.idHash))
q5.GetSyncMapSize(this.idHash))
}
func (this *mailMgr) caGetMailList(hum common.Player, c *gin.Context) {
@ -129,9 +125,9 @@ func (this *mailMgr) traversePlayerMail(hum common.Player, cb func(*mail) bool)
}
func (this *mailMgr) addMail(m *mail) {
this.idHash[m.mailId] = m
this.idHash.Store(m.mailId, m)
if m.isType(constant.MAIL_TYPE_ALL) {
this.wholeMails[m.mailId] = m
this.wholeMails.Store(m.mailId, m)
}
}