save
This commit is contained in:
parent
be72efcd2c
commit
0319de74be
@ -84,13 +84,13 @@ func (api *MailApi) GetUnreadMailCount(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 领取邮件附件
|
||||
type GetMailAttachmentReq struct {
|
||||
type getMailAttachmentReq struct {
|
||||
SessionId string `form:"session_id" binding:"required"`
|
||||
AccountId string `form:"account_id" binding:"required"`
|
||||
}
|
||||
|
||||
func (api *MailApi) GetMailAttachment(c *gin.Context) {
|
||||
var req GetMailAttachmentReq
|
||||
var req getMailAttachmentReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(400, err))
|
||||
return
|
||||
@ -103,14 +103,14 @@ func (api *MailApi) GetMailAttachment(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 删除邮件
|
||||
type DeleteMailsReq struct {
|
||||
type deleteMailsReq struct {
|
||||
SessionId string `form:"session_id" binding:"required"`
|
||||
AccountId string `form:"account_id" binding:"required"`
|
||||
MailIds string `form:"mail_ids" binding:"required"`
|
||||
}
|
||||
|
||||
func (api *MailApi) DeleteMails(c *gin.Context) {
|
||||
var req DeleteMailsReq
|
||||
var req deleteMailsReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(400, err))
|
||||
return
|
||||
|
@ -3,38 +3,38 @@ package player
|
||||
import "main/mail"
|
||||
import "main/ss"
|
||||
|
||||
type player struct {
|
||||
accountId string
|
||||
sessionId string
|
||||
registerTime int
|
||||
readMailHash map[int64]*mail.Mail
|
||||
deletedMailHash map[int64]*mail.Mail
|
||||
type Player struct {
|
||||
AccountId string
|
||||
SessionId string
|
||||
RegisterTime int
|
||||
ReadMailHash map[int64]*mail.Mail
|
||||
DeletedMailHash map[int64]*mail.Mail
|
||||
}
|
||||
|
||||
func (p *player) init() {
|
||||
p.readMailHash = make(map[int64]*mail.Mail)
|
||||
p.deletedMailHash = make(map[int64]*mail.Mail)
|
||||
func (p *Player) init() {
|
||||
p.ReadMailHash = make(map[int64]*mail.Mail)
|
||||
p.DeletedMailHash = make(map[int64]*mail.Mail)
|
||||
}
|
||||
|
||||
func (p *player) IsUnreadMail(mailId int64) bool {
|
||||
m := p.readMailHash[mailId]
|
||||
func (p *Player) IsUnreadMail(mailId int64) bool {
|
||||
m := p.ReadMailHash[mailId]
|
||||
return m == nil
|
||||
}
|
||||
|
||||
func (p *player) IsDeletedMail(mailId int64) bool {
|
||||
m := p.deletedMailHash[mailId]
|
||||
func (p *Player) IsDeletedMail(mailId int64) bool {
|
||||
m := p.DeletedMailHash[mailId]
|
||||
return m != nil
|
||||
}
|
||||
|
||||
func (p *player) MarkMail(mailIds string) {}
|
||||
func (p *player) DeleteMails(mailIds string) {}
|
||||
func (p *player) AddToReadList(mailIds string) {}
|
||||
func (p *player) GetAttachment(mailIds string) {}
|
||||
func (p *Player) MarkMail(mailIds string) {}
|
||||
func (p *Player) DeleteMails(mailIds string) {}
|
||||
func (p *Player) AddToReadList(mailIds string) {}
|
||||
func (p *Player) GetAttachment(mailIds string) {}
|
||||
|
||||
func (p *player) Deserialize(accountPB ss.MFAccountData) {}
|
||||
func (p *Player) Deserialize(accountPB ss.MFAccountData) {}
|
||||
|
||||
func (p *player) Serialize(accountPB ss.MFAccountData) {
|
||||
func (p *Player) Serialize(accountPB ss.MFAccountData) {
|
||||
|
||||
}
|
||||
|
||||
func (p *player) SaveToDB() {}
|
||||
func (p *Player) SaveToDB() {}
|
||||
|
29
server/mailserver/player/playerdbmgr.go
Normal file
29
server/mailserver/player/playerdbmgr.go
Normal file
@ -0,0 +1,29 @@
|
||||
package player
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"fmt"
|
||||
"mailsever/constant"
|
||||
"q5"
|
||||
)
|
||||
|
||||
func (pm *playerMgr) LoadPlayer(accountId string) {
|
||||
sql := fmt.Sprintf("SELECT accountid, blobdata FROM account_data WHERE accountid='%s'", accountId)
|
||||
f5.GetGoStyleDb().SyncSelectCustomQuery(
|
||||
constant.MAIL_DB,
|
||||
sql,
|
||||
func(err error, rows *f5.DataSet) {
|
||||
if err != nil {
|
||||
f5.GetSysLog().Info("loadPlayer err:%v \n", err)
|
||||
panic(err)
|
||||
}
|
||||
if rows.Next() {
|
||||
aId := q5.ToString(*rows.GetByName("account_id"))
|
||||
profile := &Player{
|
||||
AccountId: aId,
|
||||
}
|
||||
pm.AddPlayer(profile)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
@ -1,17 +1,21 @@
|
||||
package player
|
||||
|
||||
type playerMgr struct {
|
||||
accountIdHash map[string]*player
|
||||
accountIdHash map[string]*Player
|
||||
}
|
||||
|
||||
func (pm *playerMgr) Init() {
|
||||
pm.accountIdHash = make(map[string]*player)
|
||||
pm.accountIdHash = make(map[string]*Player)
|
||||
}
|
||||
|
||||
func (pm *playerMgr) UnInit() {
|
||||
}
|
||||
|
||||
func (pm *playerMgr) GetPlayer(accountId string) *player {
|
||||
func (pm *playerMgr) AddPlayer(p *Player) {
|
||||
pm.accountIdHash[p.AccountId] = p
|
||||
}
|
||||
|
||||
func (pm *playerMgr) GetPlayer(accountId string) *Player {
|
||||
if p, exists := pm.accountIdHash[accountId]; exists {
|
||||
return p
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user