custom_struct.py 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. from dataclasses import dataclass
  2. from typing import LiteralString
  3. @dataclass
  4. class EmulatorInfo:
  5. index: int
  6. name: str
  7. top_handle: int
  8. bind_handle: int
  9. is_enter_android: int | None
  10. pid: int
  11. vbox_pid: int
  12. width: int | None
  13. height: int | None
  14. dpi: int | None
  15. @dataclass
  16. class PcConfig:
  17. pc_name: str
  18. officer: str | None
  19. use_wuyouip: int | None
  20. only_new: int | None
  21. only_retained: int | None
  22. check_md5_on_start: int | None
  23. start_dkw_on_start: int | None
  24. timed_start: int | None
  25. check_script_update: int | None
  26. check_image_update: int | None
  27. window_nums: int | None
  28. @dataclass
  29. class GameConfig:
  30. game_name: str
  31. cpu: str
  32. task_id: str # "任务id"
  33. memory: str # "内存"
  34. resolution: str # "分辨率"
  35. is_execute: bool # "是否执行"
  36. emulator_type: str # "模拟器类型"
  37. channel_id: str # "渠道id"
  38. game_id: str # "游戏id"
  39. game_type: str # "游戏类型"
  40. scale: str # "缩放"
  41. script: str # "脚本"
  42. timeout: int # "超时时间"
  43. image: str # "镜像"
  44. @staticmethod
  45. def dict_to_GameConfig(game: dict):
  46. info = GameConfig(
  47. cpu=game['cpu'],
  48. game_name=game['name'],
  49. task_id=game['任务id'],
  50. memory=game['内存'],
  51. resolution=str(game['分辨率']).replace('x', ',').replace('(', ',').replace(')', '').replace('dpi', ''),
  52. emulator_type=game['模拟器类型'],
  53. channel_id=game['渠道id'],
  54. game_id=game['游戏id'],
  55. game_type=game['游戏类型'],
  56. scale=game['缩放'],
  57. script=game['脚本'],
  58. timeout=int(game['超时时间']),
  59. image=game['镜像'],
  60. is_execute=game['是否执行'])
  61. return info
  62. @dataclass
  63. class WindowInfo:
  64. window_id: int
  65. game_list: list[GameConfig]
  66. @dataclass
  67. class AccountInfo:
  68. account: str
  69. password: str
  70. city: str
  71. retained: int
  72. retained_str: str
  73. manufacturer: str
  74. model: str
  75. pnumber: str
  76. imei: str
  77. imsi: str
  78. simserial: str
  79. androidid: str
  80. mac: str
  81. mac_colon: str
  82. iccid: str
  83. resolution: str
  84. cpuNum: str
  85. memorySize: str
  86. simulator_name: str
  87. wechat_order_id: str
  88. game_type: str
  89. number_operatorTypes:str
  90. @dataclass
  91. class UpdateInfo:
  92. game_id: str
  93. md5: str
  94. download_url: str
  95. file_type: str
  96. save_path: LiteralString | str | bytes
  97. @dataclass
  98. class UploadLog:
  99. simulator_ip: str # 模拟器ip
  100. simulator_mac: str # 模拟器mac
  101. pc_code: str # 电脑编号
  102. pc_ip: str # 电脑IP
  103. pc_mac: str # 电脑mac
  104. device_id: str # 手机_aid
  105. account: str # 游戏账号
  106. account_type: int # 游戏_账号类型
  107. pwd: str # 游戏账号密码
  108. game_id: int # 游戏编号
  109. coding: int # 错误码
  110. log_uuid: str
  111. operator: str # 负责人
  112. remarks: str # 备注
  113. task_type: int # 任务类型新增0活跃1
  114. script_type: int # 脚本类型
  115. simulator_code: str # 模拟器编号
  116. device_manufacturer: str # 手机_厂商
  117. device_model: str # 手机_型号
  118. device_imei: str # 手机_imei
  119. device_sdk: str # 手机_sdk
  120. device_mac: str # 手机_mac
  121. device_number: str # 手机_号码
  122. script_device_id: str # 脚本中上传
  123. err: str # 0或不传表示没有异常,其他表示异常,脚本端自定义
  124. simulator_ip_city: str # 手机_IP_城市
  125. # 定义一个方法,将对象转换为字典
  126. def to_dict(self):
  127. return {
  128. 'simulator_ip': self.simulator_ip,
  129. 'simulator_mac': self.simulator_mac,
  130. 'pc_code': self.pc_code,
  131. 'pc_ip': self.pc_ip,
  132. 'pc_mac': self.pc_mac,
  133. 'device_id': self.device_id,
  134. 'account': self.account,
  135. 'account_type': self.account_type,
  136. 'pwd': self.pwd,
  137. 'game_id': self.game_id,
  138. 'coding': self.coding,
  139. 'log_uuid': self.log_uuid,
  140. 'operator': self.operator,
  141. 'remarks': self.remarks,
  142. 'task_type': self.task_type,
  143. 'script_type': self.script_type,
  144. 'simulator_code': self.simulator_code,
  145. 'device_manufacturer': self.device_manufacturer,
  146. 'device_model': self.device_model,
  147. 'device_imei': self.device_imei,
  148. 'device_sdk': self.device_sdk,
  149. 'device_mac': self.device_mac,
  150. 'device_number': self.device_number,
  151. 'script_device_id': self.script_device_id,
  152. 'err': self.err,
  153. 'simulator_ip_city': self.simulator_ip_city
  154. }