red point

back_recharge
wangyuan 2019-07-10 19:48:45 +08:00
parent bdc04f8046
commit 2d11d1485e
5 changed files with 44 additions and 24 deletions

View File

@ -6,6 +6,7 @@
<!-- 定义日志文件 输入位置 -->
<property name="log_dir" value="/data/jl_logs"/>
<property name="log_tdir" value="/data/jl_tlogs"/>
<property name="log_bdir" value="/data/jl_blogs"/>
<!-- 日志最大的历史 30天 -->
<property name="maxHistory" value="30"/>
@ -74,17 +75,28 @@
<maxHistory>${maxHistory}</maxHistory>
<maxFileSize>200MB</maxFileSize>
</rollingPolicy>
</appender>
<!-- 按照固定窗口模式生成日志文件当文件大于20MB时生成新的日志文件。窗口大小是1到3当保存了3个归档文件后将覆盖最早的日志。
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${log_dir}/%d{yyyy-MM-dd}/.log.zip</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>3</maxIndex>
</rollingPolicy> -->
<!-- 查看当前活动文件的大小如果超过指定大小会告知RollingFileAppender 触发当前活动文件滚动
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>5KB</maxFileSize>
</triggeringPolicy>-->
<appender name="file_blog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--<Encoding>UTF-8</Encoding>-->
<!-- 过滤器只记录WARN级别的日志 -->
<encoder charset="UTF-8">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}:%msg%n</pattern>
</encoder>
<!-- <filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>-->
<!-- 最常用的滚动策略,它根据时间来制定滚动策略.既负责滚动也负责出发滚动 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志输出位置 可相对、和绝对路径 -->
<fileNamePattern>${log_bdir}/%d{yyyy-MM-dd}/blog%i.log</fileNamePattern>
<!-- 可选节点,控制保留的归档文件的最大数量,超出数量就删除旧文件假设设置每个月滚动,且<maxHistory>是6
则只保存最近6个月的文件删除之前的旧文件。注意删除旧文件是那些为了归档而创建的目录也会被删除-->
<maxHistory>${maxHistory}</maxHistory>
<maxFileSize>200MB</maxFileSize>
</rollingPolicy>
</appender>
@ -148,6 +160,10 @@
<appender-ref ref="file_tlog"/>
</logger>
<logger name="BackErrorLog" additivity="false">
<appender-ref ref="file_blog"/>
</logger>
<root level="INFO">

View File

@ -510,7 +510,7 @@ public class ArenaLogic {
.build());
}
User user = UserManager.getUser(uid);
user.getPlayerInfoManager().removeRed(GlobalsDef.SHARE_BOSS_RED_TYPE);
user.getPlayerInfoManager().removeRed(GlobalsDef.ARENA_CHALLENGE_TYPE);
ArenaInfoProto.ArenaRecordInfoResponse build = ArenaInfoProto.ArenaRecordInfoResponse.newBuilder().addAllArenaRecordInfo(arenaRecordInfos).build();
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.ARENA_DEFENSE_RESPONSE_VALUE,build,true);
return;

View File

@ -26,8 +26,6 @@ import org.luaj.vm2.LuaValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
import sun.misc.MessageUtils;
import java.util.*;
public class CombatLogic {
@ -527,7 +525,7 @@ public class CombatLogic {
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_OWN,"",removeAdventureBosseInfo.toArray());
}
User user = UserManager.getUser(uid);
user.getPlayerInfoManager().removeRed(GlobalsDef.ARENA_CHALLENGE_TYPE);
user.getPlayerInfoManager().removeRed(GlobalsDef.SHARE_BOSS_RED_TYPE);
}
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_RESPONSE_VALUE,builder.build(),true);
}
@ -585,6 +583,7 @@ public class CombatLogic {
AdventureBoss adventureBoss = new AdventureBoss(bossId,bossGroupID,arenaID,levle,uid,now,totalHp,hps);
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO,"",bossId,adventureBoss);
RedisUtil.getInstence().putMapEntry(RedisKey.ADVENTRUEN_BOSS_OWN,Integer.toString(uid),bossId,0);
MessageUtil.sendRedIndication(uid,GlobalsDef.SHARE_BOSS_RED_TYPE);
}
adventureStateInfo.setBossId(bossId);
adventureStateInfo.setBossGroupId(bossGroupID);

View File

@ -71,15 +71,14 @@ public class MessageUtil {
if(session!=null){
PlayerInfoProto.RedPointInfo redPointInfo = PlayerInfoProto.RedPointInfo.newBuilder().setType(redType).build();
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.SEND_RED_POINT_INDICATION_VALUE,redPointInfo,true);
}else{
if(redType == GlobalsDef.MAIL_RED_TYPE){
return;
}
User user = UserManager.getUser(sendUid);
Set<Integer> reds = user.getPlayerInfoManager().getReds();
reds.add(redType);
user.getPlayerInfoManager().setReds(reds);
}
if(redType == GlobalsDef.MAIL_RED_TYPE){
return;
}
User user = UserManager.getUser(sendUid);
Set<Integer> reds = user.getPlayerInfoManager().getReds();
reds.add(redType);
user.getPlayerInfoManager().setReds(reds);
}
public static void sendBagIndication(int sendUid,int type, List<CommonProto.Item> sendToFront) {

View File

@ -20,7 +20,8 @@ public class HttpPool {
private static PoolingHttpClientConnectionManager poolConnection = new PoolingHttpClientConnectionManager();
private static CloseableHttpClient httpclient;
private static final Logger LOGGER = LoggerFactory.getLogger(HttpPool.class);
private static int maxSendTimes = 2;
private static final Logger BackErrorLog = LoggerFactory.getLogger("BackErrorLog");
private static int maxSendTimes = 3;
private static int sendIntervalTime = 1000;
private static String charset = "UTF-8";
@ -39,6 +40,7 @@ public class HttpPool {
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse;
int sendTimes = 0;
boolean needBack = true;
do {
try {
StringEntity stringEntity = new StringEntity(info, charset);
@ -50,6 +52,7 @@ public class HttpPool {
EntityUtils.consume(responseEntity);
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode >= 200 && statusCode < 300) {
needBack = false;
LOGGER.debug("Http Send第" + (sendTimes + 1) + "次调用成功,返回码为:[" + statusCode + "]");
break;
} else {
@ -66,11 +69,14 @@ public class HttpPool {
}
}
} catch (IOException e) {
e.printStackTrace();
LOGGER.error("Http Send error",e);
}finally {
sendTimes ++ ;
}
} while (sendTimes < maxSendTimes);
if(needBack){
BackErrorLog.info(info);
}
}
public static void main (String [] args){