import request from '@/utils/requst_tx_vp';

	// dbm := router.Group("/dbm")

	// dbm.POST("/run_sql", RunSQLHandler)                   // 运行SQL语句
	// dbm.POST("/create_db_manage", CreateDBManageHandler)  // 创建数据库管理
	// dbm.POST("/get_db_manage", GetDBManageHandler)        // 获取数据库管理信息
	// dbm.POST("/get_sql_history", GetSQLRunHistoryHandler) // 获取SQL运行历史
	// dbm.POST("/update_db_manage", UpdateDBManageHandler)  // 更新数据库管理信息

export const FindDBManageListService = (Data) => {
    const params = new URLSearchParams();
    for (let key in Data) {
        if(key == "token"){
            continue;
        }
        params.append(key, Data[key])

    }
    return request.post('/dbm/get_db_manage', params,{

        headers: {

            'token': Data.token, //token

        }

    })
}

export const AddDBManageService = (Data) => {
    const params = new URLSearchParams();
    for (let key in Data) {
        if(key == "token"){
            continue;
        }
        params.append(key, Data[key])
        
    }
    return request.post('/dbm/create_db_manage', params,{
        headers: {
            'token': Data.token, //token
            
        }
    })
}

export const UpdateDBManageService = (Data) => {
    const params = new URLSearchParams();
    for (let key in Data) {
        if(key == "token"){
            continue;
        }
        params.append(key, Data[key])
        
    }
    return request.post('/dbm/update_db_manage', params,{
        headers: {
            'token': Data.token, //token
            
        }
    })
}

export const RunSQLService = (Data) => {
    const params = new URLSearchParams();
    for (let key in Data) {
        if(key == "token"){
            continue;
        }
        params.append(key, Data[key])
    }
    return request.post('/dbm/run_sql', params, {
        headers: {
            'token': Data.token, //token
        }
    })
}

export const GetSQLRunHistoryService = (Data) => {
    const params = new URLSearchParams();
    for (let key in Data) {
        if(key == "token"){
            continue;
        }
        params.append(key, Data[key])
        
    }
    return request.post('/dbm/get_sql_history', params,{
        headers: {
            'token': Data.token, //token
            
        }
    })
}