Ejemplo n.º 1
0
def addBlack(cmd: str = Body(..., embed=True)):
    if cmd is not None:
        sql = "select * from " + black_cmd + " where cmd = '" + cmd + "'"
        if Mysql_Db_Manage.is_have(sql=sql):
            return 7
        sql = "insert into " + black_cmd + "(cmd,`create_time`) values('" + str(
            cmd) + "'," + str(int(time.time())) + ")"
        result = Mysql_Db_Manage.update_data(sql=sql)
        print("添加成功,返回结果是:" + str(result))
        return '2'
Ejemplo n.º 2
0
def add_share(command: str = Body(..., embed=True),
              description: str = Body(..., embed=True)):
    sql = "select * from " + table_share_cmd + " where cmd = '" + command.split(
        " ")[0] + "' limit 1"
    result = Mysql_Db_Manage.is_have(sql=sql)
    if not result:
        sql = "insert into table_share_cmd(cmd,`time`) values('" + command.split(
            " ")[0] + "'," + str(int(time.time())) + ")"
        Mysql_Db_Manage.update_data(sql=sql)
    sql = "insert into " + table_share_command + "(command,`time`,description) values('" + str(
        command) + "'," + str(int(
            time.time())) + ",'" + str(description) + "')"
    strs = Mysql_Db_Manage.update_data(sql=sql)
    return '2'
Ejemplo n.º 3
0
def update_command(id: int = Body(..., embed=True),
                   description: str = Body(..., embed=True)):
    sql = "update " + table_command + " set description = '" + description + "' where id = " + str(
        id)
    print(sql)
    print("===>" + str(Mysql_Db_Manage.update_data(sql=sql)))
    return '2'
Ejemplo n.º 4
0
def getAll(name: Optional[str] = False):
    sql = "select * from " + black_cmd
    if name:
        sql += " where cmd like '%" + name + "%'"

    sql += " order by create_time desc"
    return Mysql_Db_Manage.select_All_data(sql=sql)
Ejemplo n.º 5
0
def addH(command: str = Body(..., embed=True)):
    if command is None:
        return "-2"
    sql = "select * from " + black_cmd + " where cmd = '" + command.split(
        " ")[0] + "' limit 1"
    result = Mysql_Db_Manage.is_have(sql=sql)
    if result:
        return
    sql = "select * from " + table_cmd + " where cmd = '" + command.split(
        " ")[0] + "' limit 1"
    result = Mysql_Db_Manage.is_have(sql=sql)
    if not result:
        sql = "insert into " + table_cmd + "(cmd,`time`) values('" + str(
            command.split(" ")[0]) + "'," + str(int(time.time())) + ")"
        Mysql_Db_Manage.update_data(sql=sql)
    sql = "insert into " + table_command + "(command,`time`) values('" + str(
        command) + "'," + str(int(time.time())) + ")"
    return '2'
Ejemplo n.º 6
0
def getAll(cmd: str = None):
    sql = "select * from " + table_command
    # if cmd == "null":
    #     sql2 = "select * from " + table_cmd + " order by cmd asc limit 1"
    #     one_data = Mysql_Db_Manage.select_one_data(sql=sql2)
    #     cmd = one_data["cmd"]
    if cmd is not None and cmd != 'null':
        sql += " where command like '" + cmd + "%'"
    sql += " order by time desc"
    return Mysql_Db_Manage.select_All_data(sql=sql)
Ejemplo n.º 7
0
def addH(name: Optional[str] = False, detail: Optional[str] = False):

    sql = "select * from " + table_command
    if name:
        sql += "  where command like '%" + name + "%' "
    sql += " order by time desc "
    result = Mysql_Db_Manage.select_All_data(sql=sql)
    data = []
    result_data = []
    if not detail:
        print("进入了这里")
        for line in result:
            if line['command'] not in data:
                if str(line['command']).split(" ").__len__() > 1:
                    print(line['command'])
                    data.append(line['command'])
                    result_data.append(line)

    return result_data
Ejemplo n.º 8
0
def addH(cmd: str = None):
    sql = "select * from " + table_cmd + " order by cmd asc"
    return Mysql_Db_Manage.select_All_data(sql=sql)
Ejemplo n.º 9
0
def getAll(name: str = None):
    sql = "select * from " + table_command + " where command like '%" + name + "%' order by time desc"
    return Mysql_Db_Manage.select_All_data(sql=sql)
Ejemplo n.º 10
0
def addH():
    sql = "select * from " + table_command + " order by time desc"
    return Mysql_Db_Manage.select_All_data(sql=sql)
Ejemplo n.º 11
0
def getShareAll(cmd: str = None):
    sql = "select * from " + table_share_command
    if cmd is not None:
        sql += " where command like '" + cmd + "%'"
    sql += " order by time desc"
    return Mysql_Db_Manage.select_All_data(sql=sql)
Ejemplo n.º 12
0
def getShareAll(cmd: str = None):
    sql = "select * from " + table_share_command + " order by time desc"
    return Mysql_Db_Manage.select_All_data(sql=sql)
Ejemplo n.º 13
0
def getShareCmdAll(cmd: str = None):
    sql = "select * from " + table_share_cmd + " order by cmd asc"
    return Mysql_Db_Manage.select_All_data(sql=sql)