Browse Source

fix 酷乐秀扫码登录

Eric 2 months ago
parent
commit
8ff49c8fff

+ 10 - 0
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/service/impl/CbsQrCodeScanServiceImpl.java

@@ -39,6 +39,16 @@ public class CbsQrCodeScanServiceImpl {
         CbsQrCodeScanWrapper.UserInfo userInfo = new CbsQrCodeScanWrapper.UserInfo();
         userInfo.setUsername(customTokenServices.loadAuthentication(req.getToken()).getName().split(":")[1]);
         userInfo.setClientTypes("TEACHER");
+
+        SysUser sysUser = sysUserService.queryByPhone(userInfo.getUsername());
+        if (sysUser == null) {
+            throw new BizException(HttpStatus.UNAUTHORIZED.value(), "用户不存在");
+        }
+
+        if (sysUser.getTenantId() == -1L) {
+            // 平台老师不允许扫码登录乐教通,返回机构ID
+            userInfo.setClientTypes("-1");
+        }
         return userInfo;
     }