浏览代码

优化查询流量月用量

zhangdongming 3 年之前
父节点
当前提交
1fd27f98d5
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      Object/UnicomObject.py

+ 3 - 3
Object/UnicomObject.py

@@ -266,9 +266,9 @@ class UnicomObjeect:
             device_usage_history_list = usage_history['data']['deviceUsageHistory']
             if device_usage_history_list:
                 for item in device_usage_history_list:
-                    if item['year'] == usage_year and item['month'] == usage_month:
-                        flow_total_usage += item['flowTotalUsage']
-                        break
+                    if item['year'] != usage_year and item['month'] != usage_month:
+                        continue
+                    flow_total_usage += item['flowTotalUsage']
         return flow_total_usage
 
     @staticmethod