Search in sources :

Example 1 with RecommandUserVo

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

the class RecommendDelegateServiceImpl method findRecommandUser.

@Override
public RecommandUserVo findRecommandUser(long userId, long agentId) {
    AgentBean agentBean = RedisManager.getAgentRedisService().getAgentBean(userId);
    RecommandUserVo recommandUserVo = new RecommandUserVo();
    if (agentBean != null) {
        recommandUserVo.setUsername("用户不存在");
        recommandUserVo.setUserId(new Long(0));
        // 空头像
        recommandUserVo.setImage("");
    } else {
        // 推荐代理
        User user = userDao.findOne(userId);
        logger.info("user:{}", user);
        if (user == null) {
            recommandUserVo.setUsername("用户不存在");
            recommandUserVo.setUserId(new Long(0));
            // 空头像
            recommandUserVo.setImage("");
        } else {
            recommandUserVo.setImage(user.getImage() + "/96");
            recommandUserVo.setUserId(userId);
            recommandUserVo.setUsername(user.getUsername());
        }
    }
    return recommandUserVo;
}
Also used : AgentBean(com.code.server.constant.game.AgentBean) RecommandUserVo(com.code.server.login.vo.RecommandUserVo) User(com.code.server.db.model.User)

Example 2 with RecommandUserVo

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

the class RecommendDelegateAction method findUser.

@AuthChecker
@RequestMapping("/findUser")
public AgentResponse findUser(long userId) {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    RecommandUserVo vo = recommendDelegateService.findRecommandUser(userId, agentId);
    Map<String, Object> result = new HashMap<>();
    result.put("result", vo);
    AgentResponse agentResponse = new AgentResponse(200, result);
    return agentResponse;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) RecommandUserVo(com.code.server.login.vo.RecommandUserVo) 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)

Aggregations

RecommandUserVo (com.code.server.login.vo.RecommandUserVo)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 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