|
@@ -1,5 +1,5 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
-from flask import Flask, render_template
|
|
|
+from flask import Flask, render_template,jsonify
|
|
|
from flask_socketio import SocketIO, emit
|
|
|
from scriptBase.comon import *
|
|
|
import pyautogui
|
|
@@ -171,12 +171,24 @@ def handle_restart_game():
|
|
|
python = sys.executable
|
|
|
os.execl(python, python, *sys.argv, '--reset')
|
|
|
|
|
|
+@app.route('/restart_game', methods=['POST'])
|
|
|
+def http_restart_game():
|
|
|
+ print("HTTP 触发 restart_game")
|
|
|
+ socketio.start_background_task(handle_restart_game)
|
|
|
+ return jsonify({"status": "success", "message": "已重启"})
|
|
|
+
|
|
|
@socketio.on('close_game')
|
|
|
def handle_close_game():
|
|
|
task_close_game()
|
|
|
send_status("结束2")
|
|
|
event.clear()
|
|
|
|
|
|
+@app.route('/close_game', methods=['POST'])
|
|
|
+def http_close_game():
|
|
|
+ print("HTTP 触发 close_game")
|
|
|
+ handle_close_game()
|
|
|
+ return jsonify({"status": "success", "message": "已关闭"})
|
|
|
+
|
|
|
|
|
|
@socketio.on('read_cfg')
|
|
|
def handle_read_cfg():
|