From 6674d6a396af191e4c4894257c48619a9dd51b1f Mon Sep 17 00:00:00 2001 From: wangxu <1318272526@qq.com> Date: Wed, 20 May 2026 19:21:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=AF=E5=8F=A3=E5=AF=B9?= =?UTF-8?q?=E6=AF=94=E6=8A=A5=E5=91=8Abug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/cross_compare_report.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/cross_compare_report.py b/app/cross_compare_report.py index 73cc0f0..371c5ca 100644 --- a/app/cross_compare_report.py +++ b/app/cross_compare_report.py @@ -45,11 +45,9 @@ def gen_cross_compare_report(params): date_list = check_param(params, 'date_list') # 优化后 if not date_list or len(date_list) < 1: return json.dumps(make_common_res(7, '缺少日期参数,请最少选择一天作为查询日期')) - date_list = list(map(str, date_list)) compare_date_list = check_param(params, 'compare_date_list') # 优化前 if not compare_date_list or len(compare_date_list) < 1: return json.dumps(make_common_res(6, '缺少对比日期参数,请最少选择一天作为对比日期')) - compare_date_list = list(map(str, compare_date_list)) query_type = check_param(params, 'query_type') if not query_type: query_type = 0 @@ -618,11 +616,12 @@ def cancel_collect_report(params): def transition_date_list4screen(date_list): - for i in range(0, len(date_list)): - if len(date_list[i]) == 1: - date_list[i] = [datetime.datetime.strptime(date_list[i][0], '%Y%m%d').strftime('%Y-%m-%d'), datetime.datetime.strptime(date_list[i][0], '%Y%m%d').strftime('%Y-%m-%d')] - elif len(date_list[i]) == 2: - date_list[i] = [datetime.datetime.strptime(date_list[i][0], '%Y%m%d').strftime('%Y-%m-%d'), datetime.datetime.strptime(date_list[i][1], '%Y%m%d').strftime('%Y-%m-%d')] - elif len(date_list[i]) > 2: - date_list[i] = [datetime.datetime.strptime(date_list[i][0], '%Y%m%d').strftime('%Y-%m-%d'), datetime.datetime.strptime(date_list[i][-1], '%Y%m%d').strftime('%Y-%m-%d')] - return date_list \ No newline at end of file + tmp_list = date_list.copy() + for i in range(0, len(tmp_list)): + if len(tmp_list[i]) == 1: + tmp_list[i] = [datetime.strptime(tmp_list[i][0], '%Y%m%d').strftime('%Y-%m-%d'), datetime.strptime(tmp_list[i][0], '%Y%m%d').strftime('%Y-%m-%d')] + elif len(tmp_list[i]) == 2: + tmp_list[i] = [datetime.strptime(tmp_list[i][0], '%Y%m%d').strftime('%Y-%m-%d'), datetime.strptime(tmp_list[i][1], '%Y%m%d').strftime('%Y-%m-%d')] + elif len(tmp_list[i]) > 2: + tmp_list[i] = [datetime.strptime(tmp_list[i][0], '%Y%m%d').strftime('%Y-%m-%d'), datetime.strptime(tmp_list[i][-1], '%Y%m%d').strftime('%Y-%m-%d')] + return tmp_list \ No newline at end of file