모의투자 로직 변경
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.goldenchart.controller;
|
||||
|
||||
import com.goldenchart.trading.TradingAccess;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/** 매매·모의·전략 API — 정식 로그인(userId) 필수 */
|
||||
public final class TradingControllerSupport {
|
||||
|
||||
private TradingControllerSupport() {}
|
||||
|
||||
public static long requireRegisteredUser(Map<String, String> headers) {
|
||||
String raw = headers.get("x-user-id");
|
||||
if (raw == null || raw.isBlank()) {
|
||||
throw new com.goldenchart.trading.TradingAccessDeniedException();
|
||||
}
|
||||
try {
|
||||
return TradingAccess.requireUserId(Long.parseLong(raw.trim()));
|
||||
} catch (NumberFormatException e) {
|
||||
throw new com.goldenchart.trading.TradingAccessDeniedException();
|
||||
}
|
||||
}
|
||||
|
||||
public static Long parseUserId(Map<String, String> headers) {
|
||||
String raw = headers.get("x-user-id");
|
||||
if (raw == null || raw.isBlank()) return null;
|
||||
try {
|
||||
return Long.parseLong(raw.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user