修改:

1.放行爬大哥登录接口
2.添加 redis 持久化登录 token
3.修改排序名称字段注解信息
4.修改筛选大哥控制类方法名
This commit is contained in:
2025-06-25 21:55:49 +08:00
parent 43ddab223c
commit 273db0b8a1
7 changed files with 30 additions and 9 deletions

12
pom.xml
View File

@@ -54,6 +54,18 @@
<artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.44.0</version>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-redis-template</artifactId>
<version>1.44.0</version>
</dependency>
<!-- 提供 Redis 连接池 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>

View File

@@ -44,7 +44,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
"/favicon.ico",
// 你的其他放行路径,例如登录接口
"/user/doLogin",
"/tenant/get-id-by-name"
"/tenant/get-id-by-name",
"/user/bigbrother-doLogin"
};
}

View File

@@ -3,11 +3,8 @@ package com.yupi.springbootinit.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yupi.springbootinit.common.BaseResponse;
import com.yupi.springbootinit.common.ResultUtils;
import com.yupi.springbootinit.model.dto.host.HostInfoDTO;
import com.yupi.springbootinit.model.dto.host.ServerBigBrotherDTO;
import com.yupi.springbootinit.model.vo.bigbrother.ServerBigBrotherVO;
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
import com.yupi.springbootinit.service.HostInfoService;
import com.yupi.springbootinit.service.ServerBigBrotherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -29,7 +26,7 @@ public class BigBrotherController {
private ServerBigBrotherService bigBrotherService;
@PostMapping("page")
public BaseResponse<Page<ServerBigBrotherVO>> hostsInfo(@RequestBody ServerBigBrotherDTO serverBigBrotherDTO){
public BaseResponse<Page<ServerBigBrotherVO>> getBigBrotherPage(@RequestBody ServerBigBrotherDTO serverBigBrotherDTO){
Page<ServerBigBrotherVO> conditionHosts = bigBrotherService.getConditionHosts(serverBigBrotherDTO);
return ResultUtils.success(conditionHosts);
}

View File

@@ -55,7 +55,7 @@ public class UserController {
SystemUsersVO systemUsersVO = new SystemUsersVO();
BeanUtil.copyProperties(user, systemUsersVO);
// 赋予用户 Id
StpUtil.login(user.getId());
StpUtil.login(user.getId(),"host");
// 设置 token 有效期为当前日期和套餐有效期的差值
StpUtil.renewTimeout(second);
systemUsersVO.setTokenName(StpUtil.getTokenName());
@@ -87,7 +87,7 @@ public class UserController {
SystemUsersVO systemUsersVO = new SystemUsersVO();
BeanUtil.copyProperties(user, systemUsersVO);
// 赋予用户 Id
StpUtil.login(user.getId());
StpUtil.login(user.getId(),"bigbrother");
// 设置 token 有效期为当前日期和套餐有效期的差值
StpUtil.renewTimeout(second);
systemUsersVO.setTokenName(StpUtil.getTokenName());

View File

@@ -126,7 +126,7 @@ public class ServerBigBrotherDTO extends PageRequest implements Serializable {
/**
* 按照何种业务排序
*/
@ApiModelProperty(value = "排序字段(createTime/hostsCoins/fans等)", example = "hostsCoins")
@ApiModelProperty(value = "排序字段(historicHighCoins/totalGiftCoins/level等)", example = "hostsCoins")
private String sortName;

View File

@@ -14,10 +14,20 @@ spring:
# Redis 配置
# todo 需替换配置
redis:
database: 0
database: 1
host: localhost
port: 6379
timeout: 5000
lettuce:
pool:
# 连接池最大连接数
max-active: 200
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# 连接池中的最大空闲连接
max-idle: 10
# 连接池中的最小空闲连接
min-idle: 0
rabbitmq:
host: localhost
port: 5672

View File

@@ -108,5 +108,6 @@ sa-token:
# 是否输出操作日志
is-log: true
md5:
salt: (-FhqvXO,wMz