Search in sources :

Example 16 with AuthChecker

use of com.code.server.login.anotation.AuthChecker in project summer by foxsugar.

the class DelegateRelataionAction method findSelfPlayerOrDelegates.

// 检查用户
@AuthChecker
@RequestMapping("/findUserInfo")
public AgentResponse findSelfPlayerOrDelegates(long userId) {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    long agentId = AgentUtil.getAgentByRequest(request);
    UserInfoVo userInfo = delegateRelataionService.findUserInfo(agentId, userId);
    AgentResponse agentResponse = null;
    if (userInfo == null) {
        Map<String, Object> result = new HashMap<>();
        result.put("result", userInfo);
        agentResponse = new AgentResponse(NOT_SELF_USER, result);
    } else {
        Map<String, Object> result = new HashMap<>();
        result.put("result", userInfo);
        agentResponse = new AgentResponse(200, result);
    }
    return agentResponse;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HashMap(java.util.HashMap) ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) UserInfoVo(com.code.server.login.vo.UserInfoVo) AuthChecker(com.code.server.login.anotation.AuthChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with AuthChecker

use of com.code.server.login.anotation.AuthChecker in project summer by foxsugar.

the class HomeAction method showHomePage.

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

AuthChecker (com.code.server.login.anotation.AuthChecker)17 HttpServletRequest (javax.servlet.http.HttpServletRequest)17 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)17 ServletRequestAttributes (org.springframework.web.context.request.ServletRequestAttributes)17 HashMap (java.util.HashMap)6 AgentInfo (com.code.server.constant.db.AgentInfo)1 ChildCost (com.code.server.constant.db.ChildCost)1 AgentBean (com.code.server.constant.game.AgentBean)1 HomePageVo (com.code.server.login.vo.HomePageVo)1 OneLevelInfoVo (com.code.server.login.vo.OneLevelInfoVo)1 RecommandUserVo (com.code.server.login.vo.RecommandUserVo)1 TwoLevelInfoVo (com.code.server.login.vo.TwoLevelInfoVo)1 UserInfoVo (com.code.server.login.vo.UserInfoVo)1