You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
786 B
24 lines
786 B
1 week ago
|
from . import api
|
||
|
from mycode.DBManager import app_DBM
|
||
|
from myutils.ReManager import mReM
|
||
|
from quart import Quart, render_template, redirect, url_for, request,jsonify
|
||
|
|
||
|
@api.route('/system/getinfo',methods=['GET'])
|
||
|
async def get_system_info():
|
||
|
data = app_DBM.getsystem_info()
|
||
|
return jsonify({"local_ip":data[0],"version":data[1]})
|
||
|
|
||
|
@api.route('/system/updateip',methods=['POST'])
|
||
|
async def update_local_ip():
|
||
|
data = await request.get_json()
|
||
|
local_ip = data.get("local_ip")
|
||
|
if mReM.is_valid_ip(local_ip):
|
||
|
bsuccess = app_DBM.update_localip(local_ip)
|
||
|
error = ""
|
||
|
if not bsuccess:
|
||
|
error = "修改IP地址失败!"
|
||
|
else:
|
||
|
bsuccess = False
|
||
|
error = "IP不合法"
|
||
|
return jsonify({"bsuccess":bsuccess,"error":error})
|