Jared 3 éve
szülő
commit
b72b7fedcc
1 módosított fájl, 12 hozzáadás és 2 törlés
  1. 12 2
      hhh/reports/content_gap_ranking.py

+ 12 - 2
hhh/reports/content_gap_ranking.py

@@ -33,7 +33,17 @@ def save_sheet(df,filename,tabname,startpos='A1'):
 def do_jobs():
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')
 #    cursor=db.query('SELECT distinct kw,if(ranking IS NULL ,"未上榜",ranking ) as r   FROM hhh.hhh_contentgap_serp where id >=155 order by r asc;')
-    cursor=db.query('SELECT distinct kw,if(ranking IS NULL ,"未上榜",ranking ) as r   FROM hhh.hhh_contentgap_serp where id >=394 order by r asc;')
+#    cursor=db.query('SELECT distinct kw,if(ranking IS NULL ,"未上榜",ranking ) as r   FROM hhh.hhh_contentgap_serp where id >=394 order by r asc;')
+#    cursor=db.query('SELECT distinct kw,if(ranking IS NULL ,"未上榜",ranking ) as r   FROM hhh.hhh_contentgap_serp where id >=444 order by r asc;')
+#    cursor=db.query('SELECT distinct kw,if(ranking IS NULL ,101,ranking ) as r   FROM hhh.hhh_contentgap_serp where id >=494 order by r asc;')
+#    cursor=db.query('SELECT distinct kw,if(ranking IS NULL ,101,ranking ) as r   FROM hhh.hhh_contentgap_serp where id >=544 order by r asc;')
+#    cursor=db.query('SELECT distinct kw,if(ranking IS NULL ,101,ranking ) as r   FROM hhh.hhh_contentgap_serp where id >=719 order by r asc;')
+
+    cursor=db.query('SELECT distinct kw, if( min(ranking) IS NULL ,101,min(ranking) )   as r FROM hhh.hhh_contentgap_serp where datediff(now(),dt) =0  group by kw order by id desc;')
+
+#SELECT * FROM hhh.hhh_contentgap_serp where id >=444 order by ranking desc;
+
+
 
     df = pd.DataFrame(columns=('kw','r'))
 
@@ -42,7 +52,7 @@ def do_jobs():
     for c in cursor:
         df.loc[idx]=[c['kw'],c['r']]
         idx+=1
-    save_sheet(df,'ContentGap_Ranking','ranking_20211105')
+    save_sheet(df,'ContentGap_Ranking','ranking_20220311')
 
 t = threading.Thread(target = do_jobs)
 t.start()