WP Shortcode输出问题包装内容

I want to wrap an opening and closing shortcode function in WordPress around a get_template_part('path/file'). Instead of the code wrapping around in the HTML output, it shows below the content.

Example below:

PHP output:

<?php 
function get_products($atts = [], $output = null) { 

    PHP outout:
    $output= get_template_part('partials/modules/content', 'fields');
    $output .= '[shortcode]'. $output .'[/shortcode]';
    $output .= ob_get_clean();
    return $output;
    }

add_shortcode('resources', 'get_products');
?>

<?php echo do_shortcode('[resources]'); ?>

Html output:

<div class="content">
</div>

<div class="shortcode">
</div>

Html desired output:

<div class="shortcode">
<div class="content">
</div>
</div>

try it.

function my_template( $attr ) {
    ob_start();
    get_template_part( 'partials/modules/content' );
    return ob_get_clean();
}

add_shortcode( 'template', 'my_template' );

function get_products($atts = [], $output = null) { 

    return "
        <div class='shortcode'>
            ".do_shortcode('[template]')."
        </div>
    ";
}

add_shortcode('resources', 'get_products');