<?php
    $down_info_arr=get_post_meta( get_the_ID(), 'down_info', true );
?>

<?php if(_ceo('ceoshop_2_shangjia') == true): ?>
<section class="ceo-sidebar-shop b-a b-r-4 ceo-background-default ceo-overflow-hidden ceo-margin-medium-bottom">
    <?php get_template_part( 'template-parts/single/shop/sidebar/sidebar', 'author' ); ?>
</section>
<?php endif; ?>

<section class="ceo-sidebar-shop b-a b-r-4 ceo-background-default ceo-overflow-hidden ceo-margin-medium-bottom">
    <!--资源价格-->
    <?php if(_ceo('ceoshop_2_xiazai_jg') == true): ?>
    <div class="ceo-sidebar-shop-price">
        <span class="sellP">
            <em style="font-size: 13px;">¥</em>
            <span id="priceinfo"><?php echo $price=get_post_meta(get_the_ID(), 'down_price', true); ?></span>
            <em style="font-size: 13px;"><?php echo get_option('ice_name_alipay')?get_option('ice_name_alipay'):'C币'; ?> </em>
            <span class="ceo-sidebar-shop-vip">
                <?php
                $content='';
                $memberDown=get_post_meta(get_the_ID(), 'member_down',TRUE);
                $indexMemberDown = $memberDown;
                $userType=getUsreMemberType();

                $erphp_url_front_vip = get_bloginfo('wpurl').'/users?pd=money';
                if(get_option('erphp_url_front_vip')){
                    $erphp_url_front_vip = get_option('erphp_url_front_vip');
                }
                $erphp_url_front_login = wp_login_url();
                if(get_option('erphp_url_front_login')){
                    $erphp_url_front_login = get_option('erphp_url_front_login');
                }
                if(is_user_logged_in()){
                    $erphp_url_front_vip2 = $erphp_url_front_vip;
                }else{
                    $erphp_url_front_vip2 = $erphp_url_front_login;
                }

                if($indexMemberDown > 1){
                    $vipText = '<a href="'.$erphp_url_front_vip.'" target="_blank" class="ceoshop-vip2">升级VIP</a>';
                    if($userType){
                        $vipText = '';
                    }
                    if($indexMemberDown==3 && $down_info==null){
                        $content.='<i class="iconfont icon-sketch"></i>VIP免费'.$vipText.'';
                    }elseif ($indexMemberDown==2 && $down_info==null){
                        $content.='<i class="iconfont icon-sketch"></i>VIP 5折'.$vipText.'';
                    }elseif ($indexMemberDown==5 && $down_info==null){
                        $content.='<i class="iconfont icon-sketch"></i>VIP 8折'.$vipText.'';
                    }elseif ($indexMemberDown==6 && $down_info==null){
                        if($userType < 9){
                            $vipText = '<a href="'.$erphp_url_front_vip.'" target="_blank" class="ceoshop-vip2"> 升级年费VIP</a>';
                        }
                        $content.='<i class="iconfont icon-sketch"></i>年费VIP免费'.$vipText.'';
                    }elseif ($indexMemberDown==7 && $down_info==null){
                        if($userType < 10){
                            $vipText = '<a href="'.$erphp_url_front_vip.'" target="_blank" class="ceoshop-vip2"> 升级终身VIP</a>';
                        }
                        $content.='<i class="iconfont icon-sketch"></i>终身VIP免费'.$vipText.'';
                    }elseif ($indexMemberDown==4){
                        if($userType){
                            $content.='<i class="iconfont icon-sketch"></i>此资源为VIP专享资源';
                        }
                    }elseif ($indexMemberDown==8){
                        if($userType >= 9){
                            $content.='<i class="iconfont icon-sketch"></i>此资源为年费VIP专享资源';
                        }
                    }elseif ($indexMemberDown==9){
                        if($userType >= 10){
                            $content.='<i class="iconfont icon-sketch"></i>此资源为终身VIP专享资源';
                        }
                    }
                }
                if($indexMemberDown==4 && $userType==FALSE){
                    $content.='<i class="iconfont icon-sketch"></i>此资源仅限VIP下载<a href="'.$erphp_url_front_vip.'" class="ceoshop-vip"> 升级VIP</a>';
                }elseif($indexMemberDown==8 && $userType < 9){
                    $content.='<i class="iconfont icon-sketch"></i>此资源仅限年费VIP下载<a href="'.$erphp_url_front_vip.'" class="ceoshop-vip"> 升级VIP</a>';
                }elseif($indexMemberDown==9 && $userType < 10){
                    $content.='<i class="iconfont icon-sketch"></i>此资源仅限终身VIP下载<a href="'.$erphp_url_front_vip.'" class="ceoshop-vip"> 升级VIP</a>';
                }

                echo $content;
                ?>
            </span>
        </span>
    </div>
    <?php endif; ?>

    <!--下载按钮-->
    <?php
    $erphpdown_content_show_html = erphpdown_content_show('');
    preg_match('#<a class="(.*?)</a>#', $erphpdown_content_show_html, $erphpdown_content_show_arr);
    if ( ! empty($erphpdown_content_show_arr[0])) {
        $btn_new = $erphpdown_content_show_arr[0];
        $btn_new = str_replace('class="', 'class="makeFunc ', $btn_new);
    }

    if($btn_new){
        ?>
        <span class="ceo-sidebar-shop-down">
        <?php echo $btn_new;?>
    </span>
        <?php
    }else{
        ?>
        <span class="ceo-sidebar-shop-down">
        <a class="makeFunc" href="javascript:void(0)" onclick="ceoshop_download('<?php echo $post_id; ?>')"> <?php if(_ceo('ceoshop_single_an'))echo _ceo('ceoshop_single_an')['ceoshop_single_an_xz']; ?>
        </a>
    </span>
    <?php }?>

    <!--演示按钮-->
    <?php if(get_post_meta( get_the_ID(), 'down_demourl', true )){?>
    <span class="ceo-sidebar-shop-demo">
        <a href="<?php echo get_post_meta( get_the_ID(), 'down_demourl', true );?>" target="_blank" rel="noreferrer nofollow" >
        <i class="iconfont icon-phone"></i> <?php if(_ceo('ceoshop_single_an'))echo _ceo('ceoshop_single_an')['ceoshop_single_an_ys']; ?>
        </a>
    </span>
    <?php }?>

    <!--点赞收藏-->
    <?php if(_ceo('ceoshop_2_xiazai_dzsc') == true): ?>
    <ul class="ceo-sidebar-shop-sz">
        <li class="ceo-sidebar-shop-good">
        <a href="javascript:;" data-action="topTop" data-id="<?php the_ID(); ?>" class="ceo-display-inline-block btn change-color dotGood <?php echo isset($_COOKIE['dotGood_' . $post->ID]) ? '' : ''; ?>">
    		<i class="iconfont icon-dianzan"></i> 点赞 (<span class="count"><?php echo ($dot_good=get_post_meta($post->ID, 'dotGood', true)) ? $dot_good : '0'; ?></span>)
    	</a>
        </li>
        <li class="ceo-sidebar-shop-good">
        <?php echo zongcai_post_collection_button( get_the_ID() );?>
        </li>
    </ul>
    <?php endif; ?>
</section>

<section class="ceo-sidebar-shop b-a b-r-4 ceo-background-default ceo-overflow-hidden ceo-margin-medium-bottom">
    <!--信息属性-->
    <ul>
        <?php if(!empty($down_info_arr)){?>
            <?php
            if(!empty($down_info_arr)){
                foreach ($down_info_arr as $k=>$v){
                    $number=$k+1;
                    echo '<li><span class="ceo-sidebar-shop-title">'.$v['title'].'：</span>'.'<span class="ceo-sidebar-shop-content">'.$v['desc'].'</span>';
                    if($number%3==0){
                        echo '</li>';
                    }
                }
            }
            ?>
        <?php } ?>
        <?php if(_ceo('ceoshop_2_shuxing_bh') == true): ?>
        <li>
            <span class="ceo-sidebar-shop-title"><?php echo _ceo('ceoshop_2_shuxing_bhbt'); ?>： </span>
            <span class="ceo-sidebar-shop-content"><?php echo get_the_ID(); ?></span>
        </li>
        <?php endif; ?>
        <?php if(_ceo('ceoshop_2_shuxing_gx') == true): ?>
        <li>
            <span class="ceo-sidebar-shop-title"><?php echo _ceo('ceoshop_2_shuxing_gxbt'); ?>： </span>
            <span class="ceo-sidebar-shop-content"><?php echo date("Y-m-d",strtotime($post->post_modified));?></span>
        </li>
        <?php endif; ?>
    </ul>
    <!--信息属性-->
    <?php if(_ceo('ceoshop_2_shuxing_lx') == true): ?>
    <div class="ceo-sidebar-shop-WP">
        <div class="ceo-sidebar-shop-L"><?php if(_ceo('ceoshop_2_shuxing_lx_sz'))echo _ceo('ceoshop_2_shuxing_lx_sz')['ceoshop_2_shuxing_lx_zbt']; ?>
        </div>
        <div class="ceo-sidebar-shop-C"><a target="_blank" href="<?php if(_ceo('ceoshop_2_shuxing_lx_sz'))echo _ceo('ceoshop_2_shuxing_lx_sz')['ceoshop_2_shuxing_lx_anlj']; ?>"><i class="iconfont <?php if(_ceo('ceoshop_2_shuxing_lx_sz'))echo _ceo('ceoshop_2_shuxing_lx_sz')['ceoshop_2_shuxing_lx_antb']; ?>"></i><?php if(_ceo('ceoshop_2_shuxing_lx_sz'))echo _ceo('ceoshop_2_shuxing_lx_sz')['ceoshop_2_shuxing_lx_anbt']; ?></a>
        </div>
        <div class="ceo-sidebar-shop-R">
            <span class="sy-hover-box"><i class="iconfont <?php if(_ceo('ceoshop_2_shuxing_lx_sz'))echo _ceo('ceoshop_2_shuxing_lx_sz')['ceoshop_2_shuxing_lx_xztb']; ?>"></i><?php if(_ceo('ceoshop_2_shuxing_lx_sz'))echo _ceo('ceoshop_2_shuxing_lx_sz')['ceoshop_2_shuxing_lx_xzxz']; ?>
            </span>
            <div class="sy-hover"><span><?php if(_ceo('ceoshop_2_shuxing_lx_sz'))echo _ceo('ceoshop_2_shuxing_lx_sz')['ceoshop_2_shuxing_lx_xznr']; ?></span>
            </div>
        </div>
    </div>
    <?php endif; ?>
</section>
<?php get_template_part( 'template-parts/single/shop/sidebar/sidebar', 'shouquan' ); ?>
<style>.sidebar .user-info{display: none}</style>
