yf_yzl преди 2 години
родител
ревизия
4be171a061
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 4 0
      smartfarming/api/views/forecast/worm_lamp.py

+ 4 - 0
smartfarming/api/views/forecast/worm_lamp.py

@@ -1969,6 +1969,10 @@ def xycb_pest_chart(request):
                 "pest_num": infr_ct,
                 "pest_num": infr_ct,
                 "addtime": addtime
                 "addtime": addtime
             })
             })
+            try:
+                infr_ct = int(infr_ct)
+            except Exception as e:
+                infr_ct = 0
             total_pest_num += infr_ct
             total_pest_num += infr_ct
         except Exception as e:
         except Exception as e:
             logger.error(f"Json 解析错误:{e}")
             logger.error(f"Json 解析错误:{e}")