add operator to siminfo
This commit is contained in:
+8
-3
@@ -1,4 +1,3 @@
|
||||
import datetime
|
||||
import time
|
||||
|
||||
|
||||
@@ -7,12 +6,14 @@ class SimInfoPojo:
|
||||
ccid: str
|
||||
update_at: int
|
||||
position: int
|
||||
operator: str
|
||||
|
||||
def __init__(self, phone: str, ccid: str, position, update_at: int = int(time.time())):
|
||||
def __init__(self, phone: str, ccid: str, position, operator: str, update_at: int = int(time.time())):
|
||||
self.phone = phone
|
||||
self.ccid = ccid
|
||||
self.update_at = update_at
|
||||
self.position = position
|
||||
self.operator = operator
|
||||
|
||||
@staticmethod
|
||||
def from_firestore_dict(source):
|
||||
@@ -24,7 +25,10 @@ class SimInfoPojo:
|
||||
position = None
|
||||
if 'position' in source:
|
||||
position = source['position']
|
||||
result = SimInfoPojo(phone=phone, ccid=ccid, update_at=update_at, position=position)
|
||||
result = SimInfoPojo(phone=phone, ccid=ccid, update_at=update_at, position=position, operator="")
|
||||
if 'operator' in source:
|
||||
operator = source['operator']
|
||||
result.operator = operator
|
||||
result.id = id
|
||||
return result
|
||||
|
||||
@@ -34,6 +38,7 @@ class SimInfoPojo:
|
||||
u'ccid': self.ccid,
|
||||
u'update_at': self.update_at,
|
||||
u'position': self.position,
|
||||
u'operator': self.operator,
|
||||
}
|
||||
|
||||
return dest
|
||||
|
||||
Reference in New Issue
Block a user