Add referral system and user balance tracking
Introduce balance field to User model with Alembic migration. Add referral menu, admin /refpay command, and deep link sharing. Update Dockerfile to multi-stage build and add Postgres service to compose. Fix deep link parsing logic and conditional proxy initialization.
This commit is contained in:
@@ -12,7 +12,7 @@ from texts import GENERAL_PROCESSING, build_main_menu_text, FAQ_TEXT
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.message(CommandStart(deep_link=True, deep_link_encoded=False))
|
||||
@router.message(CommandStart(deep_link=True, deep_link_encoded=True))
|
||||
async def fetch_referal(
|
||||
msg: Message,
|
||||
command: CommandObject,
|
||||
@@ -22,12 +22,12 @@ async def fetch_referal(
|
||||
):
|
||||
await state.clear()
|
||||
|
||||
data = command.args.split()
|
||||
data = command.args.split("_")
|
||||
if not data:
|
||||
await standard_start(msg, command, state)
|
||||
return
|
||||
|
||||
referal = data[0]
|
||||
referal = int(data[1])
|
||||
user = await deps.user_service.add_user(
|
||||
session, user_id=msg.from_user.id, referal=referal, rw_sdk=deps.rw_sdk
|
||||
)
|
||||
@@ -41,7 +41,6 @@ async def fetch_referal(
|
||||
@router.message(Command(commands=["start", "cancel"]))
|
||||
async def standard_start(
|
||||
msg: Message,
|
||||
command: CommandObject,
|
||||
state: FSMContext,
|
||||
session: AsyncSession,
|
||||
deps: DependenciesDTO,
|
||||
|
||||
Reference in New Issue
Block a user