Mi cuenta: enlace a Battlepay y saldo de créditos bnet

- 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) <noreply@anthropic.com>
This commit is contained in:
2026-07-12 16:51:03 +00:00
parent 0fef9ac35b
commit 4edd08cd1a
3 changed files with 33 additions and 0 deletions
+12
View File
@@ -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: ``<bnetId>#<index>`` (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
+16
View File
@@ -23,6 +23,7 @@
<img src="{{ URL_PRINCIPAL }}/static/nw-themes/nw-ryu/nw-images/nw-ranks/1_Newbie.svg" class="nw-rank" alt="Nivel 1" title="Nivel 1">
<p>PD: <span>{{ dp }}</span></p>
<p>PV: <span>{{ vp }}</span></p>
<p>Créditos Battlepay: <span>{{ battlepay_credits }}</span></p>
<p>Token de Seguridad:
<span>
{% if token_status == "Solicitado" %}
@@ -371,6 +372,21 @@
</a>
</td>
</tr>
<tr>
<td>
<a href="battlepay">
<div class="tool-button">
<div class="acc-icon store-icon"></div>
<div class="tool-button-div">
<span class="first-brown shadow">Tienda del cliente</span>
<br>
<span class="second-brown shadow">Paga tus compras Battlepay pendientes</span>
</div>
</div>
</a>
</td>
<td></td>
</tr>
<tr>
<td>
<a href="store-novawow">
+5
View File
@@ -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],