1
This commit is contained in:
parent
0842cce776
commit
2e4eb3a61c
@ -43,6 +43,11 @@ SMLogin
|
|||||||
用户群创建时间range(开始时间,结束时间)
|
用户群创建时间range(开始时间,结束时间)
|
||||||
用户群指定账号列表
|
用户群指定账号列表
|
||||||
|
|
||||||
|
邮件
|
||||||
|
增删改
|
||||||
|
用户组
|
||||||
|
增删改
|
||||||
|
|
||||||
# 参考
|
# 参考
|
||||||
|
|
||||||
https://gorm.io/zh_CN/docs/
|
https://gorm.io/zh_CN/docs/
|
||||||
|
@ -2,7 +2,6 @@ package mail
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"f5"
|
"f5"
|
||||||
"sync"
|
|
||||||
//"main/common"
|
//"main/common"
|
||||||
//"main/constant"
|
//"main/constant"
|
||||||
//"q5"
|
//"q5"
|
||||||
@ -15,7 +14,6 @@ type attachment struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type mail struct {
|
type mail struct {
|
||||||
lock sync.Mutex
|
|
||||||
mailId int64
|
mailId int64
|
||||||
mailType int32
|
mailType int32
|
||||||
subject string
|
subject string
|
||||||
@ -25,7 +23,7 @@ type mail struct {
|
|||||||
userRegStart int32
|
userRegStart int32
|
||||||
userRegEnd int32
|
userRegEnd int32
|
||||||
attachments []*attachment
|
attachments []*attachment
|
||||||
userGroups map[int64]*userGroup
|
userGroups []int64
|
||||||
reciver string
|
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) {
|
func (this *mail) loadFromDb(ds *f5.DataSet) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,20 +17,17 @@ type groupMail struct {
|
|||||||
|
|
||||||
type userGroup struct {
|
type userGroup struct {
|
||||||
groupId int64
|
groupId int64
|
||||||
mailHash map[int64]*mail
|
|
||||||
userHash map[string]int64
|
userHash map[string]int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type mailMgr struct {
|
type mailMgr struct {
|
||||||
idHash map[int64]*mail
|
idHash sync.Map
|
||||||
wholeMails map[int64]*mail
|
wholeMails sync.Map
|
||||||
groupMails [1024]*groupMail
|
groupMails [1024]*groupMail
|
||||||
groupHash map[int64]*userGroup
|
groupHash map[int64]*userGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *mailMgr) Init() {
|
func (this *mailMgr) Init() {
|
||||||
this.idHash = make(map[int64]*mail)
|
|
||||||
this.wholeMails = make(map[int64]*mail)
|
|
||||||
this.groupHash = make(map[int64]*userGroup)
|
this.groupHash = make(map[int64]*userGroup)
|
||||||
this.loadMails()
|
this.loadMails()
|
||||||
this.loadGroups()
|
this.loadGroups()
|
||||||
@ -56,7 +53,7 @@ func (this *mailMgr) loadMails() {
|
|||||||
})
|
})
|
||||||
f5.GetSysLog().Info("mailMgr.loadMails end lastIdx:%d mailNum:%d",
|
f5.GetSysLog().Info("mailMgr.loadMails end lastIdx:%d mailNum:%d",
|
||||||
lastIdx,
|
lastIdx,
|
||||||
len(this.idHash))
|
q5.GetSyncMapSize(this.idHash))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *mailMgr) loadGroups() {
|
func (this *mailMgr) loadGroups() {
|
||||||
@ -71,7 +68,6 @@ func (this *mailMgr) loadGroups() {
|
|||||||
}
|
}
|
||||||
p := new(userGroup)
|
p := new(userGroup)
|
||||||
p.groupId = groupId
|
p.groupId = groupId
|
||||||
p.mailHash = make(map[int64]*mail)
|
|
||||||
p.userHash = make(map[string]int64)
|
p.userHash = make(map[string]int64)
|
||||||
this.groupHash[p.groupId] = p
|
this.groupHash[p.groupId] = p
|
||||||
},
|
},
|
||||||
@ -80,7 +76,7 @@ func (this *mailMgr) loadGroups() {
|
|||||||
})
|
})
|
||||||
f5.GetSysLog().Info("mailMgr.loadGroups end lastIdx:%d mailNum:%d",
|
f5.GetSysLog().Info("mailMgr.loadGroups end lastIdx:%d mailNum:%d",
|
||||||
lastIdx,
|
lastIdx,
|
||||||
len(this.idHash))
|
q5.GetSyncMapSize(this.idHash))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *mailMgr) loadGroupMembers() {
|
func (this *mailMgr) loadGroupMembers() {
|
||||||
@ -101,7 +97,7 @@ func (this *mailMgr) loadGroupMembers() {
|
|||||||
})
|
})
|
||||||
f5.GetSysLog().Info("mailMgr.loadGroupMembers end lastIdx:%d mailNum:%d",
|
f5.GetSysLog().Info("mailMgr.loadGroupMembers end lastIdx:%d mailNum:%d",
|
||||||
lastIdx,
|
lastIdx,
|
||||||
len(this.idHash))
|
q5.GetSyncMapSize(this.idHash))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *mailMgr) caGetMailList(hum common.Player, c *gin.Context) {
|
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) {
|
func (this *mailMgr) addMail(m *mail) {
|
||||||
this.idHash[m.mailId] = m
|
this.idHash.Store(m.mailId, m)
|
||||||
if m.isType(constant.MAIL_TYPE_ALL) {
|
if m.isType(constant.MAIL_TYPE_ALL) {
|
||||||
this.wholeMails[m.mailId] = m
|
this.wholeMails.Store(m.mailId, m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user