林轩 1 week ago
parent
commit
d34fe46433
2 changed files with 8 additions and 8 deletions
  1. 4 4
      crond_script/cbd_analysis.py
  2. 4 4
      crond_script/nd_qxz_data.py

+ 4 - 4
crond_script/cbd_analysis.py

@@ -46,7 +46,7 @@ def device_info(file_path):
     return device_info
 
 
-def get_cbd_data(devices):
+def get_cbd_data(devices, start, end):
     di = 0
     for device in devices:
         d_id = device.get("id")
@@ -58,8 +58,8 @@ def get_cbd_data(devices):
         url = "https://web.hnyfwlw.com/api/api_gateway?method=forecast.cbd_analysis.analysis_pest_result"
         data = {
             "d_id": str(d_id),
-            "start": "2025-01-01",
-            "end": "2025-12-31",
+            "start": start,
+            "end": end,
             "offset": 0,
             "model": "B",
             "token": "pXQBKiumY1soyO854pFUfMARZV9pmJ0idqAePsqilVI="
@@ -107,6 +107,6 @@ def get_cbd_data(devices):
 
 if __name__ == '__main__':
     devices = device_info(f"{BASE_DIR}/crond_script/find_query.xlsx")
-    get_cbd_data(devices)
+    get_cbd_data(devices, "2024-01-01", "2024-12-31")
     # init_henan_addr()
     

+ 4 - 4
crond_script/nd_qxz_data.py

@@ -119,9 +119,9 @@ def nd_qxz_data(device_ids, start, end):
 
 
 
-def main():
-    start_year = datetime(2025, 1, 1, 0, 0, 0).timestamp()
-    end_year = datetime(2026, 1, 2, 0, 0, 0).timestamp()
+def main(start_y, end_y):
+    start_year = datetime(start_y, 1, 1, 0, 0, 0).timestamp()
+    end_year = datetime(end_y, 1, 1, 0, 0, 0).timestamp()
     device_addr = device_aggrate()
     for i in device_addr:
         device_ids = i.get("device_ids")
@@ -175,4 +175,4 @@ def main():
 
 
 if __name__ == '__main__':
-    main()
+    main(2024, 2025)