Merge branch 'dev' of https://github.com/Vladless/Solo_src into dev # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.

This commit is contained in:
Capybara-z
2026-04-17 11:14:00 +00:00
parent 4cb84ceacc
commit 0821b69879
3 changed files with 4 additions and 7 deletions
Executable → Regular
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -6
View File
@@ -6,8 +6,6 @@ from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
from typing import TYPE_CHECKING
from pytz import timezone
from database import (
add_referral,
get_balance,
@@ -98,7 +96,7 @@ async def redeem_gift(
if wu is None:
raise NotFoundError("Пользователь не найден")
if gift_info.expiry_time and gift_info.expiry_time < datetime.now(timezone.utc):
if gift_info.expiry_time and gift_info.expiry_time < datetime.utcnow():
raise ValidationError("Срок действия подарка истёк")
if gift_info.sender_user_id == wu.id:
@@ -131,9 +129,8 @@ async def redeem_gift(
from services.keys import create_vpn_key_headless
now_moscow = datetime.now(timezone("Europe/Moscow")).replace(tzinfo=None)
duration_days = int(tariff["duration_days"] or 0)
expiry_time = now_moscow + timedelta(days=duration_days)
expiry_time = datetime.now(timezone.utc) + timedelta(days=duration_days)
selected_device_limit = getattr(gift_info, "selected_device_limit", None)
selected_traffic_gb = getattr(gift_info, "selected_traffic_gb", None)
@@ -209,7 +206,7 @@ async def create_gift(
await update_balance(session, sender_user_ref, -price_to_charge)
duration_days = int(tariff["duration_days"] or 0)
expiry_time = datetime.now(timezone.utc) + timedelta(days=duration_days)
expiry_time = datetime.utcnow() + timedelta(days=duration_days)
gift_id = uuid.uuid4().hex
gift_link = get_gift_link(sender_user_ref, gift_id)
site_gift_link = get_site_gift_link(gift_id)