<?php
    $down_info_arr=get_post_meta( get_the_ID(), 'down_info', true );
    $ceoshop_3_zz_sz = _ceo('ceoshop_3_zz_sz');
?>
<div class="ceo-shop3-zl">
    <div class="snyc" <?php if(_ceo('ceoshop_3_bg') == true): ?>style="background: url(<?php echo _ceo('ceoshop_3_bg_img'); ?>) no-repeat center top;background-size: 100% 100%;"<?php endif; ?>>
        <div class="proimg">
            <img src="<?php echo post_thumbnail_src(); ?>&h=126&w=126&zc=1" data-src="<?php echo post_thumbnail_src(); ?>&h=126&w=126&zc=1" alt="<?php the_title(); ?>">
        </div>
        <div class="text">
            <h1 class="p1" title="<?php the_title(); ?>">
                <?php get_template_part( 'template-parts/single/single', 'biaoqian' ); ?>
                <?php the_title(); ?>
            </h1>
            <div class="p2">
                <div class="ceo-text-small ceo-text-muted ceo-flex ceo-text-truncate ceo-overflow-auto">
				    <div class="avatar ceo-flex ceo-flex-middle">
					    <?php if(_ceo('ceoshop_single_rq_zz') == true): ?>
					    <span class="ceo-text-small ceo-display-block ceo-single-right"><i class="iconfont icon-bussiness-man"></i> <?php the_author_posts_link(); ?></span>
					    <?php endif; ?>

						<?php if(_ceo('ceoshop_single_cat') == true): ?>
						<span class="ceo-display-inline-block ceo-single-right ceo-flex ceo-flex-middle"><i class="iconfont icon-category"></i> <?php
						$category = get_the_category();
						if($category[0]){
							echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';
						}
						?></span>
						<?php endif; ?>
				    </div>
				    <?php if(_ceo('ceoshop_single_rq_fabu') == true): ?>
					<span class="ceo-display-inline-block ceo-single-right ceo-flex ceo-flex-middle"><i class="iconfont icon-rili"></i> <?php the_time('Y-m-d') ?></span>
					<?php endif; ?>

					<?php if(_ceo('ceoshop_single_sc_num') == true): ?>
					<span class="ceo-display-inline-block ceo-single-right ceo-flex ceo-flex-middle"><i class="iconfont icon-shoucang"></i> <?php echo count_collection_current_post( $post_id ) ?></span>
					<?php endif; ?>

					<?php if(_ceo('ceoshop_single_ll_liulan') == true): ?>
					<span class="ceo-display-inline-block ceo-single-right ceo-flex ceo-flex-middle"><i class="iconfont icon-yanjing"></i> <?php post_views('', ''); ?></span>
					<?php endif; ?>

					<?php if(_ceo('ceoshop_single_baidu_sl') == true): ?>
					<span class="ceo-display-inline-block ceo-flex ceo-flex-middle ceo-single-right"><?php baidu_record(); ?></span>
					<?php endif; ?>

					<?php if(_ceo('ceoshop_single_bj_bianji') == true): ?>
					<span class="ceo-display-inline-block ceo-flex ceo-flex-middle"><?php edit_post_link('<i class="iconfont icon-edit"></i> 编辑'); ?>
					</span>
					<?php endif; ?>
				</div>
            </div>

            <div class="p3">
                <?php if(_ceo('ceoshop_3_shuxing_bh') == true): ?>
                <span>
                    <i><?php echo _ceo('ceoshop_3_shuxing_bhbt'); ?></i>
                    <b><?php echo get_the_ID(); ?></b>
                </span>
                <?php endif; ?>

                <?php if(!empty($down_info_arr)){?>
                    <?php
                    if(!empty($down_info_arr)){
                        foreach ($down_info_arr as $k=>$v){
                            $number=$k+1;
                            echo '<span><i>'.$v['title'].'：</i>'.'<b>'.$v['desc'].'</b></span>';
                        }
                    }
                    ?>
                <?php } ?>

                <?php if(_ceo('ceoshop_3_shuxing_gx') == true): ?>
                <span>
                    <i><?php echo _ceo('ceoshop_3_shuxing_gxbt'); ?></i>
                    <b><?php echo date("Y-m-d",strtotime($post->post_modified));?></b>
                </span>
                <?php endif; ?>
            </div>
        </div>
    </div>

    <div class="pricelt">
        <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-shop3-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 = '
                    <span class="stag_tp">
                        <a href="'.$erphp_url_front_vip.'" target="_blank" class="ceoshop-vip2">升级VIP</a>
                        <label>尊享海量资源免费下载特权</label>
                    </span>';
                    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 = '
                            <span class="stag_tp">
                                <a href="'.$erphp_url_front_vip.'" target="_blank" class="ceoshop-vip2">升级年费VIP</a>
                                <label>尊享海量资源免费下载特权</label>
                            </span>';
                        }
                        $content.='<i class="iconfont icon-sketch"></i>年费VIP免费'.$vipText.'';
                    }elseif ($indexMemberDown==7 && $down_info==null){
                        if($userType < 10){
                            $vipText = '
                            <span class="stag_tp">
                                <a href="'.$erphp_url_front_vip.'" target="_blank" class="ceoshop-vip2">升级终身VIP</a>
                                <label>尊享海量资源免费下载特权</label>
                            </span>';
                        }
                        $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下载
                    <span class="stag_tp">
                        <a href="'.$erphp_url_front_vip.'" target="_blank" class="ceoshop-vip2">升级VIP</a>
                        <label>尊享海量资源免费下载特权</label>
                    </span>';
                }elseif($indexMemberDown==8 && $userType < 9){
                    $content.='<i class="iconfont icon-sketch"></i>此资源仅限年费VIP下载
                    <span class="stag_tp">
                        <a href="'.$erphp_url_front_vip.'" target="_blank" class="ceoshop-vip2">升级年费VIP</a>
                        <label>尊享海量资源免费下载特权</label>
                    </span>';
                }elseif($indexMemberDown==9 && $userType < 10){
                    $content.='<i class="iconfont icon-sketch"></i>此资源仅限终身VIP下载
                    <span class="stag_tp">
                        <a href="'.$erphp_url_front_vip.'" target="_blank" class="ceoshop-vip2">升级终身VIP</a>
                        <label>尊享海量资源免费下载特权</label>
                    </span>';
                }

                echo $content;
                ?>
            </span>
        </span>

        <!--点赞收藏按钮-->
        <?php if(_ceo('ceoshop_3_anniu_dzsc') == true): ?>
        <div class="p4">
            <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>
            <?php echo zongcai_post_collection_button( get_the_ID() );?>
        </div>
        <?php endif; ?>

    </div>
    <div class="buyopa">
        <!--下载按钮-->
        <?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){
            echo $btn_new;
        }else{
        ?>
        <a class="makeFunc" href="javascript:void(0)" onclick="ceoshop_download('<?php echo $post_id; ?>')">
            <i class="iconfont icon-download"></i> <?php if(_ceo('ceoshop_single_an'))echo _ceo('ceoshop_single_an')['ceoshop_single_an_xz']; ?>
        </a>
        <?php }?>


        <!--升级会员-->
        <a class="shop3-vip" href="<?php if(_ceo('ceoshop_single_an'))echo _ceo('ceoshop_single_an')['ceoshop_single_an_hyl']; ?>" target="_blank" >
            <i class="iconfont icon-vip"></i> <?php if(_ceo('ceoshop_single_an'))echo _ceo('ceoshop_single_an')['ceoshop_single_an_hy']; ?>
        </a>

        <!--演示按钮-->
        <?php if(get_post_meta( get_the_ID(), 'down_demourl', true )){?>
        <span class="ceo-shop3-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_3_y') == true): ?>
        <div class="hont"><i class="iconfont icon-info-circle"></i><?php echo _ceo('ceoshop_3_ys'); ?></div>
        <?php endif; ?>

    </div>

    <?php if(_ceo('ceoshop_3_zz') == true): ?>
    <div class="mother"><i class="iconfont icon-cart-Empty"></i><?php echo _ceo('ceoshop_3_zz_title'); ?>：
        <?php
    	if ($ceoshop_3_zz_sz) {
    		foreach ( $ceoshop_3_zz_sz as $key => $value) {
    	?>
    	<span><?php echo $value['title']; ?><em></em></span>
        <?php } } ?>
    </div>
    <?php endif; ?>
</div>
