From 63368d374f7c57bd05eb65eac2023e4698d1a7af Mon Sep 17 00:00:00 2001
From: gao <gaoleox@163>
Date: Thu, 21 May 2020 19:29:27 +0800
Subject: [PATCH] Merge branch 'master' of https://chonggaoxiao:xcg523511090712@gitee.com/chonggaoxiao/new_excoin.git

---
 src/main/java/com/xcong/excoin/common/LoginUserUtils.java |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/common/LoginUserUtils.java b/src/main/java/com/xcong/excoin/common/LoginUserUtils.java
index 7840a12..dbdd9d2 100644
--- a/src/main/java/com/xcong/excoin/common/LoginUserUtils.java
+++ b/src/main/java/com/xcong/excoin/common/LoginUserUtils.java
@@ -1,6 +1,7 @@
 package com.xcong.excoin.common;
 
 import com.xcong.excoin.modules.member.entity.MemberEntity;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.security.core.context.SecurityContextHolder;
 
 /**
@@ -9,9 +10,16 @@
  * @author wzy
  * @date 2020-05-14
  **/
+@Slf4j
 public class LoginUserUtils {
 
+    private static final String ANON = "anonymousUser";
+
     public static MemberEntity getAppLoginUser() {
-        return (MemberEntity) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+        if (SecurityContextHolder.getContext().getAuthentication().getPrincipal().equals(ANON)) {
+            return null;
+        } else {
+            return (MemberEntity) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+        }
     }
 }

--
Gitblit v1.9.1