| | |
| | | package com.yeshi.buwan.aspect; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @Component |
| | | @Aspect |
| | |
| | | |
| | | |
| | | @Around("execution(public * com.yeshi.buwan.controller.admin.api.*.*(..))") |
| | | public Object verifyLoginState(ProceedingJoinPoint joinPoint) throws IOException { |
| | | public Object verifyLoginState(ProceedingJoinPoint joinPoint) throws Throwable { |
| | | |
| | | ServletRequestAttributes servletContainer = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); |
| | | |
| | | HttpServletRequest request = servletContainer.getRequest(); |
| | | // AdminInfo admin = (AdminInfo) request.getSession().getAttribute(Constant.ADMIN); |
| | | // if(admin==null){ |
| | | // return null; |
| | | // } |
| | | AdminInfo admin = (AdminInfo) request.getSession().getAttribute(Constant.ADMIN); |
| | | if(admin==null){ |
| | | return null; |
| | | } |
| | | Object[] args = joinPoint.getArgs(); |
| | | Object obj = null; |
| | | try { |