Browse Source

mybatisInteceptor

master
zhizhi wu 6 years ago
parent
commit
669808afe4
  1. 10
      game/src/main/java/com/ccsens/game/config/BeanConfig.java
  2. 14
      game/src/main/java/com/ccsens/game/service/ScreenService.java

10
game/src/main/java/com/ccsens/game/config/BeanConfig.java

@ -26,9 +26,9 @@ public class BeanConfig {
/** /**
* 注册拦截器 * 注册拦截器
*/ */
// @Bean @Bean
// public MybatisInterceptor mybatisInterceptor() { public MybatisInterceptor mybatisInterceptor() {
// MybatisInterceptor interceptor = new MybatisInterceptor(); MybatisInterceptor interceptor = new MybatisInterceptor();
// return interceptor; return interceptor;
// } }
} }

14
game/src/main/java/com/ccsens/game/service/ScreenService.java

@ -608,6 +608,7 @@ public class ScreenService implements IScreenService{
GameUserJoinExample example = new GameUserJoinExample(); GameUserJoinExample example = new GameUserJoinExample();
example.createCriteria().andRecordIdEqualTo(start.getMemberRecord()); example.createCriteria().andRecordIdEqualTo(start.getMemberRecord());
gameUserJoinDao.updateByExampleSelective(delUserJoin,example); gameUserJoinDao.updateByExampleSelective(delUserJoin,example);
redisUtil.del(GameConstant.generateGameKey(start.getMemberRecord()));
} }
//延时通知 //延时通知
long startSend = gameRecord.getStartTime() - System.currentTimeMillis(); long startSend = gameRecord.getStartTime() - System.currentTimeMillis();
@ -639,14 +640,13 @@ public class ScreenService implements IScreenService{
GameUserJoinExample joinExample = new GameUserJoinExample(); GameUserJoinExample joinExample = new GameUserJoinExample();
joinExample.createCriteria().andRecordIdEqualTo(gameRecord.getId()); joinExample.createCriteria().andRecordIdEqualTo(gameRecord.getId());
List<GameUserJoin> userJoins = gameUserJoinDao.selectByExample(joinExample); List<GameUserJoin> userJoins = gameUserJoinDao.selectByExample(joinExample);
// if (CollectionUtil.isEmpty(userJoins)) {
// return startGame;
// }
userJoins.forEach( userJoin -> {
ClientDto.RedisUser user = ClientDto.RedisUser.getInstance(userJoin);
redisUtil.zsSet(GameConstant.generateGameKey(gameRecord.getId()), JSON.toJSONString(user), 0, GameConstant.REDIS_TIME);
});
if (CollectionUtil.isEmpty(userJoins)) {
userJoins.forEach( userJoin -> {
ClientDto.RedisUser user = ClientDto.RedisUser.getInstance(userJoin);
redisUtil.zsSet(GameConstant.generateGameKey(gameRecord.getId()), JSON.toJSONString(user), 0, GameConstant.REDIS_TIME);
});
}
//推送客户端 //推送客户端
pushClient(gameRecord, executor); pushClient(gameRecord, executor);

Loading…
Cancel
Save