<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:66:"D:\wwwroot\pay.6gym.com\public/../app/index\view\land\bug_list.html";i:1611054462;}*/ ?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title><?php echo $web_config['web_site']; ?> - 6gym.com 6G源码 </title>
    <link rel="stylesheet" href="/static/assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="/static/assets/module/admin.css?v=318" media="all"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        /** 数据表格中的select尺寸调整 */
        .layui-table-view .layui-table-cell .layui-select-title .layui-input {
            height: 28px;
            line-height: 28px;
        }

        .layui-table-view [lay-size="lg"] .layui-table-cell .layui-select-title .layui-input {
            height: 40px;
            line-height: 40px;
        }

        .layui-table-view [lay-size="lg"] .layui-table-cell .layui-select-title .layui-input {
            height: 40px;
            line-height: 40px;
        }

        .layui-table-view [lay-size="sm"] .layui-table-cell .layui-select-title .layui-input {
            height: 20px;
            line-height: 20px;
        }

        .layui-table-view [lay-size="sm"] .layui-table-cell .layui-btn-xs {
            height: 18px;
            line-height: 18px;
        }
        .alert {
            -webkit-border-radius: 2px;
            border-radius: 2px;
         }

        .alert-info {
            color: #31708f;
            background-color: #d9edf7;
            border-color: #bce8f1;
        }
        .alert-dismissable, .alert-dismissible {
            padding-right: 35px;
        }
        .alert {
                padding: 15px;
                margin-bottom: 20px;
                border: 1px solid transparent;
                border-radius: 4px;
        }
    </style>
</head>
<body onscroll="layui.admin.hideFixedEl();">
<!-- 正文开始 -->
<div class="layui-fluid">
    
    <div class="layui-card">
        <div class="layui-card-body">
            
           
            <!-- 表格工具栏 -->
            <form class="layui-form toolbar table-tool-mini">
                
                <div class="layui-form-item">
                  <div class="alert alert-info alert-dismissible" role="alert">当重新打开轮询后对应账号的异常记录将被删除恢复账号轮询状态</div>
                    <div class="layui-inline">
                        <label class="layui-form-label w-auto">账号备注:</label>
                        <div class="layui-input-inline">
                            <input name="username" class="layui-input" type="text" placeholder="输入账号备注"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn icon-btn" lay-filter="tbBasicTbSearch" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>
                    </div>
                </div>
            </form>
            
            <!-- 数据表格 -->
            <table id="tbBasicTable" lay-filter="tbBasicTable"></table>
        </div>
    </div>
  
</div>
<!-- 固定底部按钮 -->


<!-- 表格操作列 -->
<script type="text/html" id="tbBasicTbBar">
   
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改账号</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除账号</a>

    
</script>


<!-- 表格轮询列 -->
<script type="text/html" id="userTblx">
    <input type="checkbox" lay-filter="userTblxCk" value="{{d.land_id}}" lay-skin="switch"
           lay-text="开启|关闭" {{d.land_lx==1?'checked':''}} style="display: none;"/>
    <p style="display: none;">{{d.land_lx==1?'开启':'关闭'}}</p>
</script>

<!-- 支付测试 -->
<script type="text/html" id="land_demo">
   <button type="button" lay-event="pay" class="layui-btn layui-btn-xs" style="background-color:red">发起测试</button>
</script>



<!-- js部分 -->
<script type="text/javascript" src="/static/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="/static/assets/js/common.js?v=318"></script>
<script>
    layui.use(['layer', 'form','admin','table', 'util', 'dropdown','baseTable'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var dropdown = layui.dropdown;
        var admin = layui.admin;
        /* 渲染表格 */
        var insTb = table.render({
            elem: '#tbBasicTable',
            url: "<?php echo url('land/bug_land_list'); ?>",
            page: true,
            cellMinWidth: 100,
            cols: [[
                {type: 'checkbox'},
                {field: 'mid', title: 'MID', align: 'left',width:100},
                {field: 'username', title: '账号备注', align: 'left',width:180},
                {field: 'typec_name', title: '所属通道', align: 'left',width:180},
                {field: 'bug_num', title: '异常次数', align: 'left',width:180},
                {
                    field: 'bug_type', title: '异常触发方式',width: 180, templet: function (d) {
                        if(d.bug_type == 1){
                            return '关闭轮询';
                        }
                    }, align: 'left'
                },
                {
                    field: 'time', title: '记录时间',width: 200, templet: function (d) {
                        return util.toDateString(d.time*1000);
                    }, align: 'left'
                },
                {title: '支付测试',toolbar: '#land_demo', align: 'left',width:120},
                {field: 'land_lx', title: '轮询', templet: '#userTblx', width: 120},
                {title: '操作', toolbar: '#tbBasicTbBar', align: 'left',minWidth:190}
            ]]
        });

        /* 表格搜索 */
        form.on('submit(tbBasicTbSearch)', function (data) {
            insTb.reload({where: data.field, page: {curr: 1}});
            return false;
        });

        /* 表格工具条点击事件 */
        table.on('tool(tbBasicTable)', function (obj) {
            var data = obj.data; // 获得当前行数据
            if (obj.event === 'edit') { // 修改
                edit_land(obj)
            } else if (obj.event === 'del') { // 删除账号
                del_land(obj)
            } else if (obj.event === 'pay') { // 测试发起
                pay_demo(obj)
            } 
            dropdown.hideAll();
        });
        
         /* 修改轮询状态 */
        form.on('switch(userTblxCk)', function (obj) {
            var loadIndex = layer.load(2);
            $.get('<?php echo url("land/status_save"); ?>', {
                id: obj.elem.value,
                land_lx: obj.elem.checked ? 1 : 0
            }, function (res) {
                layer.close(loadIndex);
                if (res.code !=0) {
                    layer.msg(res.msg, {icon: 1});
                } else {
                    layer.msg(res.msg, {icon: 2});
                    $(obj.elem).prop('checked', !obj.elem.checked);
                    form.render('checkbox');
                }
            }, 'json');
        });
        
      

        
     
        
        function pay_demo(obj){
            layer.confirm('支付测试仅供测试能否正常发起支付使用,无实际回调作用，知晓请点击【确定】开始测试', {
                shade: .1,
                skin: 'layui-layer-admin'
            }, function (i) {
                    
            var loadIndex = layer.load(2);
            $.post('<?php echo url("land/pay_demo"); ?>', {
                mid: obj.data.mid,
            }, function (res) {
                layer.close(loadIndex);
                if(res.code == 1){
                  layer.msg(res.msg);
                }else{
                  layer.msg('调用失败', {icon: 2});
                }
            }, 'json');
            })
            return false;
        }
        
        
        function edit_land(obj){
            var layIndex = admin.open({
					title: '修改 '+ obj.data.username+' 帐号',
					area: '520px',
					url: '<?php echo url("land/land_edit"); ?>?id='+obj.data.land_id,
					tpl: true,
					success: function (layero, dIndex) {
						// 弹窗超出范围不出现滚动条
						form.render(null,"modelUserForm");
						$(layero).children('.layui-layer-content').css('overflow', 'visible');
						form.on('submit(modelSubmitUser)', function (data) {
					    var loadIndex = layer.load(2);
                            $.post('<?php echo url("land/land_save"); ?>', data.field, function (res) {
                            layer.close(loadIndex);
                            if (0 != res.code) {                                
                                layer.msg(res.msg, {icon: 1});
                                layer.close(dIndex);
                                insTb.reload({page: {curr: 1}});
                            } else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }, 'json');
                        return false;
						});
					}
				});
        }
        
        function del_land(obj){
            layer.confirm('确定要删除账号吗？<span style="color:red">删除账号订单不会删除,可能造成您无法核对订单的情况</span>,已知晓请确认删除!', {
                shade: .1,
                skin: 'layui-layer-admin'
                }, function (i) {
                layer.close(i);
                    layer.load(2);
                    $.get('<?php echo url("land/yc_del_save"); ?>', {
                        id: obj.data.land_id,
                        bug_id:obj.data.id
                
                    }, function (res) {
                        layer.closeAll('loading');
                        if (res.code == 1) {
                            layer.msg(res.msg, {icon: 1});
                            insTb.reload({page: {curr: 1}});
                           
                        } else {
                            layer.msg(res.msg, {icon: 2});
                        }
                    }, 'json');
                
            });
        }
        
    });
</script>
</body>
</html>