value
2024-05-14 eb1a57285bb3468a4efe051781b8cc7a13ec23c6
framework/src/main/java/com/yuanchu/mom/common/GetLook.java
@@ -1,6 +1,7 @@
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;
@@ -17,7 +18,12 @@
    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));