Skip to content

Commit 7b92f9b

Browse files
committed
🐛 修复字段空字符取整错误 #28
1 parent 9bbeb50 commit 7b92f9b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

telecom_class.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ def to_summary(self, data, phonenum=""):
211211
flow_over = int(total_amount.get("over") or 0)
212212
# 通用流量
213213
common_flow = data["flowInfo"].get("commonFlow") or {}
214-
common_use = int(common_flow.get("used", 0))
215-
common_balance = int(common_flow.get("balance", 0))
214+
common_use = int(common_flow.get("used") or 0)
215+
common_balance = int(common_flow.get("balance") or 0)
216216
common_total = common_use + common_balance
217-
common_over = int(common_flow.get("over", 0))
217+
common_over = int(common_flow.get("over") or 0)
218218
# 专用流量
219219
special_amount = data["flowInfo"].get("specialAmount") or {}
220-
special_use = int(special_amount.get("used", 0))
221-
special_balance = int(special_amount.get("balance", 0))
220+
special_use = int(special_amount.get("used") or 0)
221+
special_balance = int(special_amount.get("balance") or 0)
222222
special_total = special_use + special_balance
223223
# 语音通话
224224
voice_usage = int(data["voiceInfo"]["voiceDataInfo"]["used"] or 0)

0 commit comments

Comments
 (0)