临时提交
This commit is contained in:
16
Entity/AnchorModel.py
Normal file
16
Entity/AnchorModel.py
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
# 主播模型
|
||||
class AnchorModel:
|
||||
def __init__(self, anchorId= "", country= ""):
|
||||
# 主播ID
|
||||
self.anchorId = anchorId
|
||||
# 主播国家
|
||||
self.country = country
|
||||
|
||||
# 字典转模型
|
||||
@classmethod
|
||||
def dictToModel(cls, d):
|
||||
model = AnchorModel()
|
||||
model.anchorId = d.get('anchorId', "")
|
||||
model.country = d.get('country', "")
|
||||
return model
|
||||
@@ -1,4 +1,24 @@
|
||||
# Tik Tok app bundle id
|
||||
import threading
|
||||
from typing import Dict, Any
|
||||
|
||||
from Entity.AnchorModel import AnchorModel
|
||||
|
||||
tikTokApp = "com.zhiliaoapp.musically"
|
||||
# wda apple bundle id
|
||||
WdaAppBundleId = "com.vv.wda.xctrunner"
|
||||
# 全局主播列表
|
||||
anchorList: list[AnchorModel] = []
|
||||
# 线程锁
|
||||
anchorListLock = threading.Lock()
|
||||
|
||||
# 安全删除数据
|
||||
def removeModelFromAnchorList(model: AnchorModel):
|
||||
with anchorListLock:
|
||||
anchorList.remove(model)
|
||||
|
||||
# 添加数据
|
||||
def addModelToAnchorList(models: list[Dict[str, Any]]):
|
||||
with anchorListLock:
|
||||
for dic in models:
|
||||
obj = AnchorModel.dictToModel(dic)
|
||||
anchorList.append(obj)
|
||||
Reference in New Issue
Block a user