删除邮件
parent
ce2c268c6a
commit
fc63077c19
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.handler;
|
|||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
|
|
@ -50,6 +51,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
|
||||
|
||||
}
|
||||
MailLogic.getInstance().delUserMail(userId);
|
||||
CommonProto.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager(), user.getPlayerInfoManager().getMapId(), user.getMapManager().getCurMapId(),user.getMapManager());
|
||||
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
|
||||
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class MailManager extends MongoBase {
|
|||
public Mail getMail(String key) {
|
||||
return mailMap.get(key);
|
||||
}
|
||||
|
||||
public void removeMail(String key) {
|
||||
if (mailMap.containsKey(key)){
|
||||
mailMap.remove(key);
|
||||
|
|
|
|||
|
|
@ -196,4 +196,28 @@ public class MailLogic {
|
|||
autoIncrement.setCnt(cnt+1);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除过期,有附件已领取, 无附件已读取的邮件
|
||||
* @param userId
|
||||
* @throws Exception
|
||||
*/
|
||||
public void delUserMail(int userId) throws Exception {
|
||||
User user = UserManager.getUser(userId);
|
||||
MailManager mailManager = user.getMailManager();
|
||||
Map<String, Mail> mailMap = mailManager.getMailMap();
|
||||
for (Map.Entry<String, Mail> entry : mailMap.entrySet()) {
|
||||
Mail cMail = entry.getValue();
|
||||
if (cMail.getState() == Global.MAIL_STATE_NEW) {
|
||||
continue;
|
||||
}
|
||||
if (cMail.getMailItem().isEmpty() && cMail.getState() != Global.MAIL_STATE_READ) {
|
||||
continue;
|
||||
}
|
||||
if (!cMail.getMailItem().isEmpty() && cMail.getState() != Global.MAIL_DRAW_ST_GOT) {
|
||||
continue;
|
||||
}
|
||||
mailManager.removeMail(cMail.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue