|
@@ -1,64 +0,0 @@
|
|
-from concurrent.futures import ThreadPoolExecutor
|
|
|
|
-import requests
|
|
|
|
-import datetime
|
|
|
|
-import json
|
|
|
|
-import pandas as pd
|
|
|
|
-from sqlalchemy import create_engine
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-db_con_str = "mysql+pymysql://%s:%s@%s:%d/%s" % ("data", "hcst@2021", "139.186.27.96", 4000, "jeecg-boot")
|
|
|
|
-engine = create_engine(db_con_str, connect_args={'charset': 'utf8'})
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-def send_request(account_id):
|
|
|
|
- url = 'http://192.168.1.193:31012/ai_high_quality_material'
|
|
|
|
- # url = 'http://139.186.27.96:31012/ai_high_quality_material'
|
|
|
|
- request_data = json.dumps({"account_id": account_id})
|
|
|
|
- request = requests.post(url, request_data)
|
|
|
|
- return json.loads(request.text)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-# 0、 打印该定时任务被调用的时间
|
|
|
|
-print("*************************", datetime.datetime.now(), "*************************")
|
|
|
|
-
|
|
|
|
-# 1、获取已有的账号
|
|
|
|
-sql = """
|
|
|
|
-select account_id from ctop_ai_kuaishou_advertiser_strategy where status = 1
|
|
|
|
-"""
|
|
|
|
-acc_df = pd.read_sql(sql, engine)
|
|
|
|
-acc_list = [int(account_id) for account_id in acc_df['account_id'].unique()]
|
|
|
|
-print(acc_list)
|
|
|
|
-# 手淘账号: 9792538 登陆账号: 16525664317 密码:a123456
|
|
|
|
-# 233账号: 9864909 登陆账号: jy20201254@163.com 密码:jysz12345
|
|
|
|
-# 消消消账号: 6020747 登陆账号: 15715158532 密码:xxx@112233
|
|
|
|
-# 斗地主账号:8067888 登陆账号: 13699377642 密码:yg@12345
|
|
|
|
-# acc_list = [9724424, 9882729]
|
|
|
|
-# acc_list = [9724424, 9882729]
|
|
|
|
-# acc_list = [9881436, 8026440]
|
|
|
|
-acc_list = [8026440]
|
|
|
|
-print(acc_list)
|
|
|
|
-
|
|
|
|
-# 2、 5个账户一组进行发送请求
|
|
|
|
-batch_num = 5
|
|
|
|
-for i in range(0, len(acc_list), batch_num):
|
|
|
|
- if i + batch_num < len(acc_list):
|
|
|
|
- print(tuple(acc_list[i:i + batch_num]))
|
|
|
|
- with ThreadPoolExecutor(max_workers=batch_num) as pool:
|
|
|
|
- results = pool.map(send_request, tuple(acc_list[i: i+batch_num]))
|
|
|
|
- for r in results:
|
|
|
|
- print('res = %s' % r)
|
|
|
|
- else:
|
|
|
|
- with ThreadPoolExecutor(max_workers=batch_num) as pool:
|
|
|
|
- print(acc_list[i: len(acc_list)])
|
|
|
|
- results = pool.map(send_request, tuple(acc_list[i: len(acc_list)]))
|
|
|
|
- for r in results:
|
|
|
|
- print('res = %s' % r)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|