From 6ce4bf099fa38fe66e44722eccc111c8b33e7f96 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 29 Jun 2026 10:27:34 +0800
Subject: [PATCH] 假设多仓止损挂单位置: gridId=-5, -6, -7, -8 第一个止损位置: firstLongSlId = -5(最近的)
---
src/main/java/com/xcong/excoin/common/LoginUserUtils.java | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/common/LoginUserUtils.java b/src/main/java/com/xcong/excoin/common/LoginUserUtils.java
index 8f2400a..a59ba96 100644
--- a/src/main/java/com/xcong/excoin/common/LoginUserUtils.java
+++ b/src/main/java/com/xcong/excoin/common/LoginUserUtils.java
@@ -1,7 +1,12 @@
package com.xcong.excoin.common;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.xcong.excoin.common.contants.AppContants;
import com.xcong.excoin.common.exception.GlobalException;
import com.xcong.excoin.modules.member.entity.MemberEntity;
+import com.xcong.excoin.utils.RedisUtils;
+import com.xcong.excoin.utils.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpRequest;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -35,8 +40,14 @@
}
public static void resetAppLoginUser(MemberEntity memberEntity) {
- Authentication authentication = new UsernamePasswordAuthenticationToken(memberEntity, getAppLoginUserToken(), new ArrayList<>());
- SecurityContextHolder.getContext().setAuthentication(authentication);
+ String token = getAppLoginUserToken();
+ RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
+ String jsonStr = redisUtils.getString(AppContants.PC_LOGIN_PREFIX + token);
+ if (StrUtil.isNotBlank(jsonStr)) {
+ redisUtils.set(AppContants.PC_LOGIN_PREFIX + token, JSONObject.toJSONString(memberEntity));
+ } else {
+ redisUtils.set(AppContants.APP_LOGIN_PREFIX + token, JSONObject.toJSONString(memberEntity));
+ }
}
/**
@@ -58,7 +69,7 @@
public static boolean isBrowser(HttpServletRequest request) {
String userAgent = request.getHeader("user-agent");
- if (userAgent.toLowerCase().contains("mobile") || userAgent.toLowerCase().contains("okhttp")) {
+ if (userAgent.toLowerCase().contains("mobile") || userAgent.contains("CFNetwork") || userAgent.toLowerCase().contains("okhttp")) {
return false;
}
return true;
--
Gitblit v1.9.1