1
This commit is contained in:
parent
860711a093
commit
819a77fe4c
@ -8,14 +8,37 @@ type App interface {
|
||||
}
|
||||
|
||||
type Player interface {
|
||||
Lock()
|
||||
UnLock()
|
||||
GetAccountId() string
|
||||
GetRegisterTime() int32
|
||||
IsUnreadMail(int64) bool
|
||||
IsDeletedMail(int64) bool
|
||||
FillMailList(mailList *[]MailDto)
|
||||
ReadMails(mailIds []int64)
|
||||
GetUnreadMailCnt() int32
|
||||
GetMailById(mailId int64) *MailDto
|
||||
GetAttachments(mailIds []int64)
|
||||
DeleteMails(mailIds []int64)
|
||||
IsDeletedMail(mailId int64)
|
||||
IsReadedMail(mailId int64)
|
||||
}
|
||||
|
||||
type PlayerMgr interface{}
|
||||
type Mail interface{}
|
||||
|
||||
type AttachmentDto struct {
|
||||
ItemId int32 `json:"itemid"`
|
||||
ItemNum int32 `json:"itemnum"`
|
||||
}
|
||||
|
||||
type MailDto struct {
|
||||
MailId string `json:"mailid"`
|
||||
Subject string `json:"subject"`
|
||||
Content string `json:"content"`
|
||||
Flags int32 `json:"flags"`
|
||||
SendTime int32 `json:"sendtime"`
|
||||
ExpireTime int32 `json:"expiretime""`
|
||||
Attachments []AttachmentDto `json:"attachments""`
|
||||
}
|
||||
|
||||
type MailMgr interface{}
|
||||
|
||||
type ControllerMgr interface{}
|
||||
|
@ -11,6 +11,7 @@ func mail_getMailList(c *gin.Context) {
|
||||
var msg struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
MailList []common.MailDto `json:"maillist""`
|
||||
}
|
||||
msg.ErrCode = 0
|
||||
msg.ErrMsg = hum.GetAccountId()
|
||||
|
@ -1,11 +1,10 @@
|
||||
package mail
|
||||
|
||||
import (
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"q5"
|
||||
"strings"
|
||||
"time"
|
||||
//"main/common"
|
||||
//"main/constant"
|
||||
//"q5"
|
||||
//"strings"
|
||||
)
|
||||
|
||||
type Attachment struct {
|
||||
@ -57,6 +56,7 @@ func NewMail() *Mail {
|
||||
return m
|
||||
}
|
||||
|
||||
/*
|
||||
func (m *Mail) ParseAttachments(attachmentsStr string) {
|
||||
if len(attachmentsStr) <= 0 {
|
||||
m.ATT = make([]*Attachment, 0)
|
||||
@ -80,32 +80,4 @@ func (m *Mail) ParseAttachments(attachmentsStr string) {
|
||||
m.ATT = append(m.ATT, attachment)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Mail) FillMutableXObject() {}
|
||||
func (m *Mail) GMFillMutableXObject() {}
|
||||
|
||||
func (m *Mail) HasAttachment() bool {
|
||||
return len(m.ATT) > 0
|
||||
}
|
||||
|
||||
func (m *Mail) IsReadableMail(accountObj common.Player) bool {
|
||||
if m.MailType == constant.MAIL_TYPE_GROUP {
|
||||
if m.UserType == 1 {
|
||||
// 只有在邮件发送时间之前注册的用户可以读
|
||||
if accountObj.GetRegisterTime() > m.SendTime {
|
||||
return false
|
||||
}
|
||||
} else if m.UserType == 2 {
|
||||
// 只有在邮件发送时间之后注册的用户可以读
|
||||
if accountObj.GetRegisterTime() < m.SendTime {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
nowUnixSec := int32(time.Now().Unix())
|
||||
if m.ExpireTime > nowUnixSec && m.SendTime <= nowUnixSec && !accountObj.IsDeletedMail(m.MailId) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
*/
|
||||
|
@ -184,6 +184,7 @@ func (this *MailMgr) GetGMMailList(gameId int) []*GMMail {
|
||||
return resMailList
|
||||
}
|
||||
|
||||
/*
|
||||
func (this *MailMgr) GetMailList(player common.Player) []*Mail {
|
||||
gameMailList := this.gameMailHash[constant.GAMEID]
|
||||
playerMailList := this.playerMailHash[player.GetAccountId()]
|
||||
@ -230,32 +231,4 @@ func (this *MailMgr) GetMailList(player common.Player) []*Mail {
|
||||
}
|
||||
return resMailList
|
||||
}
|
||||
|
||||
func (this *MailMgr) markMail(accountObj common.Player) {
|
||||
}
|
||||
|
||||
func (this *MailMgr) GetUnreadMailCount(accountObj common.Player) int {
|
||||
mailCnt := 0
|
||||
if gameMails, ok := this.gameMailHash[constant.GAMEID]; ok {
|
||||
for _, mailObj := range gameMails {
|
||||
if mailObj.IsReadableMail(accountObj) {
|
||||
mailCnt++
|
||||
}
|
||||
}
|
||||
}
|
||||
if playerMails, ok := this.playerMailHash[accountObj.GetAccountId()]; ok {
|
||||
for _, mailObj := range playerMails {
|
||||
if mailObj.IsReadableMail(accountObj) {
|
||||
mailCnt++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mailCnt
|
||||
}
|
||||
|
||||
func (this *MailMgr) getAttachment(accountObj common.Player) {
|
||||
}
|
||||
|
||||
func (this *MailMgr) deleteMails(accountObj common.Player) {
|
||||
}
|
||||
*/
|
||||
|
@ -109,31 +109,6 @@ func (p *Player) DeleteMails(mailIds string) {
|
||||
p.MarkDirty()
|
||||
}
|
||||
|
||||
func (p *Player) AddToReadList() {}
|
||||
|
||||
func (p *Player) GetAttachment(mailIds string) []interface{} {
|
||||
attachments := make([]interface{}, 0)
|
||||
mailMgrPtr := global.GetMailMgr().(*mail.MailMgr)
|
||||
mailIdStrings := strings.Split(mailIds, ",")
|
||||
for _, _mailId := range mailIdStrings {
|
||||
if len(_mailId) <= 0 {
|
||||
continue
|
||||
}
|
||||
mailId := q5.ToInt64(_mailId)
|
||||
mailObj := mailMgrPtr.GetMail(mailId)
|
||||
if mailObj == nil || !mailObj.HasAttachment() || p.IsDeletedMail(mailId) {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, mailATT := range mailObj.ATT {
|
||||
attachments = append(attachments, mailATT)
|
||||
}
|
||||
p.DeleteMails(_mailId)
|
||||
}
|
||||
|
||||
return attachments
|
||||
}
|
||||
|
||||
/*
|
||||
func (p *Player) Deserialize(accountPB *ss.MFAccountData) {
|
||||
var nextDaySec int32 = 3600 * 24
|
||||
|
Loading…
x
Reference in New Issue
Block a user