app_dongri.py 22 KB

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