朱佳吉
2024-05-09 d4fd54448ff25bfecb1ea026fb2389a7e331a3fd
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
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;
    }
}