mirror of
				https://gitee.com/lab1024/smart-admin.git
				synced 2025-11-04 10:23:43 +08:00 
			
		
		
		
	v3.11.0 【优化】SaTokenConfig与三级等保配置关联;【优化】smart-app去掉无用请求;
This commit is contained in:
		@@ -0,0 +1,34 @@
 | 
			
		||||
package net.lab1024.sa.base.config;
 | 
			
		||||
 | 
			
		||||
import cn.dev33.satoken.config.SaTokenConfig;
 | 
			
		||||
import net.lab1024.sa.base.module.support.securityprotect.service.Level3ProtectConfigService;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * 三级等保配置初始化后最低活跃频率全局配置
 | 
			
		||||
 *
 | 
			
		||||
 * @Author 1024创新实验室-创始人兼主任:卓大
 | 
			
		||||
 * @Date 2024/11/24
 | 
			
		||||
 * @Wechat zhuoda1024
 | 
			
		||||
 * @Email lab1024@163.com
 | 
			
		||||
 * @Copyright <a href="https://1024lab.net">1024创新实验室</a> ,Since 2012
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@Configuration
 | 
			
		||||
public class TokenConfig {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private Level3ProtectConfigService level3ProtectConfigService;
 | 
			
		||||
 | 
			
		||||
    // 此配置会覆盖 sa-base.yaml 中的配置
 | 
			
		||||
    @Resource
 | 
			
		||||
    public void configSaToken(SaTokenConfig config) {
 | 
			
		||||
 | 
			
		||||
        config.setActiveTimeout(level3ProtectConfigService.getLoginActiveTimeoutSeconds());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -44,7 +44,7 @@ public class Level3ProtectConfigService {
 | 
			
		||||
    /**
 | 
			
		||||
     * 最低活跃时间(单位:秒),超过此时间没有操作系统就会被冻结,默认-1 代表不限制,永不冻结; 默认 30分钟
 | 
			
		||||
     */
 | 
			
		||||
    private int loginActiveTimeoutSeconds = 1800;
 | 
			
		||||
    private int loginActiveTimeoutSeconds = -1;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 密码复杂度 是否开启,默认:开启
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ spring:
 | 
			
		||||
    host: smtp.163.com
 | 
			
		||||
    port: 465
 | 
			
		||||
    username: lab1024@163.com
 | 
			
		||||
    password: ROIMSIQCEXHTQFTA
 | 
			
		||||
    password: LAB1024LAB
 | 
			
		||||
    properties:
 | 
			
		||||
      mail:
 | 
			
		||||
        smtp:
 | 
			
		||||
 
 | 
			
		||||
@@ -21,18 +21,19 @@ spring:
 | 
			
		||||
        pointcut: net.lab1024.sa..*Service.*
 | 
			
		||||
 | 
			
		||||
  # redis 连接池配置信息
 | 
			
		||||
  redis:
 | 
			
		||||
    database: 1
 | 
			
		||||
    host: 127.0.0.1
 | 
			
		||||
    port: 6379
 | 
			
		||||
    password:
 | 
			
		||||
    timeout: 10000ms
 | 
			
		||||
    lettuce:
 | 
			
		||||
      pool:
 | 
			
		||||
        max-active: 100
 | 
			
		||||
        min-idle: 10
 | 
			
		||||
        max-idle: 50
 | 
			
		||||
        max-wait: 30000ms
 | 
			
		||||
  data:
 | 
			
		||||
    redis:
 | 
			
		||||
      database: 1
 | 
			
		||||
      host: 127.0.0.1
 | 
			
		||||
      port: 6379
 | 
			
		||||
      password:
 | 
			
		||||
      timeout: 10000ms
 | 
			
		||||
      lettuce:
 | 
			
		||||
        pool:
 | 
			
		||||
          max-active: 100
 | 
			
		||||
          min-idle: 10
 | 
			
		||||
          max-idle: 50
 | 
			
		||||
          max-wait: 30000ms
 | 
			
		||||
  # 邮件,置以SSL的方式发送, 这个需要使用这种方式并且端口是465
 | 
			
		||||
  mail:
 | 
			
		||||
    host: smtp.163.com
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,34 @@
 | 
			
		||||
package net.lab1024.sa.base.config;
 | 
			
		||||
 | 
			
		||||
import cn.dev33.satoken.config.SaTokenConfig;
 | 
			
		||||
import net.lab1024.sa.base.module.support.securityprotect.service.Level3ProtectConfigService;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * 三级等保配置初始化后最低活跃频率全局配置
 | 
			
		||||
 *
 | 
			
		||||
 * @Author 1024创新实验室-创始人兼主任:卓大
 | 
			
		||||
 * @Date 2024/11/24
 | 
			
		||||
 * @Wechat zhuoda1024
 | 
			
		||||
 * @Email lab1024@163.com
 | 
			
		||||
 * @Copyright <a href="https://1024lab.net">1024创新实验室</a> ,Since 2012
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@Configuration
 | 
			
		||||
public class TokenConfig {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private Level3ProtectConfigService level3ProtectConfigService;
 | 
			
		||||
 | 
			
		||||
    // 此配置会覆盖 sa-base.yaml 中的配置
 | 
			
		||||
    @Resource
 | 
			
		||||
    public void configSaToken(SaTokenConfig config) {
 | 
			
		||||
 | 
			
		||||
        config.setActiveTimeout(level3ProtectConfigService.getLoginActiveTimeoutSeconds());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -45,7 +45,7 @@ public class Level3ProtectConfigService {
 | 
			
		||||
    /**
 | 
			
		||||
     * 最低活跃时间(单位:秒),超过此时间没有操作系统就会被冻结,默认-1 代表不限制,永不冻结; 默认 30分钟
 | 
			
		||||
     */
 | 
			
		||||
    private int loginActiveTimeoutSeconds = 1800;
 | 
			
		||||
    private int loginActiveTimeoutSeconds = -1;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 密码复杂度 是否开启,默认:开启
 | 
			
		||||
 
 | 
			
		||||
@@ -61,13 +61,19 @@ export const useUserStore = defineStore({
 | 
			
		||||
    logout() {
 | 
			
		||||
      this.token = null;
 | 
			
		||||
      this.setUserLoginInfo(defaultUserInfo);
 | 
			
		||||
      console.log(333,USER_TOKEN);
 | 
			
		||||
      uni.removeStorage(USER_TOKEN);
 | 
			
		||||
    },
 | 
			
		||||
    clearUserLoginInfo() {
 | 
			
		||||
      this.setUserLoginInfo(defaultUserInfo);
 | 
			
		||||
      console.log(444,USER_TOKEN);
 | 
			
		||||
      uni.removeStorage(USER_TOKEN);
 | 
			
		||||
    },
 | 
			
		||||
    async getLoginInfo() {
 | 
			
		||||
      let token = uni.getStorageSync(USER_TOKEN);
 | 
			
		||||
      if(!token){
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      let res = await loginApi.getLoginInfo();
 | 
			
		||||
      this.setUserLoginInfo(res.data);
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user