|
@@ -28,11 +28,14 @@ def getSelfDateStr(times=time.time(),date_format='%Y%m%d'):
|
|
|
|
|
|
|
|
|
def get_wending_account_list():
|
|
|
- """
|
|
|
- des cription: 文鼎账号列表
|
|
|
- return: [['consumerkey', 'secretkey', 'siteid', 'stage', 'account']] ->list
|
|
|
- """
|
|
|
- return platform_config_util.get_account_list('文鼎', 'wending_account_config.csv')
|
|
|
+ sql="select text from order_account_text where platform='文鼎'"
|
|
|
+ con=MySQLConnection()
|
|
|
+ data= con.query(sql)
|
|
|
+ li=[]
|
|
|
+ for i in data:
|
|
|
+ a= i['text'].replace('\n','').split(',')
|
|
|
+ li.append(a)
|
|
|
+ return li
|
|
|
|
|
|
|
|
|
def get_wending_order(st,et,account_list):
|
|
@@ -53,7 +56,6 @@ def get_wending_order(st,et,account_list):
|
|
|
total_order_list = future + total_order_list
|
|
|
|
|
|
print('文鼎订单数量:', len(total_order_list), '执行时长(秒):', date_util.getCurrentSecondTime() - start_exec_seconds)
|
|
|
- print(total_order_list)
|
|
|
return total_order_list
|
|
|
|
|
|
|
|
@@ -145,8 +147,7 @@ def get_wending_json_object(url,params):
|
|
|
def get_wending_order_task(st,et,account):
|
|
|
order_list = ()
|
|
|
url = 'https://bi.reading.163.com/dist-api/rechargeList'
|
|
|
- consumerkey = account[0][1:]
|
|
|
- print(consumerkey)
|
|
|
+ consumerkey = account[0]
|
|
|
secretkey = account[1]
|
|
|
siteid=account[2]
|
|
|
stage = account[3]
|
|
@@ -193,7 +194,6 @@ def get_wending_order_task(st,et,account):
|
|
|
uid_reg_time = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(x['userRegisterTime']//1000)) ## 13位时间戳 》标准时间
|
|
|
y['reg_time']= uid_reg_time ## 用户注册时间
|
|
|
y['order_id']= x['ewTradeId'] ## 订单id
|
|
|
-
|
|
|
y = sorted(y.items(), key=lambda item:item[0])
|
|
|
y = dict(y)
|
|
|
y = tuple(y.values())
|
|
@@ -224,35 +224,15 @@ def batch_save_order(data):
|
|
|
finally:
|
|
|
connect.close()
|
|
|
|
|
|
-def batch_save_order_new(data):
|
|
|
- if data is None or len(data) == 0:
|
|
|
- print('数据为空,不执行数据库操作!')
|
|
|
- else:
|
|
|
- sql = 'INSERT IGNORE INTO quchen_text.ods_order(amount,channel,channel_id,date,from_novel,order_id,order_time,platform,reg_time,stage,user_id) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
|
|
|
- connect = MySQLConnection()
|
|
|
- try:
|
|
|
- num = connect.batch(sql, data)
|
|
|
- # 提交
|
|
|
- connect.commit()
|
|
|
- print('订单数据最终入库【{num}】条'.format(num=num))
|
|
|
- except Exception as e:
|
|
|
- print('订单数据入库失败:', e)
|
|
|
- finally:
|
|
|
- connect.close()
|
|
|
|
|
|
+def start_order_job_wending(st,et):
|
|
|
|
|
|
-def start_order_job():
|
|
|
- st_unix = date_util.get_n_day(n=-1, is_timestamp=1)
|
|
|
- et_unix = date_util.get_n_day(is_timestamp=1)
|
|
|
account_list = get_wending_account_list()
|
|
|
- print(account_list)
|
|
|
- da=get_wending_order(st_unix, et_unix,account_list)
|
|
|
-
|
|
|
+ da=get_wending_order(st, et,account_list)
|
|
|
batch_save_order(da)
|
|
|
- batch_save_order_new(da)
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
- start_order_job()
|
|
|
+ start_order_job_wending()
|
|
|
|