mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:59:25 +08:00
优化
This commit is contained in:
@@ -98,6 +98,23 @@ def isAppleSystem():
|
||||
return False
|
||||
|
||||
|
||||
def isNumber(s):
|
||||
try:
|
||||
float(s)
|
||||
return True
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import unicodedata
|
||||
unicodedata.numeric(s)
|
||||
return True
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def deleteFile(file):
|
||||
if os.path.exists(file):
|
||||
os.remove(file)
|
||||
|
||||
@@ -48,6 +48,13 @@ class plugins_api:
|
||||
def listApi(self):
|
||||
sType = request.args.get('type', '0')
|
||||
sPage = request.args.get('p', '1')
|
||||
|
||||
if not mw.isNumber(sPage):
|
||||
sPage = 1
|
||||
|
||||
if not mw.isNumber(sType):
|
||||
sType = 0
|
||||
|
||||
# print sPage
|
||||
data = self.getPluginList(sType, int(sPage))
|
||||
return mw.getJson(data)
|
||||
|
||||
Reference in New Issue
Block a user