|
|
@ -31,7 +31,9 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import com.ccsens.util.bean.dto.QueryDto; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.ScheduledExecutorService; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
@ -58,10 +60,9 @@ public class ClientService implements IClientService { |
|
|
|
@Autowired |
|
|
|
private TallFeignClient tallFeignClient; |
|
|
|
@Autowired |
|
|
|
private DelayProducer delaySender; |
|
|
|
@Autowired |
|
|
|
private SendMsg sendMsg; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public ClientVo.Join join(ClientDto.Join join, Long userId){ |
|
|
|
log.info("加入游戏:{}, userId:{}", join, userId); |
|
|
@ -230,6 +231,14 @@ public class ClientService implements IClientService { |
|
|
|
|
|
|
|
PageHelper.startPage(gatRanking.getPageNum(), gatRanking.getPageSize()); |
|
|
|
List<ClientVo.MemberInfo> memberInfo = gameUserJoinDao.selectByRecordId(gatRanking.getRecordId()); |
|
|
|
List<ClientVo.Ranking> rankingAllList = gameUserJoinDao.getAllRanking(gatRanking.getRecordId()); |
|
|
|
Map<String, Integer> map = new HashMap<>(); |
|
|
|
rankingAllList.forEach(ranking -> { |
|
|
|
map.put(String.valueOf(ranking.getUserId()), ranking.getRank()); |
|
|
|
}); |
|
|
|
memberInfo.forEach(member -> { |
|
|
|
member.setSort(map.get(String.valueOf(member.getId()))); |
|
|
|
}); |
|
|
|
log.info("查询成员信息"); |
|
|
|
PageInfo pageInfo =new PageInfo<>(memberInfo); |
|
|
|
|
|
|
@ -253,7 +262,12 @@ public class ClientService implements IClientService { |
|
|
|
userJoin.setTimes(userJoin.getTimes() + 1); |
|
|
|
userJoin.setScore(userJoin.getScore() + 1); |
|
|
|
gameUserJoinDao.updateByPrimaryKeySelective(userJoin); |
|
|
|
|
|
|
|
//更新redis
|
|
|
|
ClientDto.RedisUser user = new ClientDto.RedisUser(); |
|
|
|
user.setId(userJoin.getId()); |
|
|
|
user.setAvatarurl(userJoin.getAvatarUrl()); |
|
|
|
user.setNickname(userJoin.getNickname()); |
|
|
|
redisUtil.zsSet(GameConstant.generateGameKey(Long.parseLong(recordId)), JSON.toJSONString(user), userJoin.getScore(), GameConstant.REDIS_TIME); |
|
|
|
gameMessageCountOut = new GameMessageCountOut(userJoin.getTimes(),userJoin.getScore()); |
|
|
|
} |
|
|
|
} |
|
|
|