Browse Source

amend follow event

cj 3 years ago
parent
commit
65a18763dc
1 changed files with 7 additions and 4 deletions
  1. 7 4
      main.py

+ 7 - 4
main.py

@@ -30,7 +30,7 @@ def handle_follow(event):
 
     # db connect
     conn = mysql.connector.connect(
-        host="127.0.0.1",
+        host="db.ptt.cx",
         port=3306,
         user="choozmo",
         password="pAssw0rd", 
@@ -42,14 +42,17 @@ def handle_follow(event):
     cursor.execute(search_id, (user_id,))
     values = cursor.fetchall()
     value = [user_id]
+    print(values)
+    
     for v in values:
-            print("uaserid found")     
+        print("uaserid found")     
     else:
         cursor.execute(add_id, value)
         conn.commit()
         conn.close()
         print("userid add")
-
+    
+    print("歡迎")
     print(event.source.user_id)
     line_bot_api.reply_message(
         event.reply_token,
@@ -74,4 +77,4 @@ def echo(event):
 
 
 if __name__ == '__main__':
-    uvicorn.run("main:app", host="0.0.0.0", port=8080, reload=True)
+    uvicorn.run("main:app", host="0.0.0.0", port=8228, reload=True)