yf_yzl 2 лет назад
Родитель
Сommit
b6609412fd
1 измененных файлов с 11 добавлено и 6 удалено
  1. 11 6
      apps/apply_weather.py

+ 11 - 6
apps/apply_weather.py

@@ -60,12 +60,17 @@ class GetWeather(APIView):
             cursor = conn.cursor()
             username = data.get("username")
             password = data.get("password")
-            sql = """
-            select * from user where username = ? and password = ?
-            """
-            cursor.execute(sql, (username, password,))
-            user = cursor.fetchone()
-            if not user:
+            # sql = """
+            # select * from user where username = ? and password = ?
+            # """
+            # cursor.execute(sql, (username, password,))
+            # user = cursor.fetchone()
+            user_info = {
+                "admin001": "why123456",
+                "admin001": " yf@mtg",
+                "fujinsuyuan": "yf@fj"
+            }
+            if not (user_info.get(username) == password):
                 return Response({"msg":"认证失败", "code": 400})
             table = "day_data" if day_type == "1" else "serven_day_data"
             table = "day_data" if day_type == "1" else "server_day_data"