| | |
| | | package com.yuanchu.mom.common; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.mapper.AuthMapper; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.utils.ServletUtils; |
| | |
| | | private AuthMapper authMapper; |
| | | |
| | | public Map<String, Integer> selectPowerByMethodAndUserId(String method){ |
| | | Integer id = Integer.parseInt(JSONUtil.parseObj(new Jwt().readJWT(ServletUtils.getRequest().getHeader("token")).get("data")).get("id")+""); |
| | | Integer id; |
| | | try { |
| | | id = Integer.parseInt(JSONUtil.parseObj(new Jwt().readJWT(ServletUtils.getRequest().getHeader("token")).get("data")).get("id")+""); |
| | | }catch (NumberFormatException e){ |
| | | throw new ErrorException("授权已过期请重新登陆"); |
| | | } |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | map.put("userId", id); |
| | | map.put("look", authMapper.countPower(id, method)); |