Search in sources :

Example 1 with OneLevelInfoVo

use of com.code.server.login.vo.OneLevelInfoVo in project summer by foxsugar.

the class DelegateRelataionAction method fetchPlayers.

@AuthChecker
@RequestMapping("/fetchPlayers")
public AgentResponse fetchPlayers() {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    List<OneLevelInfoVo> levelInfoVoList = delegateRelataionService.fetchSelfPlayerList(agentId);
    Map<String, Object> result = new HashMap<>();
    result.put("result", levelInfoVoList);
    AgentResponse agentResponse = new AgentResponse(200, result);
    return agentResponse;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) OneLevelInfoVo(com.code.server.login.vo.OneLevelInfoVo) HashMap(java.util.HashMap) ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) AuthChecker(com.code.server.login.anotation.AuthChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with OneLevelInfoVo

use of com.code.server.login.vo.OneLevelInfoVo in project summer by foxsugar.

the class DelegateRelataionServiceImpl method fetchSelfPlayerList.

@Override
public List<OneLevelInfoVo> fetchSelfPlayerList(long agentId) {
    AgentBean agentBean = RedisManager.getAgentRedisService().getAgentBean(agentId);
    List<Long> aList = new ArrayList<>();
    for (long uid : agentBean.getChildList()) {
        if (RedisManager.getAgentRedisService().isExit(uid))
            continue;
        aList.add(uid);
    }
    List<OneLevelInfoVo> result = new ArrayList<>();
    List<User> userList = this.userDao.findUsersByIdIn(aList);
    System.out.println("===========++++aList:" + aList);
    System.out.println("===========++++aList:" + userList);
    for (User user : userList) {
        OneLevelInfoVo oneLevelInfoVo = new OneLevelInfoVo();
        oneLevelInfoVo.setImage(user.getImage() + "/96");
        oneLevelInfoVo.setUsername(user.getUsername());
        oneLevelInfoVo.setUid(user.getId());
        result.add(oneLevelInfoVo);
    }
    return result;
}
Also used : AgentBean(com.code.server.constant.game.AgentBean) OneLevelInfoVo(com.code.server.login.vo.OneLevelInfoVo) User(com.code.server.db.model.User) ArrayList(java.util.ArrayList)

Aggregations

OneLevelInfoVo (com.code.server.login.vo.OneLevelInfoVo)2 AgentBean (com.code.server.constant.game.AgentBean)1 User (com.code.server.db.model.User)1 AuthChecker (com.code.server.login.anotation.AuthChecker)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ServletRequestAttributes (org.springframework.web.context.request.ServletRequestAttributes)1