日志优化
parent
b96c008047
commit
22c1544335
|
@ -6,23 +6,20 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.DuoduiRank;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SGlobalActivity;
|
||||
import config.SSummonTreasure;
|
||||
import config.SSurpriseBox;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
|
@ -59,13 +56,10 @@ class FengshenTreasureActivity extends AbstractActivity {
|
|||
|
||||
/**
|
||||
* 校验礼包购买
|
||||
* @param uid
|
||||
* @param gift
|
||||
* @throws Exception
|
||||
*/
|
||||
public void verifyGift(int uid, int gift) throws Exception {
|
||||
if (gift <= 0){
|
||||
LOGGER.error("封神礼包退出,礼包id为负,uid:{},礼包id:{}",uid,gift);
|
||||
// LOGGER.error("封神礼包退出,礼包id为负,uid:{},礼包id:{}",uid,gift);
|
||||
return;
|
||||
}
|
||||
User user = UserManager.getUser(uid);
|
||||
|
@ -182,20 +176,14 @@ class FengshenTreasureActivity extends AbstractActivity {
|
|||
|
||||
/**
|
||||
* 验证奖励是否可以领取
|
||||
* @param user
|
||||
* @param treasure
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
boolean checkRewardsProcess(User user, SSummonTreasure treasure) throws Exception {
|
||||
boolean checkRewardsProcess(User user, SSummonTreasure treasure) {
|
||||
int count = treasure.getCount();
|
||||
return getTier(user.getId()) >= count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取层数
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
public int getTier(int uid){
|
||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
|
|
|
@ -78,18 +78,18 @@ public class MailLogic {
|
|||
}
|
||||
// 有限时间不为0,并且当前时间大于 发送时间+有效时间
|
||||
if (cMail.getEffectiveTime() != 0 && nowTime > (cMail.getEffectiveTime() + cMail.getSendTime())){
|
||||
LOGGER.error("邮件删除,过期了,邮件信息:{},当前时间:{}", cMail,nowTime);
|
||||
LOGGER.info("邮件删除,过期了,邮件信息:{},当前时间:{}", cMail,nowTime);
|
||||
removeIds.add(cMail.getId());
|
||||
continue;
|
||||
}
|
||||
String mailItem = cMail.getMailItem();
|
||||
if(mailItem != null && mailItem.contains("null")){
|
||||
LOGGER.error("邮件删除,邮件道具为空,邮件信息:{}", cMail);
|
||||
LOGGER.info("邮件删除,邮件道具为空,邮件信息:{}", cMail);
|
||||
removeIds.add(cMail.getId());
|
||||
continue;
|
||||
}
|
||||
if(cMail.getNoUseDeleteTime()!=0&&cMail.getNoUseDeleteTime()<TimeUtils.now()){
|
||||
LOGGER.error("邮件删除,邮件删除时间到,邮件信息:{},当前时间:{}", cMail,nowTime);
|
||||
LOGGER.info("邮件删除,邮件删除时间到,邮件信息:{},当前时间:{}", cMail,nowTime);
|
||||
removeIds.add(cMail.getId());
|
||||
continue;
|
||||
}
|
||||
|
@ -105,8 +105,6 @@ public class MailLogic {
|
|||
|
||||
/**
|
||||
* 将系统邮件生成用户邮件
|
||||
* @param systemMailList
|
||||
* @param mailMap
|
||||
*/
|
||||
private void systemMailToUserMail(List<SystemMail> systemMailList, Map<String, Mail> mailMap,int userId) throws Exception {
|
||||
MailingSystem mailingSystem = MailingSystemManager.getMailingSystem();
|
||||
|
@ -136,7 +134,7 @@ public class MailLogic {
|
|||
|
||||
}
|
||||
|
||||
private void initUserMail(int userId, SystemMail systemMail,MailManager mailManager,Map<String, Mail> mailMap) throws Exception {
|
||||
private void initUserMail(int userId, SystemMail systemMail,MailManager mailManager,Map<String, Mail> mailMap) {
|
||||
int sendTime = TimeUtils.nowInt();
|
||||
if(systemMail.getId() == 1){
|
||||
return;
|
||||
|
@ -191,7 +189,7 @@ public class MailLogic {
|
|||
mail.setState(Global.MAIL_DRAW_ST_UNGET);
|
||||
}
|
||||
}
|
||||
LOGGER.error("玩家读取了邮件,邮件信息:{},当前时间:{}", mail, TimeUtils.now());
|
||||
LOGGER.info("玩家读取了邮件,邮件信息:{},当前时间:{}", mail, TimeUtils.now());
|
||||
mailManager.addMail(mail);
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.OPEN_MAIL.getType());
|
||||
PlayerInfoProto.MailReadResponse.Builder builder = PlayerInfoProto.MailReadResponse.newBuilder().setMailInfo(CBean2Proto.getMail(mail, false));
|
||||
|
@ -200,10 +198,6 @@ public class MailLogic {
|
|||
|
||||
/**
|
||||
* 领取附件
|
||||
* @param iSession
|
||||
* @param mailIdsList
|
||||
* @param userId
|
||||
* @throws Exception
|
||||
*/
|
||||
public void takeMail(ISession iSession,List<String> mailIdsList, int userId) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.MAIL_TAKE_MAIL_ITEM_RESPONESE_VALUE;
|
||||
|
@ -211,12 +205,7 @@ public class MailLogic {
|
|||
MailManager mailManager = user.getMailManager();
|
||||
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
// 返回值,默认为1
|
||||
/**
|
||||
* 1:成功
|
||||
* 0:道具为空
|
||||
* 2:背包已满
|
||||
*/
|
||||
// (默认为1) 1:成功, 0:道具为空, 2:背包已满
|
||||
int result = 1;
|
||||
|
||||
for (String mailId : mailIdsList){
|
||||
|
@ -247,7 +236,7 @@ public class MailLogic {
|
|||
mail.setState(Global.MAIL_DRAW_ST_GOT);
|
||||
mail.setNoUseDeleteTime(TimeUtils.now()+TimeUtils.DAY*Global.MAIL_NOUSE_DELETE_TIME);
|
||||
mailManager.addMail(mail);
|
||||
LOGGER.error("玩家领取了邮件,uid:{},邮件信息:{},当前时间:{}",userId, mail, TimeUtils.now());
|
||||
LOGGER.info("玩家领取了邮件,uid:{},邮件信息:{},当前时间:{}",userId, mail, TimeUtils.now());
|
||||
}
|
||||
}
|
||||
if (state != 1) {
|
||||
|
@ -286,34 +275,32 @@ public class MailLogic {
|
|||
// return cnt;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 有附件已领取, 无附件已读取的邮件
|
||||
*/
|
||||
public void delUserMail(int userId) throws Exception {
|
||||
User user = UserManager.getUser(userId);
|
||||
MailManager mailManager = user.getMailManager();
|
||||
Map<String, Mail> mailMap = mailManager.getMailMap();
|
||||
List<String> delMailIds = new CopyOnWriteArrayList<>();
|
||||
for (Map.Entry<String, Mail> entry : mailMap.entrySet()) {
|
||||
Mail cMail = entry.getValue();
|
||||
if (cMail.getState() == Global.MAIL_STATE_NEW) {
|
||||
continue;
|
||||
}
|
||||
String mailItem = cMail.getMailItem();
|
||||
if (mailItem.isEmpty() && cMail.getState() != Global.MAIL_STATE_READ) {
|
||||
continue;
|
||||
}
|
||||
if (!mailItem.isEmpty() && cMail.getState() != Global.MAIL_DRAW_ST_GOT) {
|
||||
continue;
|
||||
}
|
||||
delMailIds.add(cMail.getId());
|
||||
}
|
||||
if (delMailIds.size() != 0){
|
||||
for (String mailId : delMailIds){
|
||||
mailManager.removeMail(mailId);
|
||||
}
|
||||
}
|
||||
}
|
||||
//有附件已领取, 无附件已读取的邮件
|
||||
// public void delUserMail(int userId) throws Exception {
|
||||
// User user = UserManager.getUser(userId);
|
||||
// MailManager mailManager = user.getMailManager();
|
||||
// Map<String, Mail> mailMap = mailManager.getMailMap();
|
||||
// List<String> delMailIds = new CopyOnWriteArrayList<>();
|
||||
// for (Map.Entry<String, Mail> entry : mailMap.entrySet()) {
|
||||
// Mail cMail = entry.getValue();
|
||||
// if (cMail.getState() == Global.MAIL_STATE_NEW) {
|
||||
// continue;
|
||||
// }
|
||||
// String mailItem = cMail.getMailItem();
|
||||
// if (mailItem.isEmpty() && cMail.getState() != Global.MAIL_STATE_READ) {
|
||||
// continue;
|
||||
// }
|
||||
// if (!mailItem.isEmpty() && cMail.getState() != Global.MAIL_DRAW_ST_GOT) {
|
||||
// continue;
|
||||
// }
|
||||
// delMailIds.add(cMail.getId());
|
||||
// }
|
||||
// if (delMailIds.size() != 0){
|
||||
// for (String mailId : delMailIds){
|
||||
// mailManager.removeMail(mailId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 发送邮件
|
||||
|
@ -431,7 +418,7 @@ public class MailLogic {
|
|||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
|
||||
}catch(Exception e){
|
||||
LOGGER.info("发送邮件异常{}",e);
|
||||
LOGGER.error("发送邮件异常{}",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue