From 4edd08cd1a5a2918cb4f6bd49550cf0ae3e85ced Mon Sep 17 00:00:00 2001 From: adevopg Date: Sun, 12 Jul 2026 16:51:03 +0000 Subject: [PATCH] =?UTF-8?q?Mi=20cuenta:=20enlace=20a=20Battlepay=20y=20sal?= =?UTF-8?q?do=20de=20cr=C3=A9ditos=20bnet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - my_account: añade battlepay_credits (leído de battlenet_accounts.battlePayCredits) - bnet.get_battlepay_credits() defensivo (0 si la columna no existe) - partials/my-account.html: muestra 'Créditos Battlepay' y añade botón 'Tienda del cliente' que enlaza a /es/battlepay/ Co-Authored-By: Claude Opus 4.8 (1M context) --- home/bnet.py | 12 ++++++++++++ home/templates/partials/my-account.html | 16 ++++++++++++++++ home/views.py | 5 +++++ 3 files changed, 33 insertions(+) diff --git a/home/bnet.py b/home/bnet.py index c5afba6..069ea4a 100644 --- a/home/bnet.py +++ b/home/bnet.py @@ -202,3 +202,15 @@ def get_next_battlenet_index(cursor, bnet_id): def make_game_account_username(bnet_id, index=1): """Nombre de la cuenta de juego: ``#`` (como TrinityCore).""" return f"{bnet_id}#{index}" + + +def get_battlepay_credits(cursor, bnet_id): + """Créditos Battlepay de la cuenta bnet (0 si la columna no existe).""" + if not bnet_id: + return 0 + try: + cursor.execute("SELECT battlePayCredits FROM battlenet_accounts WHERE id = %s", [bnet_id]) + row = cursor.fetchone() + return row[0] if row and row[0] is not None else 0 + except Exception: + return 0 diff --git a/home/templates/partials/my-account.html b/home/templates/partials/my-account.html index 568eb9d..3dbd920 100644 --- a/home/templates/partials/my-account.html +++ b/home/templates/partials/my-account.html @@ -23,6 +23,7 @@ Nivel 1

PD: {{ dp }}

PV: {{ vp }}

+

Créditos Battlepay: {{ battlepay_credits }}

Token de Seguridad: {% if token_status == "Solicitado" %} @@ -371,6 +372,21 @@ + + + +

+ + + + diff --git a/home/views.py b/home/views.py index c69ea32..79fc9fe 100644 --- a/home/views.py +++ b/home/views.py @@ -713,8 +713,13 @@ def my_account(request): token_status = "Sin solicitar" token_date = None + # Créditos Battlepay de la cuenta Battle.net + with connections['acore_auth'].cursor() as cursor: + battlepay_credits = bnet.get_battlepay_credits(cursor, request.session.get('bnet_id')) + return render(request, 'my-account/my-account.html', { 'is_logged_in': is_logged_in, + 'battlepay_credits': battlepay_credits, 'user_info': { 'username': account_data[1], 'reg_mail': account_data[2],