<?php
if (!defined('ROOT'))
	exit ;
?>
<!DOCTYPE html>
<html>

	<head>
		<title>网盘升级</title>
		<meta name="description" content="">
		<meta name="keywords" content="">
		<?php
		include 'Inc_files.php';
		?>
		<style type="text/css">
		#list_style .widget{ padding: 15px;}
		.am-u-lg-3 {width: 23%;border: 1px solid #efefef;margin: 0 1%;}
		.am-u-lg-3 p{font-size: 14px;}
		#bg{background: #F2F6F9 !important;}
		#bg .widget{background: #F2F6F9 !important;}
		</style>
	</head>

	<body>
		<div class="am-g tpl-g">
			<?php include 'Inc_head.php'
			?>
			<!-- 侧边导航栏 -->
			<?php
			include 'Inc_left.php';
			?>
			<!-- 内容区域 -->
			
			<?php
				$uid=session("user_auth.id");
				$userconfig=userconfig_get($uid);
				$wangpan_type = $userconfig['wangpan_id'];
				$days = floor(($userconfig['wangpan_etime']-time())/86400) ;
			?>
			<div class="tpl-content-wrapper">
				<div class="row-content am-cf"  id="list_style">
					<div class="row">
						<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
							<div class="widget am-cf">
								<div class="widget-head am-cf">
									<div class="widget-title  am-cf">
										<a href="javascript:;" id="folder_root">网盘升级</a> 
									</div>
								</div>
								<div class="widget-body">
									<?php foreach ($list as $k => $v) {?>
									<div class="am-u-sm-12 am-u-md-12 am-u-lg-3 list" <?php if($wangpan_type == $v['id']){ echo 'id ="bg"';}?> style=" min-height: 670px;">
										<div class="widget am-cf">
											<div class="widget-head am-cf">
												
												<div class="widget-title am-fl">
													<?php echo $v['name'];?>
														<?php if($wangpan_type == $v['id']){?>（当前网盘）<?php }?>
												</div>
												<div class="widget-function am-fr">
													<!--<a href="javascript:;" class="am-icon-cog"></a>-->
												</div>
											</div>
											<div class="widget-body am-fr">
												<div class="am-fl">
													<div class="widget-fluctuation-period-text">
														<p>网盘大小：<?php echo $v['size'];?>M</p>
														<p>单个文件最大：<?php echo $v['max'];?>M</p>
														<p>顶级目录限制：<?php echo $v['top_menu'];?>个</p>
														<p>子目录限制：<?php echo $v['two_menu'];?>个</p>
														<p>自定义特效：<?php  if($v['texiao'] ==0 ){echo '不支持';}else if($v['texiao'] ==1){echo '支持';}?></p>
														<p>一小时内下载量：<?php  if($v['two_hour'] ==0 ){echo '不限制';}else{echo $v['two_hour'].'M';}?></p>
														<p>付费文件：<?php  if($v['pay'] ==0 ){echo '不支持';}else if($v['pay'] ==1){echo '支持';}?></p>
														<p>交易利率：<?php echo ($v['rate']*100).'%';?></p>
														<p>文件夹同步：<?php echo ($v['wenjianjiatongbu']==1)?'支持':'不支持';?></p>
														<p>升级分成：<?php echo ($v['fufeifencheng']*100).'%';?></p>
														<p>销售分成：<?php echo ($v['xiaoshoufencheng']==0)?'无分成':($v['xiaoshoufencheng']*100).'%';?></p>
														<?php if($v['id']>1){ ?>
															<?php
															if($v['id']==2 && $wangpan_type>2 && $userconfig['wangpan_etime']<time()){
																echo '<a href="javascript:;" class="btn_jiangji" data-type="2"><button class="widget-fluctuation-tpl-btn">降级</button></a>';
															}if($v['id']==3 && $wangpan_type>3 && $userconfig['wangpan_etime']<time()){
																echo '<a href="javascript:;" class="btn_jiangji" data-type="3"><button class="widget-fluctuation-tpl-btn">降级</button></a>';
															}
															?>
															<?php if($wangpan_type == 1){?>
																<a href="/wangpan_log/buy/id/<?php echo $v['id'];?>">
																	<button class="widget-fluctuation-tpl-btn">购买</button>
																</a>
															<?php } else if($wangpan_type == $v['id'] && $days <= 0){?>
																<a href="/wangpan_log/buy/id/<?php echo $v['id'];?>">
																	<button class="widget-fluctuation-tpl-btn">购买</button>
																</a>	
															<?php } else if($wangpan_type == $v['id'] && $days > 0){?>
																<a href="/wangpan_log/xufei/id/<?php echo $v['id'];?>">
																	<button class="widget-fluctuation-tpl-btn">续费</button>
																</a>
															<?php } else if($wangpan_type < $v['id'] && $days > 0){?>
																<a href="/wangpan_log/shengji/id/<?php echo $v['id'];?>">
																	<button class="widget-fluctuation-tpl-btn">升级</button>
																</a>
															<?php } else if($wangpan_type < $v['id'] && $days < 0){?>
																<a href="/wangpan_log/buy/id/<?php echo $v['id'];?>">
																	<button class="widget-fluctuation-tpl-btn">购买</button>
																</a>	
															<?php } ?>
														<?php } ?>	
													</div>
												</div>
											</div>
										</div>
										
									</div>
									<?php }?>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<?php
		include 'Inc_files_boot.php';
		?>
		<script src="<?php echo C('TMPL_PARSE_STRING.__TPL__'); ?>/assets/js/theme.js"></script>
		<script type="text/javascript">
			jQuery(document).ready(function($){ 
				jQuery("#list_style .list").last().addClass('am-u-end');
				//降级
				jQuery(document).on('click','.btn_jiangji',function () {
					var the=jQuery(this);
					jQuery.ajax({
						url:"<?php echo U('Wangpan_log/jiangji');?>",
					    data:{
					    	id:the.data('type')
					    },
					    dataType: "json",
					    type: "post",
					    timeout: 10000,
					    success: function(data) {
					    	location.reload();
					    },
					    error: function() {
					        mui.toast("网络连接超时");
					    }
					});
				})
			});
		</script>
	</body>

</html>