李林
2023-12-28 f3637227614f3f7efa372d827f4dafb7cc8a85bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.yuanchu.mom.common;
 
import cn.hutool.json.JSONUtil;
import com.yuanchu.mom.mapper.AuthMapper;
import com.yuanchu.mom.utils.Jwt;
import com.yuanchu.mom.utils.ServletUtils;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
 
@Component
public class GetLook {
 
    @Resource
    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")+"");
        Map<String, Integer> map = new HashMap<>();
        map.put("userId", id);
        map.put("look", authMapper.countPower(id, method));
        return map;
    }
 
}