app_dongri.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. # -*- coding: utf-8 -*-
  2. from flask import Flask, render_template,jsonify
  3. from flask_socketio import SocketIO, emit
  4. from scriptBase.comon import *
  5. import pyautogui
  6. import base64
  7. import threading
  8. from dongri_task import *
  9. from collections import deque
  10. import json
  11. from concurrent.futures import ThreadPoolExecutor
  12. from flask_caching import Cache
  13. # 全局线程池,限制最大线程数为1
  14. executor = ThreadPoolExecutor(max_workers=1)
  15. cache = Cache(config={'CACHE_TYPE': 'null'}) # 使用 null 缓存类型
  16. app = Flask(__name__)
  17. cache.init_app(app)
  18. app.config['TEMPLATES_AUTO_RELOAD'] = True
  19. socketio = SocketIO(app, cors_allowed_origins="*", max_http_buffer_size=1e8)
  20. event = threading.Event()
  21. g_status_list = []
  22. last_time = 0.0
  23. task_queue = deque()
  24. last_process = ''
  25. isGameBegin = True
  26. autoTask = None
  27. isReset = False
  28. g_times = 0
  29. g_cureNum = 500
  30. g_switch = False
  31. g_isRestart = True
  32. last_change_time = time.time()
  33. @app.after_request
  34. def add_no_cache_header(response):
  35. # 添加禁用缓存的响应头
  36. response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
  37. response.headers["Pragma"] = "no-cache"
  38. response.headers["Expires"] = "0"
  39. return response
  40. def thread_runTask():
  41. global last_process
  42. global task_queue,isReset
  43. while True:
  44. if event.is_set():
  45. task_queue.clear()
  46. if len(task_queue) != 0:
  47. # 初始时间
  48. current_time = time.time()
  49. task = task_queue[-1]
  50. task_queue.pop()
  51. last_process = task.name
  52. task.run()
  53. cost_time = int(time.time() - current_time)
  54. send_status(f"{task.name} 执行完成,耗时{cost_time}秒")
  55. myTimeSleep_small()
  56. else:
  57. myTimeSleep_big()
  58. if isReset:
  59. isReset = False
  60. cfg = read_cfg()
  61. if cfg['switch']:
  62. type = update_rungame_type()
  63. print(f'启动游戏{type}')
  64. restart_game(type)
  65. else:
  66. restart_game(0)
  67. @app.route('/')
  68. def index():
  69. return render_template('index_dongri.html')
  70. @socketio.on('connect')
  71. def handle_connect():
  72. print('Client connected')
  73. @socketio.on('disconnect')
  74. def handle_disconnect():
  75. print('Client disconnected')
  76. def send_hint(msg):#数组信息
  77. emit('processing_hint', msg)
  78. def send_todo():
  79. emit('processing_todo', get_todo_msgList())
  80. def send_status(msg):#软件执行状态
  81. global g_status_list, g_times
  82. try:
  83. if not msg == "":
  84. # 添加新的状态消息和时间到列表
  85. timestamp = datetime.now().strftime('%H:%M:%S') # 获取当前时间
  86. status_entry = {'msg': msg, 'time': timestamp} # 存储消息和时间
  87. g_status_list.append(status_entry)
  88. # 如果列表超过 5 条,移除最早的一条
  89. if len(g_status_list) > 5:
  90. g_status_list.pop(0)
  91. else:
  92. sendStr = ''
  93. for item in g_status_list:
  94. sendStr = f"{g_times}次-{item['time']}-{item['msg']}<br>" + sendStr
  95. #print(sendStr)
  96. emit('processing_status', sendStr)
  97. # 如果消息是 "结束",发送所有状态并清空列表
  98. if msg == "结束":
  99. g_status_list = [] # 清空列表
  100. event.clear()
  101. except Exception as e:
  102. print(f"Error in send_status: {e}")
  103. return
  104. @socketio.on('monitor_begin')
  105. def monitor_begin():
  106. global last_time, last_process
  107. current_time = time.time()
  108. elapsed_time = current_time - last_time
  109. if elapsed_time < 0.5:
  110. return
  111. last_time = current_time
  112. regionRet, regionPos = game_region()
  113. screenshot = pyautogui.screenshot(region=regionPos)
  114. #binary_img = binarize_image(screenshot)
  115. compressed_data = compress_image(screenshot)
  116. image_data_base64 = base64.b64encode(compressed_data).decode('utf-8')
  117. socketio.emit('image_data', image_data_base64)
  118. task_arr = []
  119. if not event.is_set():
  120. task_arr.append(last_process)
  121. for item in reversed(task_queue):
  122. task_arr.append(item.name)
  123. send_hint(json.dumps(task_arr, ensure_ascii=False))
  124. send_todo()
  125. send_status('')
  126. #print("send img")
  127. @socketio.on('end_script')
  128. def handle_end_script():
  129. event.set()
  130. @socketio.on('end_game')
  131. def handle_end_game():
  132. event.set()
  133. task_close_game()
  134. send_status("结束2")
  135. event.clear()
  136. @socketio.on('get_title')
  137. def handle_get_title():
  138. str = task_getComputerName()
  139. dst = str + ' machine'
  140. emit('processing_title', dst)
  141. @socketio.on('reset_script')
  142. def handle_reset_script():
  143. python = sys.executable
  144. while '--reset' in sys.argv:
  145. # 从 sys.argv 列表中删除 --reset 参数
  146. sys.argv.remove('--reset')
  147. os.execl(python, python, *sys.argv)
  148. @socketio.on('restart_game')
  149. def handle_restart_game():
  150. python = sys.executable
  151. while '--reset' in sys.argv:
  152. # 从 sys.argv 列表中删除 --reset 参数
  153. sys.argv.remove('--reset')
  154. print("当前参数:", sys.argv)
  155. subprocess.Popen([python, *sys.argv, '--reset'])
  156. os._exit(0)
  157. @app.route('/restart_game', methods=['POST'])
  158. def http_restart_game():
  159. print("HTTP 触发 restart_game")
  160. socketio.start_background_task(handle_restart_game)
  161. return jsonify({"status": "success", "message": "已重启"})
  162. @socketio.on('close_game')
  163. def handle_close_game():
  164. task_close_game()
  165. send_status("结束2")
  166. event.clear()
  167. @app.route('/close_game', methods=['POST'])
  168. def http_close_game():
  169. print("HTTP 触发 close_game")
  170. handle_close_game()
  171. socketio.start_background_task(handle_end_script)
  172. return jsonify({"status": "success", "message": "已关闭"})
  173. @socketio.on('read_cfg')
  174. def handle_read_cfg():
  175. cfg = read_cfg()
  176. emit('processing_cfg', cfg)
  177. def restart_game(type=0):
  178. global isGameBegin
  179. isGameBegin = False
  180. while True:
  181. task_close_game()
  182. if True == task_start_game(type):
  183. break
  184. else:
  185. send_status("启动失败")
  186. isGameBegin = True
  187. send_status("结束")
  188. config = read_cfg()
  189. print("config", config)
  190. auto_task(config)
  191. def auto_participate():
  192. task_queue.appendleft(task_returnAllLine())
  193. timeout = 40 * 60
  194. start_time = time.time() # 记录开始时间
  195. while not event.is_set():
  196. if len(task_queue) < 4:
  197. task_queue.appendleft(task_paticipateInTeam())
  198. task_queue.appendleft(task_paticipateInTeam())
  199. task_queue.appendleft(task_paticipateInTeam())
  200. myTimeSleep_big()
  201. # 每次循环检查已用时间
  202. current_time = time.time()
  203. elapsed_time = current_time - start_time
  204. if elapsed_time >= timeout:
  205. handle_restart_game()
  206. break
  207. def auto_ranshuang():
  208. timeout = 40 * 60
  209. start_time = time.time() # 记录开始时间
  210. while not event.is_set():
  211. if len(task_queue) < 4:
  212. task_queue.appendleft(task_fight_ranshuang())
  213. myTimeSleep_big()
  214. current_time = time.time()
  215. elapsed_time = current_time - start_time
  216. if elapsed_time >= timeout:
  217. handle_restart_game()
  218. break
  219. def auto_palace():
  220. global g_times, g_cureNum
  221. timeout = 180 * 60
  222. start_time = time.time() # 记录开始时间
  223. read_cfg()
  224. while not event.is_set():
  225. g_times += 1
  226. if len(task_queue) < 4:
  227. task_queue.appendleft(task_cure(True, g_cureNum))
  228. task_queue.appendleft(task_cure(True, g_cureNum))
  229. task_queue.appendleft(task_fight_enemy())
  230. myTimeSleep_big()
  231. current_time = time.time()
  232. elapsed_time = current_time - start_time
  233. if elapsed_time >= timeout:
  234. handle_restart_game()
  235. def add_auto_task(isMaxCollect, isJina, isSimple = False, isAddStrengh = False, activity = 'None', isAutoParticipate = True, isDailyConfig = False, train_type = 'None', always = False):
  236. global g_times, g_cureNum, g_switch, g_isRestart
  237. collectArr = [int(x) for x in isMaxCollect.split(",")]
  238. print("collectArr", collectArr)
  239. while not event.is_set():
  240. isLoginTask = True
  241. fight_big_monster_times = 0
  242. config = read_Dailycfg()
  243. print("config", config)
  244. if check_daily_config(config):
  245. today = datetime.now().strftime('%Y-%m-%d')
  246. isLoginTask = bool(config['daily'][today]["login_task"])
  247. fight_big_monster_times = int(config['daily'][today]["fight_bigMonster_times"])
  248. else:
  249. set_login_task(config, False)
  250. set_fight_big_monster_times(config, 0)
  251. clean_old_daily_configs(config)
  252. isLoginTask = False
  253. fight_big_monster_times = 0
  254. write_Dailycfg(config)
  255. send_status(f"isLoginTask:{isLoginTask}, fight_big_monster_times:{fight_big_monster_times}")
  256. if not isLoginTask:
  257. task_queue.appendleft(task_checkMaster())
  258. set_login_task(config, True)
  259. write_Dailycfg(config)
  260. if isDailyConfig and fight_big_monster_times < 10:
  261. isSuccess = task_fightMonster(isAddStrengh, True, isSimple)
  262. if isSuccess:
  263. set_fight_big_monster_times(config, fight_big_monster_times + 1)
  264. write_Dailycfg(config)
  265. if isSimple == False and is_within_n_minutes(get_todo_time("巨熊行动"), 20, 30):
  266. if len(task_queue) < 5:
  267. task_queue.appendleft(task_returnAllLine())
  268. task_queue.appendleft(task_useAnnimalSkill(True))
  269. task_queue.appendleft(task_paticipateInTeam())
  270. task_queue.appendleft(task_paticipateInTeam())
  271. task_queue.appendleft(task_paticipateInTeam())
  272. task_queue.appendleft(task_paticipateInTeam())
  273. task_queue.appendleft(task_paticipateInTeam())
  274. task_queue.appendleft(task_paticipateInTeam())
  275. task_queue.appendleft(task_paticipateInTeam())
  276. task_queue.appendleft(task_paticipateInTeam())
  277. task_queue.appendleft(task_paticipateInTeam())
  278. myTimeSleep_big()
  279. send_status(f'巨熊行动中')
  280. continue
  281. elif isSimple == False and is_within_n_minutes(get_todo_time("巨熊行动"), 60, 0):
  282. # 设置无尽运行和启动的游戏为0
  283. always = True
  284. update_rungame_type(0)
  285. send_status(f'巨熊行动:在60min内,切换到无尽模式')
  286. # special activity
  287. if activity == 'lianmeng':
  288. task_queue.appendleft(task_activity_lianmeng())
  289. elif activity == 'cure':
  290. task_queue.appendleft(task_cure(True, g_cureNum))
  291. elif activity == 'only_cure':
  292. task_queue.appendleft(task_cure(True, g_cureNum))
  293. task_queue.appendleft(task_cure(True, g_cureNum))
  294. task_queue.appendleft(task_cure(True, g_cureNum))
  295. return
  296. task_queue.appendleft(task_checkActivities())
  297. if g_switch == True:
  298. task_queue.appendleft(task_checkBenifitStatus())
  299. # first run
  300. #if g_times % 3 == 1:
  301. # task_queue.appendleft(check_safe_collect())
  302. if isSimple == False:
  303. task_queue.appendleft(task_information())
  304. task_queue.appendleft(task_check_Research())
  305. task_queue.appendleft(task_checkStoreRoom())
  306. if not isSimple:
  307. if isJina == 'jina':
  308. task_queue.appendleft(task_fight_jina(isAddStrengh))
  309. elif isJina == 'yongbing':
  310. task_queue.appendleft(task_fight_yongbing(isAddStrengh))
  311. elif isJina == 'monster':
  312. task_queue.appendleft(task_fightMonster(isAddStrengh, False, isSimple))
  313. elif isJina == 'big_monster':
  314. task_queue.appendleft(task_fightMonster(isAddStrengh, True, isSimple))
  315. elif isJina == 'jina_call':
  316. ### 全部聊天记录都是新吉娜
  317. task_queue.appendleft(task_call_jina())
  318. task_queue.appendleft(task_call_jina())
  319. task_queue.appendleft(task_call_jina())
  320. task_queue.appendleft(task_call_jina())
  321. elif isJina == 'jina_onlyFight':
  322. task_queue.appendleft(task_fight_jina_only())
  323. task_queue.appendleft(task_collect(collectArr, isSimple, isAddStrengh))
  324. task_queue.appendleft(task_train(train_type))
  325. if isSimple == False:
  326. if not isAddStrengh: # 如果不是添加体力,则添加一次采集
  327. task_queue.appendleft(task_collect(collectArr, isSimple, isAddStrengh))
  328. if isJina == 'monster' and isAddStrengh:
  329. task_queue.appendleft(task_fightMonster(isAddStrengh, False, isSimple))
  330. else:
  331. task_queue.appendleft(task_collect(collectArr, isSimple, isAddStrengh))
  332. else:
  333. task_queue.appendleft(task_collect(collectArr, isSimple, isAddStrengh))
  334. if g_times % 5 == 0:
  335. if get_rungame_type() == 0:
  336. task_queue.appendleft(check_buildOrResearch())
  337. task_queue.appendleft(task_cure(True, g_cureNum))
  338. task_queue.appendleft(task_information())
  339. task_queue.appendleft(task_checkDonata())
  340. task_queue.appendleft(task_checkMaster())
  341. task_queue.appendleft(task_checkAdventure())
  342. task_queue.appendleft(task_train(train_type))
  343. task_queue.appendleft(task_useAnnimalSkill())
  344. task_queue.appendleft(task_read_mails())
  345. task_queue.appendleft(task_getStrength())
  346. if auto_participate:
  347. task_queue.appendleft(task_checkConfilits())
  348. task_queue.appendleft(task_checkDiamond())
  349. task_queue.appendleft(task_fight_campion())
  350. task_queue.appendleft(task_checkUnionTreasure())
  351. #task_queue.appendleft(task_checkBenifitStatus())
  352. task_queue.appendleft(task_gotoTree())
  353. task_queue.appendleft(task_checkHelp())
  354. #task_queue.appendleft(task_get_redPackage())
  355. g_times += 1
  356. restart_times = 7
  357. if g_switch:
  358. restart_times = 4
  359. if g_times % restart_times == 0 and g_times != 0:
  360. if g_isRestart:
  361. handle_end_game()
  362. if g_switch == False:
  363. if always:
  364. myTimeSleep(random.randint(350, 400), send_status)
  365. else:
  366. myTimeSleep(random.randint(1000, 2000), send_status)
  367. else:
  368. myTimeSleep(random.randint(20, 50), send_status)
  369. if g_isRestart:
  370. handle_restart_game()
  371. else:
  372. if isAddStrengh:
  373. myTimeSleep(random.randint(350, 400), send_status)
  374. else:
  375. myTimeSleep(random.randint(350, 400), send_status)
  376. task_queue.clear()
  377. send_status(f'自动模式结束')
  378. event.clear()
  379. daily_config = {
  380. "login_task": False,
  381. "fight_bigMonster_times": 0
  382. }
  383. def check_daily_config(config):
  384. today = datetime.now().strftime('%Y-%m-%d') # 获取当前日期
  385. print(f"Today: {today}") # 打印当前日期
  386. print(f"Config: {config}") # 打印传入的配置
  387. if "daily" not in config:
  388. print("Daily key not found, creating it.") # 调试信息
  389. config["daily"] = {}
  390. return False
  391. if today not in config["daily"]:
  392. print(f"Today's config not found: {today}") # 调试信息
  393. return False
  394. else:
  395. print(f"Today's config found: {today}") # 调试信息
  396. return True
  397. def update_rungame_type(dstType=None):
  398. config = read_Dailycfg()
  399. runTypeStr = 'runType'
  400. if runTypeStr not in config:
  401. if dstType is not None:
  402. config[runTypeStr] = dstType
  403. else:
  404. config[runTypeStr] = 1
  405. write_Dailycfg(config)
  406. print(f"更新下次启动{config[runTypeStr]}")
  407. return 0
  408. else:
  409. value = config[runTypeStr]
  410. if dstType is not None:
  411. config[runTypeStr] = dstType
  412. else:
  413. config[runTypeStr] = (value + 1) % 2
  414. write_Dailycfg(config)
  415. print(f"更新下次启动{config[runTypeStr]}")
  416. return value
  417. def get_rungame_type():
  418. config = read_Dailycfg()
  419. runTypeStr = 'runType'
  420. if runTypeStr not in config:
  421. return 0
  422. else:
  423. if config[runTypeStr] == 0:
  424. return 1
  425. else:
  426. return 0
  427. # 修改或添加 "login_task" 的值
  428. def set_login_task(config, value):
  429. today = datetime.now().strftime('%Y-%m-%d') # 获取当前日期
  430. if today not in config["daily"]: # 如果当天的配置不存在
  431. config["daily"][today] = {} # 创建当天的配置
  432. config["daily"][today]["login_task"] = value # 设置或更新 "login_task"
  433. return config
  434. # 修改或添加 "fight_bigMonster_times" 的值
  435. def set_fight_big_monster_times(config, value):
  436. today = datetime.now().strftime('%Y-%m-%d') # 获取当前日期
  437. if today not in config["daily"]: # 如果当天的配置不存在
  438. config["daily"][today] = {} # 创建当天的配置
  439. config["daily"][today]["fight_bigMonster_times"] = value # 设置或更新 "fight_bigMonster_times"
  440. return config
  441. def add_today_daily_config(config, daily_config, overwrite=False):
  442. today = datetime.now().strftime('%Y-%m-%d') # 获取当前日期
  443. if today not in config["daily"] or overwrite: # 如果不存在或允许覆盖
  444. config["daily"][today] = daily_config # 添加或更新
  445. return config
  446. # 清理非当天的每日配置
  447. def clean_old_daily_configs(config):
  448. today = datetime.now().strftime('%Y-%m-%d') # 获取当前日期
  449. keys_to_remove = [key for key in config["daily"] if key != today] # 找到非当天的每日配置
  450. for key in keys_to_remove:
  451. del config["daily"][key] # 删除非当天的每日配置
  452. return config
  453. def write_cfg(config):
  454. with open('config.json', 'w') as config_file:
  455. json.dump(config, config_file, indent=4)
  456. def read_cfg():
  457. global g_cureNum
  458. try:
  459. with open('config.json', 'r') as config_file:
  460. config = json.load(config_file)
  461. g_cureNum = config['cureNumber']
  462. return config
  463. except FileNotFoundError:
  464. print("配置文件不存在,请检查文件路径。")
  465. return None
  466. except PermissionError:
  467. print("没有权限读取配置文件。")
  468. return None
  469. except json.JSONDecodeError:
  470. print("配置文件格式错误,请检查文件内容是否为有效的 JSON。")
  471. return None
  472. def write_Dailycfg(config):
  473. with open('daily.json', 'w') as config_file:
  474. json.dump(config, config_file, indent=4)
  475. def read_Dailycfg():
  476. try:
  477. with open('daily.json', 'r') as config_file:
  478. config = json.load(config_file)
  479. return config
  480. except FileNotFoundError:
  481. print("配置文件不存在,请检查文件路径。")
  482. return None
  483. except PermissionError:
  484. print("没有权限读取配置文件。")
  485. return None
  486. except json.JSONDecodeError:
  487. print("配置文件格式错误,请检查文件内容是否为有效的 JSON。")
  488. return None
  489. @socketio.on('begin_auto')
  490. def handle_auto(data):
  491. write_cfg(data)
  492. config = read_cfg()
  493. print("config", config)
  494. auto_task(config)
  495. def auto_task(data):
  496. global autoTask, g_cureNum,g_isRestart,g_switch
  497. if data == None:
  498. isMaxCollect = '4,3,2,1'
  499. isSimple = False
  500. isJina = 'jina'
  501. isAddStrengh = False
  502. activity = 'none'
  503. participateJijie = False
  504. auto_daily = False
  505. train_type = 'none'
  506. always = False
  507. cureNumber = 500
  508. lineCheck = False
  509. switch = False
  510. g_isRestart = True
  511. else:
  512. isMaxCollect = data['maxCollect']
  513. isSimple = data['simple']
  514. isJina = data['jina']
  515. isAddStrengh = data['add_strength']
  516. activity = data['activity']
  517. participateJijie = data['participate_jijie']
  518. auto_daily = data['auto_daily']
  519. train_type = data['train']
  520. always = data['always']
  521. cureNumber = data['cureNumber']
  522. lineCheck = data['lineCheck']
  523. switch = data['switch']
  524. g_isRestart = data['is_restart']
  525. g_cureNum = cureNumber
  526. g_switch = switch
  527. set_lineCheck(lineCheck)
  528. send_status(f'开始自动模式')
  529. executor.submit(add_auto_task, isMaxCollect, isJina, isSimple, isAddStrengh, activity, participateJijie, auto_daily, train_type, always)
  530. @socketio.on('begin_auto_participate')
  531. def handle_auto_participate():
  532. global autoTask
  533. send_status(f'开始自动集结模式')
  534. executor.submit(auto_participate)
  535. @socketio.on('begin_testNewFun')
  536. def handle_auto_testNewFun():
  537. global autoTask
  538. send_status(f'开始自动测试新功能')
  539. task_testFun().run()
  540. @socketio.on('begin_auto_ranshuang')
  541. def handle_auto_ranshuang():
  542. global autoTask
  543. send_status(f'开始自动燃霜')
  544. executor.submit(auto_ranshuang)
  545. @socketio.on('auto_palace')
  546. def handle_auto_palace():
  547. global autoTask
  548. send_status(f'开始自动王城')
  549. executor.submit(auto_palace)
  550. def monitor_game_runtime():
  551. global g_times, last_change_time
  552. last_value = g_times
  553. while True:
  554. current_value = g_times
  555. if current_value != last_value:
  556. last_value = current_value
  557. last_change_time = time.time()
  558. print(f"g_times changed to {current_value}")
  559. # 检查是否超过60分钟没有变化
  560. if time.time() - last_change_time > 3600: # 3600秒=60分钟
  561. print("g_times hasn't changed for 60 minutes!")
  562. handle_restart_game()
  563. time.sleep(10)
  564. if __name__ == '__main__':
  565. init()
  566. if '--reset' in sys.argv:
  567. time.sleep(2)
  568. isReset = True
  569. print("需要重启游戏")
  570. runTask = threading.Thread(target=thread_runTask)#启动线程往里面添加任务
  571. runTask.daemon = True
  572. runTask.start()
  573. monitor_thread = threading.Thread(target=monitor_game_runtime, daemon=True)
  574. monitor_thread.start()
  575. socketio.run(app, host= '0.0.0.0', debug=True)