From 72c522b5c90ab5ded9d2f2bdfa02f23ccf889b95 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 24 Jul 2026 15:43:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=A2=E6=88=B7=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E6=8E=92=E8=A1=8C=E6=94=B9sect=5Ftop=5Fmodel?= =?UTF-8?q?s,=E5=B8=81=E7=A7=8D=E8=B4=B9=E7=94=A8=E5=8E=BBjinja2=5Fmacro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/index.ui | 2 +- wwwroot/sect_customer_currency.ui | 33 ++++++++++++++++--------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/wwwroot/index.ui b/wwwroot/index.ui index 6200a62..e73c68a 100644 --- a/wwwroot/index.ui +++ b/wwwroot/index.ui @@ -68,7 +68,7 @@ "options": {"css": "card", "width": "50%", "padding": "16px"}, "subwidgets": [ {"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "我的模型(按金额Top5)", "i18n": true, "marginBottom": "8px"}}, - {"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_user_apikeys.ui')}}", "width": "100%"}} + {"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_top_models.ui')}}", "width": "100%"}} ] }, { diff --git a/wwwroot/sect_customer_currency.ui b/wwwroot/sect_customer_currency.ui index 3d4a8da..2b77205 100644 --- a/wwwroot/sect_customer_currency.ui +++ b/wwwroot/sect_customer_currency.ui @@ -2,37 +2,38 @@ {% set month_data = j2_customer_currency(request, 'month') %} {% set year_data = j2_customer_currency(request, 'year') %} {% set all_data = j2_customer_currency(request, 'all') %} - -{% macro sum_cny(data) %}{% set total = namespace(v=0) %}{% for r in data %}{% set total.v = total.v + r.revenue_cny %}{% endfor %}{{ '%.2f' % total.v }}{% endmacro %} - +{% set today_sum = namespace(v=0) %}{% for r in today_data %}{% set today_sum.v = today_sum.v + r.revenue_cny %}{% endfor %} +{% set month_sum = namespace(v=0) %}{% for r in month_data %}{% set month_sum.v = month_sum.v + r.revenue_cny %}{% endfor %} +{% set year_sum = namespace(v=0) %}{% for r in year_data %}{% set year_sum.v = year_sum.v + r.revenue_cny %}{% endfor %} +{% set all_sum = namespace(v=0) %}{% for r in all_data %}{% set all_sum.v = all_sum.v + r.revenue_cny %}{% endfor %} { "widgettype": "VBox", "options": {"width": "100%"}, "subwidgets": [ - {"widgettype": "HBox", "options": {"width": "100%", "gap": "10px", "marginBottom": "12px"}, + {"widgettype": "HBox", "options": {"width": "100%", "gap": "10px"}, "subwidgets": [ - {"widgettype": "VBox", "options": {"css": "card", "padding": "10px", "borderRadius": "6px", "width": "25%"}, + {"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"}, "subwidgets": [ - {"widgettype": "Text", "options": {"otext": "今天", "i18n": true, "fontWeight": "600", "fontSize": "12px"}}, - {"widgettype": "Text", "options": {"text": {{json.dumps('¥' + sum_cny(today_data), ensure_ascii=False)}},"fontWeight": "700", "fontSize": "16px", "marginTop": "4px"}} + {"widgettype": "Text", "options": {"otext": "今天", "i18n": true, "fontWeight": "600", "fontSize": "11px"}}, + {"widgettype": "Text", "options": {"text": {{json.dumps('¥' + ('%.2f' % today_sum.v), ensure_ascii=False)}}, "fontWeight": "700", "fontSize": "14px", "marginTop": "2px"}} ] }, - {"widgettype": "VBox", "options": {"css": "card", "padding": "10px", "borderRadius": "6px", "width": "25%"}, + {"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"}, "subwidgets": [ - {"widgettype": "Text", "options": {"otext": "本月", "i18n": true, "fontWeight": "600", "fontSize": "12px"}}, - {"widgettype": "Text", "options": {"text": {{json.dumps('¥' + sum_cny(month_data), ensure_ascii=False)}},"fontWeight": "700", "fontSize": "16px", "marginTop": "4px"}} + {"widgettype": "Text", "options": {"otext": "本月", "i18n": true, "fontWeight": "600", "fontSize": "11px"}}, + {"widgettype": "Text", "options": {"text": {{json.dumps('¥' + ('%.2f' % month_sum.v), ensure_ascii=False)}}, "fontWeight": "700", "fontSize": "14px", "marginTop": "2px"}} ] }, - {"widgettype": "VBox", "options": {"css": "card", "padding": "10px", "borderRadius": "6px", "width": "25%"}, + {"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"}, "subwidgets": [ - {"widgettype": "Text", "options": {"otext": "本年", "i18n": true, "fontWeight": "600", "fontSize": "12px"}}, - {"widgettype": "Text", "options": {"text": {{json.dumps('¥' + sum_cny(year_data), ensure_ascii=False)}},"fontWeight": "700", "fontSize": "16px", "marginTop": "4px"}} + {"widgettype": "Text", "options": {"otext": "本年", "i18n": true, "fontWeight": "600", "fontSize": "11px"}}, + {"widgettype": "Text", "options": {"text": {{json.dumps('¥' + ('%.2f' % year_sum.v), ensure_ascii=False)}}, "fontWeight": "700", "fontSize": "14px", "marginTop": "2px"}} ] }, - {"widgettype": "VBox", "options": {"css": "card", "padding": "10px", "borderRadius": "6px", "width": "25%"}, + {"widgettype": "VBox", "options": {"css": "card", "padding": "8px", "borderRadius": "6px", "width": "25%"}, "subwidgets": [ - {"widgettype": "Text", "options": {"otext": "累计", "i18n": true, "fontWeight": "600", "fontSize": "12px"}}, - {"widgettype": "Text", "options": {"text": {{json.dumps('¥' + sum_cny(all_data), ensure_ascii=False)}},"fontWeight": "700", "fontSize": "16px", "marginTop": "4px"}} + {"widgettype": "Text", "options": {"otext": "累计", "i18n": true, "fontWeight": "600", "fontSize": "11px"}}, + {"widgettype": "Text", "options": {"text": {{json.dumps('¥' + ('%.2f' % all_sum.v), ensure_ascii=False)}}, "fontWeight": "700", "fontSize": "14px", "marginTop": "2px"}} ] } ]