소스 검색

接口修改

zhanghao 3 주 전
부모
커밋
41a83b9bec

+ 5 - 0
project-admin/src/main/java/com/project/web/controller/system/SysLoginController.java

@@ -5,6 +5,7 @@ import com.project.common.core.domain.AjaxResult;
 import com.project.common.core.domain.entity.SysMenu;
 import com.project.common.core.domain.entity.SysUser;
 import com.project.common.core.domain.model.LoginBody;
+import com.project.common.mapper.cache.PlatCacheMapper;
 import com.project.common.utils.SecurityUtils;
 import com.project.framework.web.service.SysLoginService;
 import com.project.framework.web.service.SysPermissionService;
@@ -34,6 +35,9 @@ public class SysLoginController {
     @Autowired
     private SysPermissionService permissionService;
 
+    @Autowired
+    private PlatCacheMapper platCacheMapper;
+
     /**
      * 登录方法
      *
@@ -47,6 +51,7 @@ public class SysLoginController {
         String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
                 loginBody.getUuid());
         ajax.put(Constants.TOKEN, token);
+        platCacheMapper.deleteCacheObscure("hq-service:captcha_codes:%");
         return ajax;
     }
 

+ 2 - 0
project-common/src/main/java/com/project/common/core/redis/MyCache.java

@@ -73,6 +73,7 @@ public class MyCache {
         if (cache == null || StringUtils.isBlank(cache.getKey())){
             return false;
         }
+        /*不要过期*/
         LocalDateTime createTimePlus30 = cache.getCreateTime().toInstant()
                 .atZone(java.time.ZoneId.systemDefault())
                 .toLocalDateTime()
@@ -113,6 +114,7 @@ public class MyCache {
             return "true";
         }
         LargeCache cache = platCacheMapper.selectCache(key.toString());
+        /*不要过期*/
         if (cache == null || StringUtils.isBlank(cache.getKey())){
             return null;
         }

+ 2 - 0
project-common/src/main/java/com/project/common/mapper/cache/PlatCacheMapper.java

@@ -13,6 +13,8 @@ public interface PlatCacheMapper {
 
     void deleteCache(String key);
 
+    void deleteCacheObscure(String key);
+
     void deleteCaches(List<String> list);
 
     List<String> selectKeys();

+ 6 - 2
project-common/src/main/resources/mapper/common.cache/PlatCacheMapper.xml

@@ -23,13 +23,17 @@
 
     <insert id="insertCache">
         insert into large_plat_cache(`key`,`data`,expiration_date,create_time)
-        values (#{arg0},#{arg1},30,sysdate())
+        values (#{arg0},#{arg1},129600,sysdate())
     </insert>
 
     <delete id="deleteCache" parameterType="String">
         delete from large_plat_cache where `key` = #{key}
     </delete>
 
+    <delete id="deleteCacheObscure" parameterType="String">
+        delete from large_plat_cache where `key` like #{key}
+    </delete>
+
     <delete id="deleteCaches" parameterType="String">
         delete from large_plat_cache where `key` in
         <foreach collection="list" item="item" open="(" separator="," close=")">
@@ -43,7 +47,7 @@
         FROM
             large_plat_cache
         WHERE
-            DATE_ADD( create_time, INTERVAL 30 MINUTE ) > SYSDATE()
+            DATE_ADD( create_time, INTERVAL 129600 MINUTE ) > SYSDATE()
     </select>
 
     <delete id="clearAll">