<?php
error_reporting(0); 
include("../../config/ht.php");
session_start();
if(!isset($_SESSION['adminname'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/$htlj/'</script>";exit;}
$adminname=$_SESSION['adminname'];
$type="where name='$adminname'";
$adminpd=queryall(admin,$type);
if(!$adminpd){echo "<script>alert('请重新登录!')</script><script>top.location.href='/$htlj/'</script>";exit;}
if($adminpd[qx]=='超级管理员'){}else{echo "<script>alert('无权限')</script><script>top.location.href='/$htlj/'</script>";exit;}
$id=ubo($_GET["id"]);
$type="where id='$id'";
$hzpay=queryall(hzpayto,$type);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312">
<title>【<?php echo $hzpay[name]?>】使用者列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="/layui/css/houtai.css" media="all" />
<link rel="stylesheet" href="/2019newui/houtai/css/font-awesome.min.css" media="all" />
<link rel="stylesheet" href="/2019newui/houtai/css/admin.css" media="all">
<link rel="stylesheet" href="/2019newui/houtai/css/peizhi.css" media="all">
<script src="/2019newui/js/jquery.min.js"></script>
<script src="/layui/layui.js"></script>
<script src="/2019newui/js/bootstrap.min.js"></script>
<style type="text/css">
#tooltip{position:absolute;border:1px solid #ccc;background:#333;padding:2px;display:none;color:#fff;}
</style>
</head>
<body style="padding:10px;">
<div class="tplay-body-div">
<fieldset class="layui-elem-field layui-field-title" style="margin-top:20px;"><legend>【<?php echo $hzpay[name]?>】使用者列表</legend></fieldset>
<div class="layui-tab layui-tab-brief">
<table class="layui-table">
<thead>
<tr>
<?php if($hzpay[biaoshi]=='zfbwap'){?>
<th style="text-align:center;">ID</th>
<th style="text-align:center;" >代理ID</th>
<th style="text-align:center; ">通道状态</th>
<th style="text-align:center;" >通道名称</th>
<th style="text-align:center;" >支付宝partner</th>
<th style="text-align:center;" >支付宝key</th>
<th style="text-align:center;" >添加时间</th>
<?php }elseif($hzpay[biaoshi]=='wxh5'){?>
<th style="text-align:center;">ID</th>
<th style="text-align:center;" >代理ID</th>
<th style="text-align:center; ">通道状态</th>
<th style="text-align:center;" >通道名称</th>
<th style="text-align:center;" >微信支付授权域名</th>
<th style="text-align:center;" >微信支付appid</th>
<th style="text-align:center;" >微信支付mchid</th>
<th style="text-align:center;" >微信支付key</th>
<th style="text-align:center;" >添加时间</th>
<?php }elseif($hzpay[biaoshi]=='wxgzh'){?>
<th style="text-align:center;">ID</th>
<th style="text-align:center;" >代理ID</th>
<th style="text-align:center; ">通道状态</th>
<th style="text-align:center;" >通道名称</th>
<th style="text-align:center;" >微信支付授权域名</th>
<th style="text-align:center;" >微信支付appid</th>
<th style="text-align:center;" >微信支付mchid</th>
<th style="text-align:center;" >微信支付key</th>
<th style="text-align:center;" >微信支付appsecret</th>
<th style="text-align:center;" >添加时间</th>
<?php }elseif($hzpay[biaoshi]=='ubofu'){?>
<th style="text-align:center;">ID</th>
<th style="text-align:center;" >代理ID</th>
<th style="text-align:center; ">通道状态</th>
<th style="text-align:center;" >通道名称</th>
<th style="text-align:center;" >SDK</th>
<th style="text-align:center;" >通知秘钥</th>
<th style="text-align:center;" >支付网关</th>
<th style="text-align:center;" >添加时间</th>
<?php }else{?>
<th style="text-align:center;">ID</th>
<th style="text-align:center;" >代理ID</th>
<th style="text-align:center; ">通道状态</th>
<th style="text-align:center;" >通道名称</th>
<th style="text-align:center;" >商户ID</th>
<th style="text-align:center;" >商户秘钥</th>
<?php if($hzpay[biaoshi]=='ysf'){?><th style="text-align:center;" >通信秘钥</th><?php }else{?><th style="text-align:center;" >支付网关</th><?php }?>
<th style="text-align:center;" >添加时间</th>
<?php }?>
<th style="text-align:center;">操作</th>
</tr>
</thead>
<tbody>
<?php 
$resultyttrt = mysql_query("select id from hzpaylist  where toid='$id'");
$count = mysql_num_rows($resultyttrt); 
?>
<?php if($count == 0){?>
<tr><td  colspan=18  style="text-align:center;"><center>没有记录</center></td></tr>
<?php }?>
<?php 
$query = mysql_query("select * from  hzpaylist  where toid='$id'");
while ($a=mysql_fetch_array($query)) { 
?> 	
<tr>
<?php if($hzpay[biaoshi]=='zfbwap'){?>
<td style="text-align:center;"><?php echo $a[id]?></td>
<td style="text-align:center;"><?php echo $a[userid]?></td>
<td style="text-align:center;" ><div class="layui-form"><input type="checkbox"  name="open"  data-id="<?php echo $a[id]?>"  lay-skin="switch" lay-filter="sz" lay-text="正常使用|暂停使用" <?php if($a[sz]=="1"){?> checked<?php }?>></div></td>
<td style="text-align:center;"><?php echo $a[name]?></td>
<td style="text-align:center;"><?php echo $a[payid]?></td>
<td style="text-align:center;"><?php echo $a[paykey]?></td>
<td style="text-align:center;"><?php echo $a[shijian]?></td>
<td style="text-align:center;"><a class="layui-btn layui-btn-xs delete layui-btn-primary"  style="margin-right: 0;font-size:12px;"  onClick="sc('<?php echo $a[id]?>')">删除</a></td>
<?php }elseif($hzpay[biaoshi]=='wxh5'){?>
<td style="text-align:center;"><?php echo $a[id]?></td>
<td style="text-align:center;"><?php echo $a[userid]?></td>
<td style="text-align:center;" ><div class="layui-form"><input type="checkbox"  name="open"  data-id="<?php echo $a[id]?>"  lay-skin="switch" lay-filter="sz" lay-text="正常使用|暂停使用" <?php if($a[sz]=="1"){?> checked<?php }?>></div></td>
<td style="text-align:center;"><?php echo $a[name]?></td>
<td style="text-align:center;"><?php echo $a[squrl]?></td>
<td style="text-align:center;"><?php echo $a[payid]?></td>
<td style="text-align:center;"><?php echo $a[mchid]?></td>
<td style="text-align:center;"><?php echo $a[paykey]?></td>
<td style="text-align:center;"><?php echo $a[shijian]?></td>
<td style="text-align:center;"><a class="layui-btn layui-btn-xs delete layui-btn-primary"  style="margin-right: 0;font-size:12px;"  onClick="sc('<?php echo $a[id]?>')">删除</a></td>
<?php }elseif($hzpay[biaoshi]=='wxgzh'){?>
<td style="text-align:center;"><?php echo $a[id]?></td>
<td style="text-align:center;"><?php echo $a[userid]?></td>
<td style="text-align:center;" ><div class="layui-form"><input type="checkbox"  name="open"  data-id="<?php echo $a[id]?>"  lay-skin="switch" lay-filter="sz" lay-text="正常使用|暂停使用" <?php if($a[sz]=="1"){?> checked<?php }?>></div></td>
<td style="text-align:center;"><?php echo $a[name]?></td>
<td style="text-align:center;"><?php echo $a[squrl]?></td>
<td style="text-align:center;"><?php echo $a[payid]?></td>
<td style="text-align:center;"><?php echo $a[mchid]?></td>
<td style="text-align:center;"><?php echo $a[paykey]?></td>
<td style="text-align:center;"><?php echo $a[appsecret]?></td>
<td style="text-align:center;"><?php echo $a[shijian]?></td>
<td style="text-align:center;"><a class="layui-btn layui-btn-xs delete layui-btn-primary"  style="margin-right: 0;font-size:12px;"  onClick="sc('<?php echo $a[id]?>')">删除</a></td>
<?php }elseif($hzpay[biaoshi]=='ubofu'){?>
<td style="text-align:center;"><?php echo $a[id]?></td>
<td style="text-align:center;"><?php echo $a[userid]?></td>
<td style="text-align:center;" ><div class="layui-form"><input type="checkbox"  name="open"  data-id="<?php echo $a[id]?>"  lay-skin="switch" lay-filter="sz" lay-text="正常使用|暂停使用" <?php if($a[sz]=="1"){?> checked<?php }?>></div></td>
<td style="text-align:center;"><?php echo $a[name]?></td>
<td style="text-align:center;"><?php echo $a[payid]?></td>
<td style="text-align:center;"><?php echo $a[paykey]?></td>
<td style="text-align:center;"><?php echo $a[payurl]?></td>
<td style="text-align:center;"><?php echo $a[shijian]?></td>
<td style="text-align:center;"><a class="layui-btn layui-btn-xs delete layui-btn-primary"  style="margin-right: 0;font-size:12px;"  onClick="sc('<?php echo $a[id]?>')">删除</a></td>
<?php }else{?>
<td style="text-align:center;"><?php echo $a[id]?></td>
<td style="text-align:center;"><?php echo $a[userid]?></td>
<td style="text-align:center;" ><div class="layui-form"><input type="checkbox"  name="open"  data-id="<?php echo $a[id]?>"  lay-skin="switch" lay-filter="sz" lay-text="正常使用|暂停使用" <?php if($a[sz]=="1"){?> checked<?php }?>></div></td>
<td style="text-align:center;"><?php echo $a[name]?></td>
<td style="text-align:center;"><?php echo $a[payid]?></td>
<td style="text-align:center;"><?php echo $a[paykey]?></td>
<td style="text-align:center;"><?php echo $a[payurl]?></td>
<td style="text-align:center;"><?php echo $a[shijian]?></td>
<td style="text-align:center;"><a class="layui-btn layui-btn-xs delete layui-btn-primary"  style="margin-right: 0;font-size:12px;"  onClick="sc('<?php echo $a[id]?>')">删除</a></td>
<?php }?>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script type="text/javascript">
layui.use(['form', 'layedit', 'laydate', 'element', 'jquery', 'layer'], function(){
var form = layui.form
,layer   = layui.layer
,layedit = layui.layedit
,element = layui.element
,$= layui.jquery
,laydate = layui.laydate;
form.on('switch(sz)', function (data) {
var zt = this.checked ? 1 : 0,
id = $(this).attr('data-id');
if(zt=='1'){
tip='正常使用吗？';
}else{
tip='暂停使用吗？';
}
layer.confirm("确认要" +tip , { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/htpost<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: id,lx:'hzpaylistsz',zt:zt},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('设置成功');
location.reload();
}else{
layer.closeAll('loading');
layer.msg(data.msg);
location.reload();
} 
},
error:function(){
}
});
}); 

});
});
function sc(id) {
layer.confirm("确认要删除吗，删除后不能恢复", { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/htpost<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: id,lx:'hzpaylistsc'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('删除成功');
location.reload();
} 
},
error:function(){
}
});
}); 
}
</script>

</body>
</html>