feat: 初始化
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.webgame.webgamebackend;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableAspectJAutoProxy(proxyTargetClass = true) // 启用基于 AspectJ 的自动代理功能 支持使用AOP功能
|
||||
public class WebgameBackendApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WebgameBackendApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.webgame.webgamebackend.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||
import org.springframework.data.redis.cache.RedisCacheManager;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@Configuration
|
||||
public class RedisConfigurer {
|
||||
/**
|
||||
* 创建并配置 Redis 消息监听容器
|
||||
* 用于实现 Redis 的发布/订阅功能,支持监听特定频道的消息
|
||||
*
|
||||
* @param redisConnectionFactory Redis 连接工厂
|
||||
* @return 配置好的 RedisMessageListenerContainer 实例
|
||||
*/
|
||||
@Bean
|
||||
public RedisMessageListenerContainer redisMessageListenerContainer(RedisConnectionFactory redisConnectionFactory) {
|
||||
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(redisConnectionFactory);
|
||||
return container;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.webgame.webgamebackend.common.config;
|
||||
|
||||
import cn.dev33.satoken.fun.strategy.SaCorsHandleFunction;
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import cn.dev33.satoken.router.SaHttpMethod;
|
||||
import cn.dev33.satoken.router.SaRouter;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* [Sa-Token 权限认证] 配置类
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new SaInterceptor(handler -> {
|
||||
SaRouter.match("/**")
|
||||
.notMatch("/actuator/**")
|
||||
.check(r -> StpUtil.checkLogin());
|
||||
})).addPathPatterns("/**");
|
||||
}
|
||||
|
||||
/**
|
||||
* CORS 跨域处理策略
|
||||
*/
|
||||
@Bean
|
||||
public SaCorsHandleFunction corsHandle() {
|
||||
return (req, res, sto) -> {
|
||||
res
|
||||
// 允许指定域访问跨域资源
|
||||
.setHeader("Access-Control-Allow-Origin", "*")// 允许指定域访问跨域资源
|
||||
// 允许所有请求方式
|
||||
.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE")
|
||||
// 有效时间
|
||||
.setHeader("Access-Control-Max-Age", "3600")
|
||||
// 允许的header参数
|
||||
.setHeader("Access-Control-Allow-Headers", "*");
|
||||
|
||||
// 如果是预检请求,则立即返回到前端
|
||||
SaRouter.match(SaHttpMethod.OPTIONS)
|
||||
.free(r -> System.out.println("--------OPTIONS预检请求,不做处理"))
|
||||
.back();
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
package com.webgame.webgamebackend.common.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static java.lang.StringTemplate.STR;
|
||||
|
||||
/**
|
||||
* Redis缓存工具类
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RedisCacheUtil {
|
||||
/**
|
||||
* Redis缓存前缀
|
||||
*/
|
||||
private final static String CACHE_KEY_PREFIX = "xzg:";
|
||||
|
||||
/**
|
||||
* Redis操作类
|
||||
*/
|
||||
private final RedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 将值加入缓存
|
||||
*
|
||||
* @param k 键
|
||||
* @param v 值
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean cacheValue(String k, Object v) {
|
||||
return cacheValue(k.startsWith(":") ? k.substring(1) : k, v, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将值加入缓存,并添加过期时间。
|
||||
*
|
||||
* @param k 键
|
||||
* @param v 值
|
||||
* @param expireTime 过期时间(毫秒)
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean cacheValue(String k, Object v, long expireTime) {
|
||||
return cacheValue(k.startsWith(":") ? k.substring(1) : k, v, expireTime, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将值加入缓存,并添加过期时间。
|
||||
*
|
||||
* @param k 键
|
||||
* @param v 值
|
||||
* @param expireTime 过期时间
|
||||
* @param expireUnit 过期时间单位
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean cacheValue(String k, Object v, long expireTime, TimeUnit expireUnit) {
|
||||
if (k.startsWith(":")) k = k.substring(1);
|
||||
var key = CACHE_KEY_PREFIX + k;
|
||||
|
||||
var json = "";
|
||||
try {
|
||||
json = JSON.toJSONString(v);
|
||||
} catch (Exception e) {
|
||||
log.error(STR."写入缓存失败, 键: \{key}, 原因: \{e.getMessage()}", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
var valueOps = redisTemplate.opsForValue();
|
||||
valueOps.set(key, json);
|
||||
|
||||
if (expireTime > 0) redisTemplate.expire(key, expireTime, expireUnit);
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error(STR."写入缓存失败, 键: \{key}, 值: \{json}, 原因: \{e.getMessage()}", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将值加入缓存,并添加过期时间
|
||||
*
|
||||
* @param prefix 键组前缀
|
||||
* @param k 键
|
||||
* @param v 值
|
||||
* @param expireTime 过期时间(毫秒)
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean cacheValue(String prefix, String k, Object v, long expireTime) {
|
||||
if (!prefix.endsWith(":")) prefix = STR."\{prefix}:";
|
||||
if (k.startsWith(":")) k = k.substring(1);
|
||||
return cacheValue(prefix + k, v, expireTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将值加入缓存,并添加过期时间。
|
||||
*
|
||||
* @param prefix 键组前缀
|
||||
* @param k 键
|
||||
* @param v 值
|
||||
* @param expireTime 过期时间(毫秒)
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean cacheValue(String prefix, Long k, Object v, long expireTime) {
|
||||
if (prefix.startsWith(":")) prefix = prefix.substring(1);
|
||||
if (!prefix.endsWith(":")) prefix = STR."\{prefix}:";
|
||||
return cacheValue(prefix + k, v, expireTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询缓存
|
||||
*
|
||||
* @param k 键
|
||||
* @param cls 序列化类型
|
||||
* @param expireTime 查询后更新过期时间(毫秒)
|
||||
* @param <T> 序列化类型
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
public <T> T getCache(String k, Class<T> cls, long expireTime) {
|
||||
return getCache(k.startsWith(":") ? k.substring(1) : k, cls, expireTime, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询缓存
|
||||
*
|
||||
* @param k 键
|
||||
* @param cls 序列化类型
|
||||
* @param expireTime 查询后更新过期时间
|
||||
* @param expireUnit 时间单位
|
||||
* @param <T> 序列化类型
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
public <T> T getCache(String k, Class<T> cls, long expireTime, TimeUnit expireUnit) {
|
||||
if (k.startsWith(":")) k = k.substring(1);
|
||||
var key = CACHE_KEY_PREFIX + k;
|
||||
try {
|
||||
// 由于 ValueOperations 的 getAndExpire 查询命令 GETEX
|
||||
// 在 Redis 6.2 以下版本不支持, 由于可能服务器环境使用 WindowsServer系统,
|
||||
// 安装的Redis版本小于6.2版本,所以这里使用 get + expire。
|
||||
var valueOps = redisTemplate.opsForValue();
|
||||
|
||||
// 查询缓存
|
||||
var json = valueOps.get(key);
|
||||
if (json == null) return null;
|
||||
|
||||
// 更新过期时间
|
||||
redisTemplate.expire(key, expireTime, expireUnit);
|
||||
|
||||
// 返回结果
|
||||
return JSON.to(cls, json);
|
||||
} catch (Exception e) {
|
||||
log.error("查询缓存失败, 键: {}", key, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询缓存
|
||||
*
|
||||
* @param prefix 键组前缀
|
||||
* @param k 键
|
||||
* @param cls 序列化类型
|
||||
* @param expireTime 查询后更新过期时间(毫秒)
|
||||
* @param <T> 序列化类型
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
public <T> T getCache(String prefix, String k, Class<T> cls, long expireTime) {
|
||||
if (prefix.startsWith(":")) prefix = prefix.substring(1);
|
||||
if (!prefix.endsWith(":")) prefix = STR."\{prefix}:";
|
||||
if (k.startsWith(":")) k = k.substring(1);
|
||||
return getCache(prefix + k, cls, expireTime, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询缓存
|
||||
*
|
||||
* @param prefix 键组前缀
|
||||
* @param k 键
|
||||
* @param cls 序列化类型
|
||||
* @param expireTime 查询后更新过期时间(毫秒)
|
||||
* @param <T> 序列化类型
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
public <T> T getCache(String prefix, Long k, Class<T> cls, long expireTime) {
|
||||
if (prefix.startsWith(":")) prefix = prefix.substring(1);
|
||||
if (!prefix.endsWith(":")) prefix = STR."\{prefix}:";
|
||||
return getCache(prefix + k, cls, expireTime, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询缓存
|
||||
*
|
||||
* @param k 键
|
||||
* @param cls 序列化类型
|
||||
* @param <T> 序列化类型
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
public <T> T getCache(String k, Class<T> cls) {
|
||||
return getCache(k.startsWith(":") ? k.substring(1) : k, cls, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询缓存
|
||||
*
|
||||
* @param k 键
|
||||
* @param cls 序列化类型
|
||||
* @param remove 查询后是否移除
|
||||
* @param <T> 序列化类型
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
public <T> T getCache(String k, Class<T> cls, Boolean remove) {
|
||||
if (k.startsWith(":")) k = k.substring(1);
|
||||
var key = CACHE_KEY_PREFIX + k;
|
||||
try {
|
||||
var valueOps = redisTemplate.opsForValue();
|
||||
var json = remove ? valueOps.getAndDelete(key) : valueOps.get(key);
|
||||
if (json == null) return null;
|
||||
|
||||
return JSON.to(cls, json);
|
||||
} catch (Exception e) {
|
||||
log.error("查询缓存失败, 键: {}", key, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除缓存
|
||||
*
|
||||
* @param prefix 键组前缀
|
||||
* @param k 键
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean removeCache(String prefix, Long k) {
|
||||
if (prefix.startsWith(":")) prefix = prefix.substring(1);
|
||||
if (!prefix.endsWith(":")) prefix = STR."\{prefix}:";
|
||||
return removeCache(prefix + k);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除缓存
|
||||
*
|
||||
* @param k 键
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean removeCache(String k) {
|
||||
if (k.startsWith(":")) k = k.substring(1);
|
||||
var key = CACHE_KEY_PREFIX + k;
|
||||
try {
|
||||
if (key.endsWith(":*")) {
|
||||
var keys = redisTemplate.keys(key);
|
||||
if (!keys.isEmpty())
|
||||
redisTemplate.delete(keys);
|
||||
return true;
|
||||
} else return redisTemplate.delete(key);
|
||||
} catch (Exception e) {
|
||||
log.error("移除缓存失败, 键: {}", key, e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除缓存
|
||||
*
|
||||
* @param prefix 键组前缀
|
||||
* @param k 键
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean removeCache(String prefix, String k) {
|
||||
if (prefix.startsWith(":")) prefix = prefix.substring(1);
|
||||
if (!prefix.endsWith(":")) prefix = STR."\{prefix}:";
|
||||
if (k.startsWith(":")) k = k.substring(1);
|
||||
return removeCache(prefix + k);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.webgame.webgamebackend.common.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.listener.PatternTopic;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Redis消息队列工具类
|
||||
* @author xzg
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RedisMqUtil {
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
private final RedisMessageListenerContainer redisMessageListenerContainer;
|
||||
|
||||
public void pub(String channel, Object message) {
|
||||
try {
|
||||
if (StringUtils.isBlank(channel)) {
|
||||
log.warn("[REDIS消息队列] 发布信息失败: 通道名称为 null");
|
||||
return;
|
||||
}
|
||||
if (message == null) {
|
||||
log.warn(STR."[REDIS消息队列] 发布信息至通道(\{channel})失败: 信息体为 null");
|
||||
return;
|
||||
}
|
||||
|
||||
// 信息体转JSON
|
||||
var json = "";
|
||||
try {
|
||||
json = JSON.toJSONString(message);
|
||||
} catch (Exception e) {
|
||||
log.warn(STR."[REDIS消息队列] 发布信息至通道(\{channel})异常: 信息实体无法正确的序列化为JSON字符串, \{e.getMessage()}", e);
|
||||
return;
|
||||
}
|
||||
|
||||
redisTemplate.convertAndSend(channel, json);
|
||||
} catch (Exception e) {
|
||||
log.warn(STR."[REDIS消息队列] 发布信息至通道(\{channel})异常: \{e.getMessage()}", e);
|
||||
}
|
||||
}
|
||||
|
||||
public <T> void sub(String channel, Class<T> clazz, Consumer<T> callback) {
|
||||
if (StringUtils.isBlank(channel)) {
|
||||
log.warn("[REDIS消息队列] 订阅通道失败, 通道名称不可为空");
|
||||
return;
|
||||
}
|
||||
if (callback == null) {
|
||||
log.warn(STR."[REDIS消息队列] 订阅通道(\{channel})失败, 回调方法不可为空");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var adapter = new MessageListenerAdapter((MessageListener) (message, _) -> {
|
||||
var body = message.getBody();
|
||||
var channelName = new String(message.getChannel());
|
||||
|
||||
T dto;
|
||||
try {
|
||||
dto = JSON.parseObject(new String(body), clazz);
|
||||
} catch (Exception e) {
|
||||
log.error(STR."[REDIS消息队列] 消费通道(\{channelName})信息实体类型转换处理异常: \{e.getMessage()}, 信息: \{body}", e);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
callback.accept(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(STR."[REDIS消息队列] 消费通道(\{channelName})信息回调处理异常: \{e.getMessage()}, 信息: \{body}", e);
|
||||
}
|
||||
});
|
||||
|
||||
redisMessageListenerContainer.addMessageListener(adapter, new PatternTopic(channel));
|
||||
} catch (Exception e) {
|
||||
log.error(STR."[REDIS消息队列] 订阅通道(\{channel})异常: \{e.getMessage()}", e);
|
||||
return;
|
||||
}
|
||||
|
||||
log.info(STR."[REDIS消息队列] 订阅通道(\{channel})成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.webgame.webgamebackend.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/account")
|
||||
@RequiredArgsConstructor
|
||||
public class AccountController {
|
||||
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/login")
|
||||
public String login() {
|
||||
return "login";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.webgame.webgamebackend.service;
|
||||
|
||||
public interface AccountService {
|
||||
/**
|
||||
* 登录
|
||||
* @return token
|
||||
*/
|
||||
public String login();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.webgame.webgamebackend.service.impl;
|
||||
|
||||
import com.webgame.webgamebackend.service.AccountService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AccountServiceImpl implements AccountService {
|
||||
@Override
|
||||
public String login() {
|
||||
return "login";
|
||||
}
|
||||
}
|
||||
85
src/main/resources/application.yml
Normal file
85
src/main/resources/application.yml
Normal file
@@ -0,0 +1,85 @@
|
||||
spring:
|
||||
application:
|
||||
name: webgame-backend
|
||||
|
||||
# 数据库配置
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/webgame?useTimezone=true&createDatabaseIfNotExist=true&serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: Azure1314
|
||||
|
||||
data:
|
||||
# redis配置
|
||||
redis:
|
||||
# Redis数据库索引(默认为0)
|
||||
database: 1
|
||||
# Redis服务器地址
|
||||
host: 127.0.0.1
|
||||
# Redis服务器连接端口
|
||||
port: 6379
|
||||
# Redis服务器连接密码(默认为空)
|
||||
password: Azure1314
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数
|
||||
max-active: 200
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 10
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
|
||||
# JPA相关配置
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: update
|
||||
show-sql: false # 是否输出sql
|
||||
open-in-view: false
|
||||
|
||||
# Servlet相关配置
|
||||
servlet:
|
||||
# 文件上传配置
|
||||
multipart:
|
||||
# 单个文件上传大小限制
|
||||
max-file-size: 10MB
|
||||
# 请求上传大小限制(包括所有文件和表单数据)
|
||||
max-request-size: 100MB
|
||||
|
||||
# 配置事务管理日志级别
|
||||
logging:
|
||||
level:
|
||||
org.springframework.jpa.support.SpringTxScopeManager: debug
|
||||
|
||||
# # minio资源存储配置信息
|
||||
# minio:
|
||||
# # MinIO服务地址
|
||||
# endpoint: http://nas.xzg955.top:29000
|
||||
# # 管理员账号(对应MINIO_ROOT_USER)
|
||||
# access-key: Xdnq0QCGFwMCl4j61Wq0
|
||||
# # 管理员密码(对应MINIO_ROOT_PASSWORD)
|
||||
# secret-key: nyLCMXJe2yw2MsQxlfyWclypdOTUgFWDj8faKfG2
|
||||
# # 默认存储桶名称
|
||||
# bucket-name: images
|
||||
# #如果是true,则用的是https而不是http,默认值是true
|
||||
# secure: false
|
||||
|
||||
############## Sa-Token 配置 (文档: https://sa-token.cc) ##############
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: saToken
|
||||
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
active-timeout: -1
|
||||
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
|
||||
is-concurrent: true
|
||||
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
|
||||
is-share: false
|
||||
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik)
|
||||
token-style: uuid
|
||||
# 是否输出操作日志
|
||||
is-log: true
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.webgame.webgamebackend;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class WebgameBackendApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user