lyhzzz hai 1 mes
pai
achega
f285aebe6c

+ 3 - 1
src/main/java/com/fdkankan/tk/common/util/JwtUtil.java

@@ -3,6 +3,8 @@ package com.fdkankan.tk.common.util;
 import com.auth0.jwt.JWT;
 import com.auth0.jwt.exceptions.JWTDecodeException;
 import com.auth0.jwt.interfaces.DecodedJWT;
+import com.fdkankan.tk.common.ResultCode;
+import com.fdkankan.tk.exception.BusinessException;
 import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.JwtBuilder;
 import io.jsonwebtoken.Jwts;
@@ -119,7 +121,7 @@ public class JwtUtil {
             DecodedJWT jwt = JWT.decode(token);
             return jwt.getClaim("userName").asString();
         } catch (JWTDecodeException e) {
-            return null;
+           throw new BusinessException(ResultCode.USER_NOT_LOGIN);
         }
     }
     /**

+ 0 - 3
src/main/java/com/fdkankan/tk/service/impl/SceneServiceImpl.java

@@ -55,9 +55,6 @@ public class SceneServiceImpl implements ISceneService {
     @Override
     public PageInfo pageList(SceneParam param, String token) {
         String userName = JwtUtil.getUserName(token);
-        if(StringUtils.isBlank(userName)){
-            throw new BusinessException(ResultCode.USER_NOT_LOGIN);
-        }
         param.setUserName(userName);
         Page<SceneVo> voPage = scenePlusService.pageList(param);
         for (SceneVo vo : voPage.getRecords()) {