Skip to content

Commit

Permalink
🩹 尝试修复简化信息匹配 #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Cp0204 committed Jun 11, 2024
1 parent afa0106 commit 6388e75
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions telecom_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,24 +200,24 @@ def to_summary(self, data, phonenum=""):
return {}
phonenum = phonenum or self.phonenum
# 总流量
flow_use = int(data["flowInfo"]["totalAmount"]["used"])
flow_balance = int(data["flowInfo"]["totalAmount"]["balance"])
flow_use = int(data["flowInfo"]["totalAmount"]["used"] or 0)
flow_balance = int(data["flowInfo"]["totalAmount"]["balance"] or 0)
flow_total = flow_use + flow_balance
# 通用流量
common_use = int(data["flowInfo"]["commonFlow"]["used"])
common_balance = int(data["flowInfo"]["commonFlow"]["balance"])
common_use = int(data["flowInfo"]["commonFlow"]["used"] or 0)
common_balance = int(data["flowInfo"]["commonFlow"]["balance"] or 0)
common_total = common_use + common_balance
# 专用流量
special_use = int(data["flowInfo"]["specialAmount"]["used"])
special_balance = int(data["flowInfo"]["specialAmount"]["balance"])
special_use = int(data["flowInfo"]["specialAmount"]["used"] or 0)
special_balance = int(data["flowInfo"]["specialAmount"]["balance"] or 0)
special_total = special_use + special_balance
# 语音通话
voice_usage = int(data["voiceInfo"]["voiceDataInfo"]["used"])
voice_balance = int(data["voiceInfo"]["voiceDataInfo"]["balance"])
voice_total = int(data["voiceInfo"]["voiceDataInfo"]["total"])
voice_usage = int(data["voiceInfo"]["voiceDataInfo"]["used"] or 0)
voice_balance = int(data["voiceInfo"]["voiceDataInfo"]["balance"] or 0)
voice_total = int(data["voiceInfo"]["voiceDataInfo"]["total"] or 0)
# 余额
balance = int(
float(data["balanceInfo"]["indexBalanceDataInfo"]["balance"]) * 100
float(data["balanceInfo"]["indexBalanceDataInfo"]["balance"] or 0) * 100
)
# 流量包列表
flowItems = []
Expand Down

0 comments on commit 6388e75

Please sign in to comment.