|
@@ -71,14 +71,19 @@ def thread_function(kw):
|
|
|
|
|
|
@app.get("/tree_list/",response_class=HTMLResponse)
|
|
|
async def tree_list():
|
|
|
- global db
|
|
|
+# global db
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/gtrends?charset=utf8mb4')
|
|
|
html="<html><body><h2>清單</h2></br>請一分鐘後refresh </br></br>"
|
|
|
html+="<table border='1'>"
|
|
|
- cursor=db.query('select filename,kw from gen_graph order by id desc limit 10')
|
|
|
+ cursor=db.query('select filename,kw from gen_graph order by id desc')
|
|
|
+ cnt=0
|
|
|
for c in cursor:
|
|
|
html+="<tr><td>"+c['kw']+"</td>"
|
|
|
html+="<td><a href='/web/gs/"+c['filename']+".html'>"+c['filename']+"</a></td></tr>"
|
|
|
-
|
|
|
+ cnt+=1
|
|
|
+ if cnt > 10:
|
|
|
+ break
|
|
|
+
|
|
|
html+="</table></body></html>"
|
|
|
return html
|
|
|
|