Esempio n. 1
0
def coll_socket(msg):
    coll_path = '/www/server/panel/plugin/coll'
    if not os.path.exists(coll_path): 
        emit('coll_response',{'data':'未安装宝塔群控主控端!'})
        return;
    if type(msg) == str or not 'f' in msg: 
        emit('coll_response',{'data':'参数错误!'})
        return;
    sys.path.insert(0,coll_path)
    from inc import coll_terminal
    try:
        if sys.version_info[0] == 2:
            reload(coll_terminal)
        else:
            from imp import reload
            reload(coll_terminal)
    except:pass
    t = coll_terminal.coll_terminal()
    if not hasattr(t,msg['f']): 
        emit('coll_response',{'data':'指定方法不存在!'})
        return;
    emit('coll_response',getattr(t,msg['f'])(msg))
Esempio n. 2
0
def coll_socket(msg):
    coll_path = '/www/server/panel/plugin/coll'
    if not os.path.exists(coll_path):
        emit('coll_response',
             {'data': 'aaPanel group control master is not installed!'})
        return
    if type(msg) == str or not 'f' in msg:
        emit('coll_response', {'data': 'Parameter error!'})
        return
    sys.path.insert(0, coll_path)
    from inc import coll_terminal
    try:
        if sys.version_info[0] == 2:
            reload(coll_terminal)
        else:
            from imp import reload
            reload(coll_terminal)
    except:
        pass
    t = coll_terminal.coll_terminal()
    if not hasattr(t, msg['f']):
        emit('coll_response', {'data': 'The specified method does not exist!'})
        return
    emit('coll_response', getattr(t, msg['f'])(msg))