fix: add subgroup/special group support to key renewals and cluster sync

This commit is contained in:
Capybara-z
2025-10-22 02:07:18 +03:00
parent 5e230e4286
commit a7c4e06102
5 changed files with 33 additions and 4 deletions
+6 -1
View File
@@ -1223,14 +1223,17 @@ async def change_expiry_time(expiry_time: int, email: str, session: AsyncSession
traffic_limit = 0
device_limit = None
key_subgroup = None
if tariff_id:
result = await session.execute(
select(Tariff.traffic_limit, Tariff.device_limit).where(Tariff.id == tariff_id, Tariff.is_active.is_(True))
select(Tariff.traffic_limit, Tariff.device_limit, Tariff.subgroup_title).where(Tariff.id == tariff_id, Tariff.is_active.is_(True))
)
tariff = result.first()
if tariff:
traffic_limit = int(tariff[0]) if tariff[0] is not None else 0
device_limit = int(tariff[1]) if tariff[1] is not None else 0
key_subgroup = tariff[2]
servers = await get_servers(session=session)
@@ -1255,6 +1258,8 @@ async def change_expiry_time(expiry_time: int, email: str, session: AsyncSession
session=session,
hwid_device_limit=device_limit,
reset_traffic=False,
target_subgroup=key_subgroup,
old_subgroup=key_subgroup,
)
await update_key_expiry(session, client_id, expiry_time)