mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-06-02 00:00:03 +08:00
在线用户,验证码,bug修复,代码优化
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@
|
||||
<description>magic-boot</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<magic-api.version>2.0.0-beta.3</magic-api.version>
|
||||
<magic-api.version>2.0.0</magic-api.version>
|
||||
<druid.version>1.1.10</druid.version>
|
||||
<hutool-all.version>5.7.13</hutool-all.version>
|
||||
<sa-token.version>1.26.0</sa-token.version>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.ssssssss.magicboot.config;
|
||||
package org.ssssssss.magicboot.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.ssssssss.magicboot.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CodeCacheMap {
|
||||
|
||||
private static Map<String, String> map = new HashMap<String, String>();
|
||||
|
||||
public static void put(String key, String value){
|
||||
map.put(key, value);
|
||||
}
|
||||
|
||||
public static void remove(String key){
|
||||
map.remove(key);
|
||||
}
|
||||
|
||||
public static String get(String key){
|
||||
return map.get(key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.ssssssss.magicboot.provider;
|
||||
|
||||
import cn.dev33.satoken.exception.DisableLoginException;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.ssssssss.magicapi.core.context.RequestEntity;
|
||||
import org.ssssssss.magicapi.core.interceptor.ResultProvider;
|
||||
import org.ssssssss.magicapi.core.model.JsonBean;
|
||||
|
||||
@Component
|
||||
public class ExceptionResultProvider implements ResultProvider {
|
||||
|
||||
@Override
|
||||
public Object buildResult(RequestEntity requestEntity, int code, String message, Object data) {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
return new JsonBean<>(code, message, data, (int) (timestamp - requestEntity.getRequestTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object buildException(RequestEntity requestEntity, Throwable throwable) {
|
||||
if(throwable.getCause() instanceof DisableLoginException){
|
||||
return buildResult(requestEntity, 500, "此账号已被临时封禁,请联系管理员");
|
||||
}
|
||||
return buildResult(requestEntity, 500, "系统内部出现错误");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user