aaron-1015 пре 3 година
родитељ
комит
03d1402e38
2 измењених фајлова са 39 додато и 19 уклоњено
  1. BIN
      api/__pycache__/main.cpython-37.pyc
  2. 39 19
      api/main.py

BIN
api/__pycache__/main.cpython-37.pyc


+ 39 - 19
api/main.py

@@ -82,25 +82,45 @@ async def add_contact_us_client_info(req: ContactUs):
     table = db['ContactUs']
     time_stamp = datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d %H:%M:%S")
 
-    statement = 'SELECT COUNT(1) FROM ContactUs WHERE email = "'+ req.email +'"'
-    if first(db.query(statement))['COUNT(1)'] == 0:
-        table.insert(
-            {
-                'country_code':req.country_code,
-                'username': req.username,
-                'email': req.email,
-                'phone': req.phone,
-                'coop_dif': req.coop_dif,
-                'coop_ad': req.coop_ad,
-                'coop_acting': req.coop_acting,
-                'coop_marketing': req.coop_marketing,
-                'work_address': req.work_address,
-                'timestamp': time_stamp
-            }
-        )
-        code = 0
-        # 更新sheet
-        make_contact_us_df()
+    # 會根據email做判斷,此處先comment給測試使用。
+    # statement = 'SELECT COUNT(1) FROM ContactUs WHERE email = "'+ req.email +'"'
+    # if first(db.query(statement))['COUNT(1)'] == 0:
+    #     table.insert(
+    #         {
+    #             'country_code':req.country_code,
+    #             'username': req.username,
+    #             'email': req.email,
+    #             'phone': req.phone,
+    #             'coop_dif': req.coop_dif,
+    #             'coop_ad': req.coop_ad,
+    #             'coop_acting': req.coop_acting,
+    #             'coop_marketing': req.coop_marketing,
+    #             'work_address': req.work_address,
+    #             'timestamp': time_stamp
+    #         }
+    #     )
+    #     code = 0
+    #     # 更新sheet
+    #     make_contact_us_df()
+
+    table.insert(
+        {
+            'country_code':req.country_code,
+            'username': req.username,
+            'email': req.email,
+            'phone': req.phone,
+            'coop_dif': req.coop_dif,
+            'coop_ad': req.coop_ad,
+            'coop_acting': req.coop_acting,
+            'coop_marketing': req.coop_marketing,
+            'work_address': req.work_address,
+            'timestamp': time_stamp
+        }
+    )
+    code = 0
+    # 更新sheet
+    make_contact_us_df()
+
     return {'msg':code}#0 means succss added, 1 means email is duplicated