diff --git a/dev/workflow/TK_Cust/smart_ccc_custom/获取客户资料列表/customer_list_feign.py b/dev/workflow/TK_Cust/smart_ccc_custom/获取客户资料列表/customer_list_feign.py index 2e206ee..36fbd5a 100644 --- a/dev/workflow/TK_Cust/smart_ccc_custom/获取客户资料列表/customer_list_feign.py +++ b/dev/workflow/TK_Cust/smart_ccc_custom/获取客户资料列表/customer_list_feign.py @@ -27,6 +27,8 @@ current_time_utc =( datetime.datetime.now() - datetime.timedelta(hours=8)).strft 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_hour(h): if h==0: return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") @@ -73,12 +75,13 @@ def build_query_string(params): ) for k, v in sorted_params.items()) return query_string +current_end_time = previous_hour_timestamp(0) #计算签名,get请求 def request_list_signature_get(offset,pageSize): print('开始请求数据...') url='https://api-bj.clink.cn/crm/list_customers' - param={'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','Timestamp':current_time_utc,'Expires':86400,'updateStartTime':previous_hour_timestamp(1),'updateEndTime':previous_hour_timestamp(0),'offset':offset,'limit':pageSize} + param={'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','Timestamp':current_time_utc,'Expires':86400,'updateStartTime':previous_hour_timestamp(1),'updateEndTime':current_end_time,'offset':offset,'limit':pageSize} # param={'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','Timestamp':current_time_utc,'Expires':86400,'updateStartTime':1704038400,'updateEndTime':previous_hour_timestamp(0)} print(f'param: {param}') url_path = build_query_string(param) @@ -188,6 +191,8 @@ if __name__ == "__main__": print(f'{formatted2_previous_hour(0)}开始请求客户资料信息') offset = 0 pageSize = 100 + current_end_time = previous_hour_timestamp(0) + resL = request_list_signature_get(offset,pageSize) print(resL) if 'error' in resL: