重建仓库,重新提交。
This commit is contained in:
21
Entity/AnchorModel.py
Normal file
21
Entity/AnchorModel.py
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
# 主播模型
|
||||
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
|
||||
|
||||
# 模型转字典
|
||||
@classmethod
|
||||
def modelToDict(cls, model):
|
||||
return {"anchorId": model.anchorId, "country": model.country}
|
||||
30
Entity/DeviceModel.py
Normal file
30
Entity/DeviceModel.py
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
# 设备模型
|
||||
class DeviceModel(object):
|
||||
def __init__(self, deviceId, screenPort, width, height, scale, type):
|
||||
super(DeviceModel, self).__init__()
|
||||
# 设备id
|
||||
self.deviceId = deviceId
|
||||
# 投屏端口
|
||||
self.screenPort = screenPort
|
||||
# 屏幕宽度
|
||||
self.width = width
|
||||
# 屏幕高度
|
||||
self.height = height
|
||||
# 物理分辨率和实际分辨率的倍数
|
||||
self.scale = scale
|
||||
# 1 添加 2删除
|
||||
self.type = type
|
||||
self.ready = False
|
||||
self.deleting = False
|
||||
|
||||
# 转字典
|
||||
def toDict(self):
|
||||
return {
|
||||
'deviceId': self.deviceId,
|
||||
'screenPort': self.screenPort,
|
||||
"width": self.width,
|
||||
"height": self.height,
|
||||
"scale": self.scale,
|
||||
'type': self.type
|
||||
}
|
||||
16
Entity/ResultData.py
Normal file
16
Entity/ResultData.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import json
|
||||
|
||||
# 返回数据模型
|
||||
class ResultData(object):
|
||||
def __init__(self, code=200, data=None, message="获取成功"):
|
||||
super(ResultData, self).__init__()
|
||||
self.code = code
|
||||
self.data = data
|
||||
self.message = message
|
||||
|
||||
def toJson(self):
|
||||
return json.dumps({
|
||||
"code": self.code,
|
||||
"data": self.data,
|
||||
"message": self.message
|
||||
}, ensure_ascii=False) # ensure_ascii=False 确保中文不会被转义
|
||||
70
Entity/Variables.py
Normal file
70
Entity/Variables.py
Normal file
@@ -0,0 +1,70 @@
|
||||
import threading
|
||||
from typing import Dict, Any
|
||||
from Entity.AnchorModel import AnchorModel
|
||||
|
||||
# wda apple bundle id
|
||||
WdaAppBundleId = "com.yolojtAgent.wda.xctrunner"
|
||||
# WdaAppBundleId = "com.yolozsAgent.wda.xctrunner"
|
||||
# wda投屏端口
|
||||
wdaScreenPort = 9567
|
||||
# wda功能端口
|
||||
wdaFunctionPort = 8567
|
||||
# 全局主播列表
|
||||
anchorList: list[AnchorModel] = []
|
||||
# 线程锁
|
||||
anchorListLock = threading.Lock()
|
||||
# 打招呼数据
|
||||
prologueList = {}
|
||||
|
||||
# 评论数据
|
||||
commentList = []
|
||||
|
||||
API_KEY = "app-sdRfZy2by9Kq7uJg7JdOSVr8"
|
||||
|
||||
# 本地储存的打招呼数据
|
||||
localPrologueList = [
|
||||
"If you are interested in this, you can join our team for a period of time. During this period, if you like our team, you can continue to stay in our team. If you don't like it, you can leave at any time, and you won't lose anything!",
|
||||
"What's even better is that after joining our team, you have no obligations and you don't have to pay me. Everything is free",
|
||||
"I'm from the MARS agency. I noticed that you're very active on TikTok, so I contacted you and hope to become your agent❤",
|
||||
"Hello, can we talk about cooperation and support?",
|
||||
"Hello, I’m a supporter. Can we have a chat?",
|
||||
"Hi 👋 I’m an official TikTok partner. I really enjoy your livestreams. Do you have time to chat about support and cooperation?",
|
||||
"Hello, I really like your livestreams. I’d love to talk about cooperation and also support you.",
|
||||
"Hello, I think you have the potential to become a top streamer. Can we talk?",
|
||||
"Nice to meet you 😊 I watched your livestream and really enjoyed it. Can we chat about cooperation?",
|
||||
"Hello 👋 I’m a livestream team manager. I recently watched your livestream—it’s great 👍 I hope we can talk about how to grow together 💪",
|
||||
"I watched your livestream and would like to invite you to join our team. I’ll reward you with more gifts based on your performance.",
|
||||
"Hello, I’d like to promote your livestream. Can we talk?",
|
||||
"Hello, I think I can help you get more gifts and support for free. Would you be interested in talking with me?",
|
||||
"Hello, I really enjoyed your livestream. Can we chat about cooperation?"
|
||||
]
|
||||
|
||||
# 评论列表
|
||||
commentsList = []
|
||||
# 存储主播名和session_id的字典
|
||||
anchorWithSession = {}
|
||||
# 前端传递的token
|
||||
token = ''
|
||||
# 前端传递的
|
||||
tenantId = 0
|
||||
|
||||
userId = 0
|
||||
|
||||
|
||||
# 安全删除数据
|
||||
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)
|
||||
|
||||
|
||||
# 添加打招呼语
|
||||
def addDataToPrologue(data: list[str]):
|
||||
prologueList = data
|
||||
Reference in New Issue
Block a user