表结构添加,人员权限控制

This commit is contained in:
yujj128
2025-10-14 10:30:17 +08:00
parent be0bc661e2
commit a915896f3e
3 changed files with 107 additions and 15 deletions

View File

@@ -217,6 +217,22 @@ def run_sql_2(id: str, sql: str):
return jsonify({"type": "sql_error", "error": str(e)})
@app.flask_app.route("/yj_sqlbot/api/v0/verify", methods=["GET"])
def verify_user():
try:
id = request.args.get("user_id")
users = config('ALLOWED_USERS', cast=list, default=[])
for user in users:
if user == id:
return jsonify({"type": "success", "verify": True})
else:
return jsonify({"type": "success", "verify": False})
except Exception as e:
logger.error(f"verify user failed:{e}")
return jsonify({"type": "error", "error": str(e)})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8084, debug=False)