|
@@ -100,9 +100,22 @@ def get_qq_list():
|
|
|
a = mysql_select(sql)
|
|
|
return a
|
|
|
|
|
|
+def get_vx_list_new():
|
|
|
+ sql="select account_id,wechat_account_id,access_token,refresh_token,name," \
|
|
|
+ "ifnull(stage,''),ifnull(pitcher,''),ifnull(platform,''),ifnull(book,'') from advertiser_vx " \
|
|
|
+ " where create_time>='{}'".format(date_util.get_n_day(-1))
|
|
|
+ a= mysql_select(sql)
|
|
|
+ return a
|
|
|
+
|
|
|
+def get_qq_list_new():
|
|
|
+ sql = "select account_id,'',access_token,refresh_token,name," \
|
|
|
+ "ifnull(stage,''),ifnull(pitcher,''),ifnull(platform,''),ifnull(book,'') from advertiser_qq " \
|
|
|
+ " where create_time>='{}'".format(date_util.get_n_day(-1))
|
|
|
+ a = mysql_select(sql)
|
|
|
+ return a
|
|
|
|
|
|
def get_daily_vx():
|
|
|
- token_list_v =get_vx_list()
|
|
|
+ token_list_v =get_vx_list_new() if run_new else get_vx_list()
|
|
|
print("获取vx账号:",token_list_v.__len__())
|
|
|
|
|
|
time1 = time.time()
|
|
@@ -117,7 +130,7 @@ def get_daily_vx():
|
|
|
return li
|
|
|
|
|
|
def get_daily_qq():
|
|
|
- token_list_q = get_qq_list()
|
|
|
+ token_list_q = get_qq_list_new() if run_new else get_qq_list()
|
|
|
print("获取qq账号:",token_list_q.__len__())
|
|
|
time1 = time.time()
|
|
|
li=[]
|
|
@@ -174,22 +187,36 @@ def start_cost_job():
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
print("start_at ===================="+str(datetime.today())+"===================")
|
|
|
+ run_new=False
|
|
|
max_workers = 5
|
|
|
my_time = datetime.today().strftime('%Y-%m-%d')
|
|
|
|
|
|
if sys.argv.__len__() == 2:
|
|
|
- a = int(sys.argv[1])
|
|
|
- i=1
|
|
|
- while True:
|
|
|
- my_time=(datetime.today()-timedelta(days=i)).strftime('%Y-%m-%d')
|
|
|
- print("run["+my_time+"]data")
|
|
|
+
|
|
|
+ if int(sys.argv[1])==2:
|
|
|
+ my_time=(datetime.today()-timedelta(days=1)).strftime('%Y-%m-%d')
|
|
|
start_cost_job()
|
|
|
- if i==a:
|
|
|
- break
|
|
|
- i+=1
|
|
|
+ if int(sys.argv[1])==3:
|
|
|
+ run_new = True
|
|
|
+ i = 1
|
|
|
+ while True:
|
|
|
+ my_time=(datetime.today()-timedelta(days=i)).strftime('%Y-%m-%d')
|
|
|
+ print("run["+my_time+"]data")
|
|
|
+ start_cost_job()
|
|
|
+ if i == 15:
|
|
|
+ break
|
|
|
+ i+=1
|
|
|
+ else:
|
|
|
+ start_cost_job()
|
|
|
+
|
|
|
+ """调度逻辑
|
|
|
+ 1.每小时跑今天的
|
|
|
+ 2.凌晨跑昨天的
|
|
|
+ 3.昨天新增的账号跑前15天的
|
|
|
+ """
|
|
|
+
|
|
|
|
|
|
|
|
|
- start_cost_job()
|
|
|
|
|
|
|
|
|
|