enchance data

This commit is contained in:
2026-04-20 12:24:51 +03:00
parent 5d564de336
commit bb7d7392a8
5 changed files with 129 additions and 30 deletions

View File

@@ -23,7 +23,8 @@ def index():
def get_towns():
conn = get_db()
rows = conn.execute('''
SELECT town_id, town_name, player, world_id, data, updated_at
SELECT town_id, town_name, player, player_id, alliance_id,
world_id, x, y, sea, data, updated_at
FROM town_state
ORDER BY town_name ASC
''').fetchall()
@@ -33,11 +34,16 @@ def get_towns():
for row in rows:
d = json.loads(row['data'])
towns.append({
'town_id': row['town_id'],
'town_name': row['town_name'],
'player': row['player'],
'world_id': row['world_id'],
'updated_at': row['updated_at'],
'town_id': row['town_id'],
'town_name': row['town_name'],
'player': row['player'],
'player_id': row['player_id'],
'alliance_id': row['alliance_id'],
'world_id': row['world_id'],
'x': row['x'],
'y': row['y'],
'sea': row['sea'],
'updated_at': row['updated_at'],
'resources': {
'wood': d.get('wood', 0),
'stone': d.get('stone', 0),
@@ -45,12 +51,17 @@ def get_towns():
'storage': d.get('storage', 0),
'population': d.get('population', 0),
},
'buildings': d.get('buildings', {}),
'units': d.get('units', {}),
'points': d.get('points', 0),
'god': d.get('god', None),
'build_queue': d.get('buildingOrder', []),
'build_data': d.get('buildData', {}),
'buildings': d.get('buildings', {}),
'units': d.get('units', {}),
'points': d.get('points', 0),
'god': d.get('god', None),
'build_queue': d.get('buildingOrder', []),
'build_data': d.get('buildData', {}),
'researches': d.get('researches', {}),
'has_premium': d.get('has_premium', False),
'bonuses': d.get('bonuses', {}),
'wonder_points': d.get('wonder_points', 0),
'total_points': d.get('total_points', 0),
})
return jsonify(towns)