From f0074bca42f9e6f1d3c4b7f37524d22e41e03007 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Thu, 4 Dec 2025 10:20:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=9A=84=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E4=BB=A3=E7=A0=81=20/api/market/statistics=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E6=B7=BB=E5=8A=A0=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E9=80=BB=E8=BE=91=20//api/concepts/?= =?UTF-8?q?daily-top=20=E6=B7=BB=E5=8A=A0=E6=97=A5=E6=9C=9F=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E9=80=BB=E8=BE=91=20/api/market/heatmap=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E5=B7=B2=E7=BB=8F=E6=9C=89=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E7=9A=84=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index fc1b8735..b2e2591b 100755 --- a/app.py +++ b/app.py @@ -12232,12 +12232,19 @@ def get_market_statistics(): available_dates = [str(row.TRADEDATE) for row in available_dates_result] + # 格式化日期为 YYYY-MM-DD + formatted_trade_date = trade_date.strftime('%Y-%m-%d') if hasattr(trade_date, 'strftime') else str(trade_date).split(' ')[0][:10] + formatted_available_dates = [ + d.strftime('%Y-%m-%d') if hasattr(d, 'strftime') else str(d).split(' ')[0][:10] + for d in [row.TRADEDATE for row in available_dates_result] + ] + return jsonify({ 'success': True, - 'trade_date': str(trade_date), + 'trade_date': formatted_trade_date, 'summary': summary, 'details': list(statistics.values()), - 'available_dates': available_dates + 'available_dates': formatted_available_dates }) except Exception as e: @@ -12286,10 +12293,14 @@ def get_daily_top_concepts(): 'stocks': concept.get('stocks', [])[:5] # 只返回前5只股票 }) + # 格式化日期为 YYYY-MM-DD + price_date = data.get('price_date', '') + formatted_date = str(price_date).split(' ')[0][:10] if price_date else '' + return jsonify({ 'success': True, 'data': top_concepts, - 'trade_date': data.get('price_date'), + 'trade_date': formatted_date, 'count': len(top_concepts) }) else: