package com.zcloud.common.utils;

import com.zcloud.modules.sys.service.ShiroService;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

public class UserUtils {
    public static String getUserIdFromRequest(HttpServletRequest request, ShiroService shiroService) {
        // 从HTTP请求头中获取token
        String token = request.getHeader("token");
        // 使用token获取用户信息，并返回用户ID
        return shiroService.queryByToken(token).getUserId();
    }
}
