refactor(ff-admin): 调整 Redis 数据库索引并优化 GameBettingDetailsMapper
-将 Redis 数据库索引从1 改为 2 - 在 GameBettingDetailsMapper 中添加 tenant_key 字段 - 更新 TenantGameQuotaServiceImpl 中的错误提示信息 - 移除 TenantUtils 中的 getTenantId 方法main-p
parent
dbfa47d548
commit
a186f91080
|
@ -122,7 +122,7 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
|||
public Boolean balanceChanges(BalanceChangesDTO balanceChangesDTO) {
|
||||
TenantGameQuota tenantGameQuota = tenantGameQuotaMapper.selectTenantGameQuotaByTenantKey(balanceChangesDTO.getTenantKey(), TenantQuotaType.BALANCE.getCode());
|
||||
|
||||
Assert.isTrue(!ObjectUtils.isEmpty(tenantGameQuota), "余额额度不足");
|
||||
Assert.isTrue(!ObjectUtils.isEmpty(tenantGameQuota), "租户余额额度不足");
|
||||
|
||||
BigDecimal balanceBefore = tenantGameQuota.getBalance();
|
||||
BigDecimal balance = balanceChangesDTO.getBalance();
|
||||
|
|
|
@ -7,7 +7,7 @@ spring:
|
|||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 1
|
||||
database: 2
|
||||
# 密码
|
||||
password:
|
||||
# 连接超时时间
|
||||
|
|
|
@ -192,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="batchInsert" parameterType="list" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ff_game_betting_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
game_id, currency_code, member_id, game_code, game_type, platform_code,
|
||||
tenant_key, game_id, currency_code, member_id, game_code, game_type, platform_code,
|
||||
game_name, game_status, game_status_type, game_currency_code, account,
|
||||
wagers_id, wagers_time, bet_amount, payoff_time, payoff_amount,
|
||||
settlement_time, turnover, order_no, create_by, create_time
|
||||
|
@ -200,6 +200,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{item.tenantKey},
|
||||
#{item.gameId},
|
||||
#{item.currencyCode},
|
||||
#{item.memberId},
|
||||
|
|
|
@ -192,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="batchInsert" parameterType="list" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ff_game_betting_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
game_id, currency_code, member_id, game_code, game_type, platform_code,
|
||||
tenant_key, game_id, currency_code, member_id, game_code, game_type, platform_code,
|
||||
game_name, game_status, game_status_type, game_currency_code, account,
|
||||
wagers_id, wagers_time, bet_amount, payoff_time, payoff_amount,
|
||||
settlement_time, turnover, order_no, create_by, create_time
|
||||
|
@ -200,6 +200,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{item.tenantKey},
|
||||
#{item.gameId},
|
||||
#{item.currencyCode},
|
||||
#{item.memberId},
|
||||
|
|
|
@ -15,29 +15,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
*/
|
||||
public class TenantUtils {
|
||||
|
||||
public static String getTenantId() {
|
||||
// 获取当前请求的 ServletRequestAttributes 对象
|
||||
ServletRequestAttributes attributes =
|
||||
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
|
||||
if (attributes == null) {
|
||||
// 当前线程中无法获取请求上下文,返回默认数据源
|
||||
return Constants.DATA_SOURCE;
|
||||
}
|
||||
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
|
||||
// 从请求头中获取 tenantId
|
||||
String tenantId = request.getHeader(Constants.TENANT_ID);
|
||||
|
||||
// 如果 tenantId 为空或缺失,返回默认数据源
|
||||
if (StringUtils.isEmpty(tenantId)) {
|
||||
return Constants.DATA_SOURCE;
|
||||
}
|
||||
// 返回有效的 tenantId
|
||||
return tenantId;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户id redis
|
||||
|
|
Loading…
Reference in New Issue