|
@@ -135,17 +135,7 @@ def get_yuewen_order_task(st, et, account):
|
|
if code != 0:
|
|
if code != 0:
|
|
print('阅文查询充值接口异常:', response_result_json, '参数', params)
|
|
print('阅文查询充值接口异常:', response_result_json, '参数', params)
|
|
break
|
|
break
|
|
- # if code == 10408:
|
|
|
|
- # if fail_count > 0:
|
|
|
|
- # break
|
|
|
|
- #
|
|
|
|
- # sleep_seconds = random.randint(60, 70)
|
|
|
|
- # print('阅文获取订单数据线程休眠【{sleep_seconds}】秒,因为该接口有一分钟的限制'.format(sleep_seconds=sleep_seconds))
|
|
|
|
- # time.sleep(sleep_seconds)
|
|
|
|
- #
|
|
|
|
- # print('重试一次')
|
|
|
|
- # fail_count = fail_count + 1
|
|
|
|
- # get_yuewen_order_task(st, et, account, fail_count)
|
|
|
|
|
|
+
|
|
|
|
|
|
response_data = response_result_json['data']
|
|
response_data = response_result_json['data']
|
|
total_count = response_data['total_count']
|
|
total_count = response_data['total_count']
|
|
@@ -163,15 +153,10 @@ def get_yuewen_order_task(st, et, account):
|
|
dtime = datetime.datetime.strptime(order_time, "%Y-%m-%d %H:%M:%S")
|
|
dtime = datetime.datetime.strptime(order_time, "%Y-%m-%d %H:%M:%S")
|
|
order_time_unix = int(time.mktime(dtime.timetuple()))
|
|
order_time_unix = int(time.mktime(dtime.timetuple()))
|
|
order_id = order_item['order_id']
|
|
order_id = order_item['order_id']
|
|
- if date_util.checkInterval(start_time, end_time, order_time_unix) == False:
|
|
|
|
- print('阅文账号【{key}】,查询时间【{start_time} - {end_time}】,有不符合该时间范围的订单,订单Id【{order_id}】的时间为【{order_time}】'
|
|
|
|
- .format(key=email, start_time=date_util.getSecondsToDatetime(start_time),
|
|
|
|
- end_time=date_util.getSecondsToDatetime(end_time), order_id=order_id,
|
|
|
|
- order_time=order_time))
|
|
|
|
- # continue
|
|
|
|
|
|
+
|
|
|
|
|
|
order = {}
|
|
order = {}
|
|
- order['date'] = ((order_time_unix + 8 * 3600) // 86400) * 86400 - 8 * 3600
|
|
|
|
|
|
+
|
|
order['platform'] = '阅文'
|
|
order['platform'] = '阅文'
|
|
order['channel'] = order_item['app_name']
|
|
order['channel'] = order_item['app_name']
|
|
order['from_novel'] = order_item['book_name']
|
|
order['from_novel'] = order_item['book_name']
|
|
@@ -182,15 +167,14 @@ def get_yuewen_order_task(st, et, account):
|
|
order['amount'] = order_item['amount']
|
|
order['amount'] = order_item['amount']
|
|
order['reg_time'] = order_item['reg_time']
|
|
order['reg_time'] = order_item['reg_time']
|
|
order['order_id'] = order_id
|
|
order['order_id'] = order_id
|
|
|
|
+ # print(order_time)
|
|
|
|
+ order['date'] =int(time.mktime(time.strptime(order_time[:10],'%Y-%m-%d')))
|
|
|
|
|
|
order = sorted(order.items(), key=lambda item: item[0])
|
|
order = sorted(order.items(), key=lambda item: item[0])
|
|
order = dict(order)
|
|
order = dict(order)
|
|
order = tuple(order.values())
|
|
order = tuple(order.values())
|
|
order_list = order_list + ((order),)
|
|
order_list = order_list + ((order),)
|
|
|
|
|
|
- # print('阅文账号【{key}】, 查询时间【{start_time} - {end_time}】,当前页【{page}】,本次查询订单数量【{total_count}】'
|
|
|
|
- # .format(key=email, start_time=date_util.getSecondsToDatetime(start_time),
|
|
|
|
- # end_time=date_util.getSecondsToDatetime(end_time),page=page, total_count=total_count))
|
|
|
|
|
|
|
|
if int(page) >= math.ceil(total_count / int(page_count)):
|
|
if int(page) >= math.ceil(total_count / int(page_count)):
|
|
break
|
|
break
|
|
@@ -199,9 +183,6 @@ def get_yuewen_order_task(st, et, account):
|
|
|
|
|
|
start_time = start_time + 86400 # 天数加1
|
|
start_time = start_time + 86400 # 天数加1
|
|
|
|
|
|
- # sleep_seconds = random.randint(60, 70)
|
|
|
|
- # print('阅文获取订单数据线程休眠【{sleep_seconds}】秒,因为该接口有一分钟的限制'.format(sleep_seconds=sleep_seconds))
|
|
|
|
- # time.sleep(sleep_seconds)
|
|
|
|
|
|
|
|
return order_list
|
|
return order_list
|
|
|
|
|
|
@@ -432,13 +413,11 @@ def get_huasheng_order_task(st, et, account, merchant):
|
|
def get_zhangzhongyun_order(st, et, account_list):
|
|
def get_zhangzhongyun_order(st, et, account_list):
|
|
start_exec_seconds = date_util.getCurrentSecondTime()
|
|
start_exec_seconds = date_util.getCurrentSecondTime()
|
|
total_order_list = ()
|
|
total_order_list = ()
|
|
- #account_list = platform_config_util.get_zhangzhongyun_account_list()
|
|
|
|
|
|
|
|
executor = ProcessPoolExecutor(max_workers=5)
|
|
executor = ProcessPoolExecutor(max_workers=5)
|
|
|
|
|
|
futures = []
|
|
futures = []
|
|
for account in account_list:
|
|
for account in account_list:
|
|
- #url = 'https://openapi.818tu.com/partners/channel/channels/list?'
|
|
|
|
url = 'https://inovel.818tu.com/partners/channel/channels/list?'
|
|
url = 'https://inovel.818tu.com/partners/channel/channels/list?'
|
|
key = account[0]
|
|
key = account[0]
|
|
secert = account[1]
|
|
secert = account[1]
|
|
@@ -469,10 +448,9 @@ def get_zhangzhongyun_order(st, et, account_list):
|
|
|
|
|
|
def get_zhangzhongyun_order_task(st, et, account, channel):
|
|
def get_zhangzhongyun_order_task(st, et, account, channel):
|
|
# 掌中云的时间格式比较特殊,转换下
|
|
# 掌中云的时间格式比较特殊,转换下
|
|
- get_time, limit_time = platform_config_util.get_zhangzhongyun_query_time(st, et)
|
|
|
|
-
|
|
|
|
|
|
+ get_time=datetime.datetime.strptime(date_util.stamp_to_str(st),"%Y-%m-%d %H:%M:%S").strftime("%Y-%m-%dT%H:%M:%S+08:00")
|
|
|
|
+ limit_time=datetime.datetime.strptime(date_util.stamp_to_str(et),"%Y-%m-%d %H:%M:%S").strftime("%Y-%m-%dT%H:%M:%S+08:00")
|
|
order_list = ()
|
|
order_list = ()
|
|
-
|
|
|
|
key = account[0]
|
|
key = account[0]
|
|
secert = account[1]
|
|
secert = account[1]
|
|
stage = account[2]
|
|
stage = account[2]
|
|
@@ -492,8 +470,16 @@ def get_zhangzhongyun_order_task(st, et, account, channel):
|
|
page) + '&per_page=' + per_page + '&status=' + status)
|
|
page) + '&per_page=' + per_page + '&status=' + status)
|
|
params = 'channel_id=' + str(channel_id) + '&' + gte + '&' + lt + '&page=' + str(
|
|
params = 'channel_id=' + str(channel_id) + '&' + gte + '&' + lt + '&page=' + str(
|
|
page) + '&per_page=' + per_page + '&status=' + status + '&key=' + key + '&sign=' + sign
|
|
page) + '&per_page=' + per_page + '&status=' + status + '&key=' + key + '&sign=' + sign
|
|
|
|
+ response_result_json={}
|
|
|
|
+ while True:
|
|
|
|
+ r = requests.get(order_url + params)
|
|
|
|
+ if r.status_code==200:
|
|
|
|
+ response_result_json = r.json()
|
|
|
|
+ break
|
|
|
|
+ else:
|
|
|
|
+ time.sleep(1)
|
|
|
|
+ print("掌中云接口调用sleep 1s...")
|
|
|
|
|
|
- response_result_json = requests.get(order_url + params).json()
|
|
|
|
|
|
|
|
if 'data' not in response_result_json.keys():
|
|
if 'data' not in response_result_json.keys():
|
|
print('掌中云账号【{key}】,查询时间【{start_time} - {end_time}】,渠道【{channel_id}:{channel_name}】本次请求数据异常,响应报文【{result}】'
|
|
print('掌中云账号【{key}】,查询时间【{start_time} - {end_time}】,渠道【{channel_id}:{channel_name}】本次请求数据异常,响应报文【{result}】'
|
|
@@ -530,10 +516,6 @@ def get_zhangzhongyun_order_task(st, et, account, channel):
|
|
|
|
|
|
if int(page) >= math.ceil(total_count / int(per_page)):
|
|
if int(page) >= math.ceil(total_count / int(per_page)):
|
|
break
|
|
break
|
|
-
|
|
|
|
- # print('掌中云账号【{key}】, 渠道【{channel_id}:{channel_name}】当前页【{page}】,本次查询订单数【{total_count}】,即将查询下一页'
|
|
|
|
- # .format(key=key, channel_id=channel_id, channel_name=channel_name, page=page, total_count=total_count))
|
|
|
|
-
|
|
|
|
page = int(page) + 1
|
|
page = int(page) + 1
|
|
|
|
|
|
return order_list
|
|
return order_list
|