新增user服务和gateway服务

This commit is contained in:
jiangh277
2025-08-12 19:01:26 +08:00
parent 957462b60b
commit aa42f35254
29 changed files with 1047 additions and 1 deletions

View File

@@ -14,4 +14,8 @@ public class CommonConstants {
public static final int DELETED = 1;
public static final int NOT_DELETED = 0;
public static final String LOW_RESOLUTION_PREFIX = "low_res_";
// 用户状态
public static final int USER_STATUS_NORMAL = 0;
public static final int USER_STATUS_DISABLED = 1;
}

View File

@@ -0,0 +1,26 @@
package com.timeline.common.utils;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
public class UserContextUtils {
public static String getCurrentUserId() {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes != null) {
HttpServletRequest request = attributes.getRequest();
return request.getHeader("X-User-Id");
}
return null;
}
public static String getCurrentUsername() {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes != null) {
HttpServletRequest request = attributes.getRequest();
return request.getHeader("X-Username");
}
return null;
}
}