1
This commit is contained in:
parent
8e487c9898
commit
32c16fa7c8
@ -32,11 +32,19 @@ type Player interface {
|
||||
UnLock()
|
||||
GetHashCode() uint32
|
||||
GetAccountId() string
|
||||
|
||||
MarkMails([]Mail)
|
||||
GetAttachment([]Mail)
|
||||
DeleteMails([]Mail)
|
||||
}
|
||||
|
||||
type PlayerMgr interface{
|
||||
type PlayerMgr interface {
|
||||
GetPlayerByAccountId() Player
|
||||
}
|
||||
|
||||
type Mail interface {
|
||||
GetMailId() int64
|
||||
}
|
||||
|
||||
type MailMgr interface{
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ func (this *mail) isValid(hum common.Player) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *mail) GetMailId() int64 {
|
||||
return this.mailId
|
||||
}
|
||||
|
||||
func (this *mail) fillMailDto(mailDto *common.MailDto) bool {
|
||||
return true
|
||||
}
|
||||
|
@ -116,12 +116,19 @@ func (this *mailMgr) caGetMailList(hum common.Player, c *gin.Context) {
|
||||
|
||||
func (this *mailMgr) caMarkMail(hum common.Player, c *gin.Context) {
|
||||
mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",")
|
||||
mails := []common.Mail{}
|
||||
for _, str := range(mailIds) {
|
||||
m := this.getMail(str)
|
||||
if m != nil {
|
||||
|
||||
q5.AppendSlice(&mails, m)
|
||||
}
|
||||
}
|
||||
hum.MarkMails(mails)
|
||||
rspObj := struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
}{}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *mailMgr) caGetUnreadMailCnt(hum common.Player, c *gin.Context) {
|
||||
@ -129,11 +136,37 @@ func (this *mailMgr) caGetUnreadMailCnt(hum common.Player, c *gin.Context) {
|
||||
}
|
||||
|
||||
func (this *mailMgr) caGetAttachment(hum common.Player, c *gin.Context) {
|
||||
|
||||
mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",")
|
||||
mails := []common.Mail{}
|
||||
for _, str := range(mailIds) {
|
||||
m := this.getMail(str)
|
||||
if m != nil {
|
||||
q5.AppendSlice(&mails, m)
|
||||
}
|
||||
}
|
||||
hum.GetAttachment(mails)
|
||||
rspObj := struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
}{}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *mailMgr) caDeleteMails(hum common.Player, c *gin.Context) {
|
||||
|
||||
mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",")
|
||||
mails := []common.Mail{}
|
||||
for _, str := range(mailIds) {
|
||||
m := this.getMail(str)
|
||||
if m != nil {
|
||||
q5.AppendSlice(&mails, m)
|
||||
}
|
||||
}
|
||||
hum.DeleteMails(mails)
|
||||
rspObj := struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
}{}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *mailMgr) traversePlayerMail(hum common.Player, cb func(*mail) bool) {
|
||||
@ -190,7 +223,15 @@ func (this *mailMgr) getGroup(groupId int64) *userGroup {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *mailMgr) getMail(mailId string) *mail {
|
||||
func (this *mailMgr) getMail(mailId string) common.Mail {
|
||||
if m := this.internalGetMail(mailId); m != nil {
|
||||
return m
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (this *mailMgr) internalGetMail(mailId string) *mail {
|
||||
if p, ok := this.idHash.Load(mailId); ok {
|
||||
return p.(*mail)
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user