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