Merge branch 'test' into dev
# Conflicts: # src/main/resources/application.yml
This commit is contained in:
commit
552cfc4e8f
|
|
@ -201,6 +201,7 @@ public class AppController {
|
|||
if (count > 0) {
|
||||
UserEntity userEntity = userService.getById(userId);
|
||||
userEntity.setStatus(0);
|
||||
userEntity.setPlatform("异常行为用户:实名信息异常 在黑名单");
|
||||
userService.update(userEntity, new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getUserId, userId));
|
||||
log.warn("异常行为用户:实名信息异常: {}", userId);
|
||||
return Result.error("异常行为: 您的实名信息存在异常行为");
|
||||
|
|
|
|||
|
|
@ -89,9 +89,10 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
|||
long userId = Long.parseLong(claims.getSubject());
|
||||
request.setAttribute(USER_KEY, userId);
|
||||
|
||||
String ip = IPUtils.getIpAddr(request); // 获取用户的 IP 地址
|
||||
// 获取用户的 IP 地址
|
||||
String ip = IPUtils.getIpAddr(request);
|
||||
// 检查用户是否超过限流
|
||||
if (redisService.checkIpJumpLimit(userId, ip)) {
|
||||
if (redisService.checkIpJumpLimit(userId, ip) && userId != 14234L && userId != 1074096240846845557L) {
|
||||
log.warn("用户地址跳动频繁,封禁: {}", userId);
|
||||
if (!redisService.isSetUserState(userId)) {
|
||||
ThreadUtil.execAsync(() -> {
|
||||
|
|
|
|||
|
|
@ -534,8 +534,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setMoney(orders.getPayDiamond());
|
||||
userMoneyDetails.setUserId(orders.getUserId());
|
||||
userMoneyDetails.setContent("金币支付订单");
|
||||
userMoneyDetails.setTitle("下单成功,订单号:" + orders.getOrdersNo());
|
||||
userMoneyDetails.setContent("金币解锁视频");
|
||||
userMoneyDetails.setTitle("解锁成功,订单号:" + orders.getOrdersNo());
|
||||
userMoneyDetails.setType(2);
|
||||
// ✅
|
||||
userMoneyDetails.setClassify(3);
|
||||
|
|
|
|||
|
|
@ -152,21 +152,22 @@ public class RedisServiceImpl implements RedisService {
|
|||
return expireTime == -1 ? second : expireTime > DateUtil.current(false) ? expireTime - DateUtil.current(false) : 0L;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkIpJumpLimit(long userId, String ip) {
|
||||
String userKey = "user:" + userId + ":last_ip"; // 存储用户上次的 IP 地址
|
||||
// 存储用户上次的 IP 地址
|
||||
String userKey = "user:" + userId + ":last_ip";
|
||||
String lastIp = redisTemplate.opsForValue().get(userKey);
|
||||
|
||||
// 获取用户跳动的历史 IP 地址集合
|
||||
String jumpHistoryKey = "user:" + userId + ":ip_history"; // 记录用户跳动过的 IP 地址
|
||||
String jumpHistoryKey = "user:" + userId + ":ip_history";
|
||||
Set<String> jumpHistory = redisTemplate.opsForSet().members(jumpHistoryKey);
|
||||
|
||||
// 记录 IP 跳动次数
|
||||
String ipTimestampKey = "user:" + userId + ":ip_timestamp"; // 记录每个 IP 跳动的过期时间
|
||||
String userJumpCountKey = "user:" + userId + ":jump_count"; // 用户跳动的总次数
|
||||
String ipTimestampKey = "user:" + userId + ":ip_timestamp";
|
||||
String userJumpCountKey = "user:" + userId + ":jump_count";
|
||||
|
||||
// 新增用于记录所有 IP 请求时间和次数的 Hash
|
||||
String ipRequestsKey = "user:" + userId + ":ip_requests"; // 用来记录 IP 的请求次数和时间
|
||||
String ipRequestsKey = "user:" + userId + ":ip_requests";
|
||||
|
||||
|
||||
// 如果用户之前没有记录过 IP,说明是第一次请求,直接保存
|
||||
|
|
|
|||
|
|
@ -28,6 +28,19 @@ max-lifetime: 30000
|
|||
connection-timeout: 30000
|
||||
|
||||
spring:
|
||||
redis:
|
||||
open: true # 是否开启redis缓存 true开启 false关闭
|
||||
database: 0
|
||||
host: 47.122.26.160 # Redis服务器地址
|
||||
port: 6379
|
||||
password: 222222 # 密码(默认为空)
|
||||
timeout: 6000ms # 连接超时时长(毫秒)
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 5 # 连接池中的最小空闲连接
|
||||
# sharding-jdbc 配置
|
||||
shardingsphere:
|
||||
# 显示sharding-jdbc改写的sql语句
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
swagger:
|
||||
enabled: true
|
||||
enabled: false
|
||||
pay:
|
||||
h5BaseUrl: https://dj-h5.hnsiyao.cn/me/detail/detail?allId=
|
||||
orderNotifyUrl: https://pay.hnsiyao.cn/czg/app/wuyou/notify
|
||||
|
|
@ -29,6 +29,19 @@ max-lifetime: 30000
|
|||
connection-timeout: 30000
|
||||
|
||||
spring:
|
||||
redis:
|
||||
open: true # 是否开启redis缓存 true开启 false关闭
|
||||
database: 0
|
||||
host: 47.122.73.144 # Redis服务器地址
|
||||
port: 6379
|
||||
password: 222222 # 密码(默认为空)
|
||||
timeout: 6000ms # 连接超时时长(毫秒)
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 5 # 连接池中的最小空闲连接
|
||||
# sharding-jdbc 配置
|
||||
shardingsphere:
|
||||
# 显示sharding-jdbc改写的sql语句
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
swagger:
|
||||
enabled: true
|
||||
enabled: false
|
||||
pay:
|
||||
h5BaseUrl: https://dj-h5.hnsiyao.cn/me/detail/detail?allId=
|
||||
orderNotifyUrl: https://pay.hnsiyao.cn/czg/app/wuyou/notify
|
||||
|
|
@ -28,6 +28,19 @@ max-lifetime: 30000
|
|||
connection-timeout: 30000
|
||||
|
||||
spring:
|
||||
redis:
|
||||
open: true # 是否开启redis缓存 true开启 false关闭
|
||||
database: 0
|
||||
host: 127.0.0.1 # Redis服务器地址
|
||||
port: 6379
|
||||
password: 222222 # 密码(默认为空)
|
||||
timeout: 6000ms # 连接超时时长(毫秒)
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 5 # 连接池中的最小空闲连接
|
||||
# sharding-jdbc 配置
|
||||
shardingsphere:
|
||||
# 显示sharding-jdbc改写的sql语句
|
||||
|
|
|
|||
|
|
@ -25,19 +25,7 @@ spring:
|
|||
max-file-size: 10240MB
|
||||
max-request-size: 10240MB
|
||||
enabled: true
|
||||
redis:
|
||||
open: true # 是否开启redis缓存 true开启 false关闭
|
||||
database: 0
|
||||
host: 127.0.0.1 # Redis服务器地址
|
||||
port: 6379
|
||||
password: 222222 # 密码(默认为空)
|
||||
timeout: 6000ms # 连接超时时长(毫秒)
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 5 # 连接池中的最小空闲连接
|
||||
|
||||
mvc:
|
||||
throw-exception-if-no-handler-found: true
|
||||
# pathmatch:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.sqx;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.PageUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
|
@ -14,6 +17,7 @@ import com.sqx.modules.app.entity.UserMoneyDetails;
|
|||
import com.sqx.modules.app.service.InviteAchievementService;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.job.task.TempOrdersTask;
|
||||
import com.sqx.modules.orders.entity.Orders;
|
||||
import com.sqx.modules.orders.service.OrdersService;
|
||||
import com.sqx.modules.pay.dao.PayDetailsDao;
|
||||
import com.sqx.modules.pay.entity.PayDetails;
|
||||
|
|
@ -28,6 +32,7 @@ import org.springframework.context.ApplicationContext;
|
|||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -74,8 +79,8 @@ public class Tets {
|
|||
Set<Long> useridList = userMoneyDetails.stream().map(UserMoneyDetails::getUserId).collect(Collectors.toSet());
|
||||
List<UserMoney> userMoneyDetailsList = userMoneyDao.selectList(new LambdaQueryWrapper<UserMoney>().in(UserMoney::getUserId, useridList));
|
||||
userMoneyDetailsList.parallelStream().forEach(userMoney -> {
|
||||
BigDecimal coin = userMoneyDao.sumMoney(userMoney.getUserId());
|
||||
BigDecimal money = userMoneyDao.sumMoney2(userMoney.getUserId());
|
||||
BigDecimal coin = userMoneyDao.sumMoney(userMoney.getUserId());
|
||||
BigDecimal money = userMoneyDao.sumMoney2(userMoney.getUserId());
|
||||
log.info("用户: {}, 金币: {}, 金额: {}", userMoney.getUserId(), coin, money);
|
||||
userMoney.setInviteIncomeCoin(coin);
|
||||
userMoney.setInviteIncomeMoney(money);
|
||||
|
|
@ -131,7 +136,8 @@ public class Tets {
|
|||
}));
|
||||
|
||||
}
|
||||
@Test
|
||||
|
||||
//@Test
|
||||
public void test() {
|
||||
// }
|
||||
// WuyouController proxy = applicationContext.getBean(WuyouController.class);
|
||||
|
|
@ -166,7 +172,59 @@ public class Tets {
|
|||
assert false : "asdasfqwerq3rqwr";
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void test999() {
|
||||
int total = ordersService.count(Wrappers.<Orders>lambdaQuery().apply("sys_user_id is null"));
|
||||
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + total);
|
||||
LambdaQueryWrapper<Orders> wrapper = Wrappers.<Orders>lambdaQuery().apply("sys_user_id is null").last("limit 1");
|
||||
List<Integer> list = new ArrayList<>();
|
||||
for (int i = 0; i < 5000; i++) {
|
||||
list.add(i);
|
||||
}
|
||||
list.parallelStream().forEach(param -> {
|
||||
while (true) {
|
||||
Orders orders = ordersService.getOne(wrapper);
|
||||
if (orders == null) {
|
||||
break;
|
||||
}
|
||||
ordersService.fillSysUserId(orders);
|
||||
//System.out.println(StrUtil.format("-------------------------------sysUserId:{} ", orders.getSysUserId()));
|
||||
ordersService.update(null, Wrappers.<Orders>lambdaUpdate().set(Orders::getSysUserId, orders.getSysUserId()).eq(Orders::getOrdersId, orders.getOrdersId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test888() {
|
||||
LambdaQueryWrapper<UserEntity> wrapper = Wrappers.<UserEntity>lambdaQuery().apply("create_time >= str_to_date({0}, '%Y-%m-%d %H:%i:%s')", "2025-01-01 00:00:00");
|
||||
List<UserEntity> userinfoList = userService.list(wrapper);
|
||||
userinfoList.parallelStream().forEach((userEntity -> {
|
||||
List<Orders> list = ordersService.list(Wrappers.<Orders>lambdaQuery().eq(Orders::getUserId, userEntity.getUserId()).isNull(Orders::getSysUserId));
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<List<Orders>> split = CollUtil.split(list, 500);
|
||||
for (List<Orders> splitList : split) {
|
||||
splitList.parallelStream().forEach(orders -> {
|
||||
ordersService.fillSysUserId(orders);
|
||||
System.out.println(StrUtil.format("-------------------------------sysUserId:{},sysUserName:{} ", orders.getSysUserId(), orders.getUserName()));
|
||||
ordersService.update(null, Wrappers.<Orders>lambdaUpdate().set(Orders::getSysUserId, orders.getSysUserId()).eq(Orders::getOrdersId, orders.getOrdersId()));
|
||||
});
|
||||
}
|
||||
}
|
||||
}));
|
||||
System.out.println("-------------------------------结束------------------------------------");
|
||||
}
|
||||
|
||||
private List<Dict> buildPageList(int total) {
|
||||
int size = 300;
|
||||
int totalPage = PageUtil.totalPage(total, size);
|
||||
List<Dict> pageList = new ArrayList<>();
|
||||
for (int page = 1; page <= totalPage; page++) {
|
||||
Dict dict = new Dict();
|
||||
dict.set("page", (page - 1) * size);
|
||||
dict.set("size", size);
|
||||
pageList.add(dict);
|
||||
}
|
||||
return pageList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue