Your Name 3 jaren geleden
bovenliggende
commit
35385f4088
1 gewijzigde bestanden met toevoegingen van 14 en 0 verwijderingen
  1. 14 0
      step_question/apis/main.py

+ 14 - 0
step_question/apis/main.py

@@ -122,6 +122,7 @@ async def submit(request: Request):
     form_data = await request.form()
 #    form_data = request.form()
     email=form_data.get('q3')
+    phone=form_data.get('q2')
     result = {
         'sex': form_data.get('q1'),
         'phone': form_data.get('q2'),
@@ -134,6 +135,7 @@ async def submit(request: Request):
         'src':'SMS'
     }
     print(result)
+
     get_db().insert(result)
 #    mail_to_user(email)
     x = threading.Thread(target=hhh_send_mail, args=(email,))
@@ -149,6 +151,7 @@ async def line_submit(request: Request):
     print(form_data)
 #    form_data = request.form()
     email=form_data.get('q3')
+    phone=form_data.get('q2')
     result = {
         'sex': form_data.get('q1'),
         'phone': form_data.get('q2'),
@@ -166,7 +169,18 @@ async def line_submit(request: Request):
     if result['userid']==None:
         result['userid']="None"
     print(result)
+
+    cursor=get_db().query('select * from step_questions where phone="'+phone+'" or email="'+email+'" ')
+    cnt=0
+    for q in cursor:
+        cnt+=1
+    if cnt > 0:
+        return RedirectResponse(url="/a1/warn.html", status_code=HTTP_302_FOUND)
+
+
     get_db().insert(result)
+
+
 #    mail_to_user(email)
     x = threading.Thread(target=hhh_send_mail, args=(email,True,result['userid']))
     x.start()