ck 4 лет назад
Родитель
Сommit
f663da1741
1 измененных файлов с 9 добавлено и 5 удалено
  1. 9 5
      dgp/tests/get_campaign_daily.py

+ 9 - 5
dgp/tests/get_campaign_daily.py

@@ -546,8 +546,10 @@ def get_daily_qq_campaign(st,et):
 def get_campaign_update_list():
     db = pymysql.connect('rm-bp1c9cj79872tx3aaro.mysql.rds.aliyuncs.com','superc','Cc719199895','quchen_text')
     cursor = db.cursor()
-    sql = 'select distinct advertiser_vx.account_id,access_token from campaign_vx left join advertiser_vx on advertiser_vx.account_id = campaign_vx.account_id where created_time>=%s or last_modified_time>=%s'
+    sql = 'select distinct advertiser_vx.account_id,access_token,campaign_id from campaign_vx left join advertiser_vx on advertiser_vx.account_id = campaign_vx.account_id where created_time>=%s or last_modified_time>=%s'
     data = (int((time.time()+8*3600)//86400*86400-8*3600-86400),int((time.time()+8*3600)//86400*86400-8*3600-86400))
+
+
     try:
         cursor.execute(sql,data)
         db.commit()
@@ -559,12 +561,13 @@ def get_campaign_update_list():
     a = []
     if len(x)>0:
         for t in x:
-            a.append(t[0])
-    sql2 = 'delete from adcreative where campaign_id=%s'
+            a.append(int(t[2]))
+
+    sql2 = 'delete from adcreative where campaign_id in {}'.format(str(tuple(a)))
     try:
         cursor.executemany(sql2,a)
         db.commit()
-        y=cursor.fetchall()
+        cursor.fetchall()
 
     except:
         db.rollback()
@@ -672,7 +675,7 @@ def get_image_imformation():
 def start_all_job():
     start_time = date_util.get_n_day(n=-1,is_timestamp=1)
     end_time = date_util.get_n_day(n=-1,is_timestamp=1)
-
+    #
     print("run[{0}] data".format(date_util.stamp_to_str(start_time)[:10]))
     print("线程数:",max_workers)
     print("开始获取计划日报----------")
@@ -681,6 +684,7 @@ def start_all_job():
     print("开始获取广告创意信息--------------")
     get_adcreative_vx()
 
+
     print("开始获取图片信息 ")
     get_image_imformation()