update
This commit is contained in:
parent
d2e7864b55
commit
647323786b
|
|
@ -0,0 +1,21 @@
|
|||
# coding: utf-8
|
||||
|
||||
import psutil
|
||||
import time
|
||||
import os
|
||||
import sys
|
||||
import public
|
||||
import re
|
||||
import json
|
||||
import pwd
|
||||
|
||||
from flask import request
|
||||
|
||||
|
||||
class crontab_api:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
##### ----- start ----- ###
|
||||
##### ----- start ----- ###
|
||||
|
|
@ -38,7 +38,6 @@ class plugins_api:
|
|||
|
||||
def __init__(self):
|
||||
self.setupPath = 'server'
|
||||
# self.__plugin_dir = public.getRunDir() + '/plugins'
|
||||
|
||||
##### ----- start ----- ###
|
||||
def listApi(self):
|
||||
|
|
@ -94,6 +93,7 @@ class plugins_api:
|
|||
return public.returnJson(False, '缺少版本信息!', ())
|
||||
|
||||
infoJsonPos = self.__plugin_dir + '/' + name + '/' + 'info.json'
|
||||
print infoJsonPos
|
||||
|
||||
if not os.path.exists(infoJsonPos):
|
||||
return public.retJson(False, '配置文件不存在!', ())
|
||||
|
|
@ -174,6 +174,7 @@ class plugins_api:
|
|||
def settingApi(self):
|
||||
name = request.args.get('name', '')
|
||||
html = self.__plugin_dir + '/' + name + '/index.html'
|
||||
print html
|
||||
return public.readFile(html)
|
||||
|
||||
def runApi(self):
|
||||
|
|
@ -651,6 +652,7 @@ class plugins_api:
|
|||
path = public.getRunDir() + '/' + self.__plugin_dir + \
|
||||
'/' + name + '/' + script + '.py'
|
||||
py = 'python ' + path
|
||||
|
||||
if args == '':
|
||||
py_cmd = py + ' ' + func + ' ' + version
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ def getJson(data):
|
|||
return json.dumps(data)
|
||||
|
||||
|
||||
def returnData(status, msg, data):
|
||||
def returnData(status, msg, data=None):
|
||||
return {'status': status, 'msg': msg, 'data': data}
|
||||
|
||||
|
||||
|
|
@ -177,9 +177,8 @@ def retFail(msg, data=None):
|
|||
return {'status': False, 'msg': msg, 'data': data}
|
||||
|
||||
|
||||
def returnJson(status, msg, args=()):
|
||||
# 取通用Json返回
|
||||
return getJson(returnMsg(status, msg, args))
|
||||
def returnJson(status, msg, data=None):
|
||||
return getJson({'status': status, 'msg': msg, 'data': data})
|
||||
|
||||
|
||||
def returnMsg(status, msg, args=()):
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class task_api:
|
|||
def __init__(self):
|
||||
pass
|
||||
|
||||
def count(self):
|
||||
def countApi(self):
|
||||
c = public.M('tasks').where("status!=?", ('1',)).count()
|
||||
return str(c)
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ def index(reqClass=None, reqAction=None, reqData=None):
|
|||
|
||||
if (reqClass == None):
|
||||
reqClass = 'index'
|
||||
classFile = ('config', 'control', 'crontab',
|
||||
'files', 'firewall', 'index', 'plugins', 'login', 'system', 'site', 'soft')
|
||||
classFile = ('config', 'control', 'crontab', 'files', 'firewall',
|
||||
'index', 'plugins', 'login', 'system', 'site', 'task', 'soft')
|
||||
if not reqClass in classFile:
|
||||
return '403 no access!'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue