From 62c21c1f1fba20f6fead4ec61510d9115ad2d1ca Mon Sep 17 00:00:00 2001 From: root Date: Wed, 3 Jul 2024 13:38:54 +0800 Subject: [PATCH] =?UTF-8?q?add=20workflow=20=E5=A4=A9=E6=B6=A6Smart-ccc?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E6=95=B0=E6=8D=AE,dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../查询会话记录列表/chat_records_feign.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dev/workflow/TK_Cust/smart_ccc_chat/查询会话记录列表/chat_records_feign.py b/dev/workflow/TK_Cust/smart_ccc_chat/查询会话记录列表/chat_records_feign.py index 5705556..e55af1d 100644 --- a/dev/workflow/TK_Cust/smart_ccc_chat/查询会话记录列表/chat_records_feign.py +++ b/dev/workflow/TK_Cust/smart_ccc_chat/查询会话记录列表/chat_records_feign.py @@ -25,7 +25,14 @@ nonce = str(uuid.uuid4()) current_time_utc =( datetime.datetime.now() - datetime.timedelta(hours=8)).strftime("%Y-%m-%dT%H:%M:%SZ") formatted2_current_date = current_date.strftime("%Y-%m-%d %H:%M:%S") # 获取当前日期 - 标准化 -formatted2_previous_date = previous_date.strftime("%Y-%m-%d %H:%M:%S") # 获取前一天日期 - 标准化 + +def formatted2_previous_date(d): + if h==0: + return datetime.date.today().strftime("%Y%m%d") + # 减去一个小时,得到前一个小时的开始时间 + start_of_previous_date = datetime.date.today() - datetime.timedelta(days=d) + return start_of_previous_date.strftime("%Y%m%d") + def formatted2_previous_hour(h): if h==0: @@ -64,7 +71,7 @@ def build_query_string(params): def request_data_signature_get(): print(f'开始请求会话记录数据') url='https://api-bj.clink.cn/livechat/copy_chat_records' - param={'Timestamp':current_time_utc,'Expires':86400,'date':formatted2_previous_date,'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177',} + param={'Timestamp':current_time_utc,'Expires':86400,'date':formatted2_previous_date(0),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177'} print(f'param: {param}') url_path = build_query_string(param) url_param = url_path