| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.common.utils.Http; |
| | | import com.zy.system.entity.*; |
| | | import com.zy.system.service.*; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.zy.common.utils.Http; |
| | | import com.zy.system.entity.*; |
| | | import com.zy.system.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.lang.Nullable; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * Created by vincent on 2019-06-13 |
| | |
| | | return false; |
| | | } |
| | | User user = userService.selectById(userLogin.getUserId()); |
| | | String deToken = Cools.deTokn(token, user.getPassword()); |
| | | long timestamp = Long.parseLong(deToken.substring(0, 13)); |
| | | // String deToken = Cools.deTokn(token, user.getPassword()); |
| | | // long timestamp = Long.parseLong(deToken.substring(0, 13)); |
| | | // 15分钟后过期 |
| | | if (System.currentTimeMillis() - timestamp > 900000){ |
| | | if (System.currentTimeMillis() - userLogin.getCreateTime().getTime() > 900000){ |
| | | Http.response(response, BaseRes.DENIED); |
| | | return false; |
| | | } |
| | |
| | | } |
| | | // 请求缓存 |
| | | request.setAttribute("userId", user.getId()); |
| | | // 更新 token 有效期 |
| | | userLogin.setCreateTime(new Date()); |
| | | userLoginService.updateById(userLogin); |
| | | // 操作日志 |
| | | if (!Cools.isEmpty(memo)) { |
| | | OperateLog operateLog = new OperateLog(); |