mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-03 19:58:42 +08:00 
			
		
		
		
	优化请求头的 tenant-id 的解析逻辑,避免前端传错类型
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
			
		||||
package cn.iocoder.yudao.framework.web.core.util;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.util.NumberUtil;
 | 
			
		||||
import cn.hutool.core.util.StrUtil;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 | 
			
		||||
@@ -40,7 +41,7 @@ public class WebFrameworkUtils {
 | 
			
		||||
     */
 | 
			
		||||
    public static Long getTenantId(HttpServletRequest request) {
 | 
			
		||||
        String tenantId = request.getHeader(HEADER_TENANT_ID);
 | 
			
		||||
        return StrUtil.isNotEmpty(tenantId) ? Long.valueOf(tenantId) : null;
 | 
			
		||||
        return NumberUtil.isNumber(tenantId) ? Long.valueOf(tenantId) : null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void setLoginUserId(ServletRequest request, Long userId) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user