소스 검색

增加天气接口使用cityid查询

yf_yzl 2 년 전
부모
커밋
aafe9d4600
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      apps/apply_weather.py

+ 2 - 0
apps/apply_weather.py

@@ -70,6 +70,7 @@ class GetWeather(APIView):
             table = "day_data" if day_type == "1" else "serven_day_data"
             table = "day_data" if day_type == "1" else "server_day_data"
             if cityid:
+                logging.warning(f"{cityid}: 使用cityid查询")
                 sql = f"select content from {table} where cityid = '{cityid}'"
                 cursor.execute(sql)
                 result = cursor.fetchone()
@@ -80,6 +81,7 @@ class GetWeather(APIView):
                 else:
                     return Response({"msg": "请联系管理员排查", "code": 500})
             else:
+                logging.warning("使用province,city,distinct查询")
                 sql = f"select content from {table} where province = '{province}' and city ='{city}' and district ='{district}'"
                 cursor.execute(sql)
                 result = cursor.fetchone()