<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">

<head>
    <meta charset="UTF-8">
    <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">
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title id="title">{{ config('app.name', 'Laravel') }}</title>
    <link rel="stylesheet" href="{{ asset('frame/layui/css/layui.css') }}">
    <link rel="stylesheet" href="{{ asset('/frame/static/css/style.css') }}">
    {{--	<!-- <link rel="icon" href="{{ asset('/favicon.icon') }}"> -->--}}
    <style>
        .my-tab ul.layui-tab-title {
            display: none;
        }

        .layui-layout-admin .layui-side {
            width: 200px;
        }

        .layui-side-scroll {
            width: 200px;
        }

        .layui-nav-tree .layui-nav-more {
            right: 30px;
        }

        .center {
            text-align: center;
        }

        .center > span {
            display: inline-block;
            padding: 0px 10px;
        }

        .layui-tab-card > .layui-tab-title .layui-this {
            background-color: #009688;
            color: whitesmoke;
        }

        .postion .layui-badge {
            margin: 0px;
            top: 10%;
            right: 0;
        }

        .postion .layui-nav-item a {
            padding: 0px 15px;
        }

        .topMeun .layui-nav-item a {
            padding: 0px 10px;
        }

        .layui-table-body {
            position: relative;
            overflow: hidden;
            margin-right: -1px;
        }

        html .skin-2 .my-header,
        html .skin-2 .layui-nav,
        html .skin-2 .layui-nav-child {
            background-color: #17a1d8;
        }
    </style>
</head>

<body>

<div class="layui-layout layui-layout-admin">
    <!-- header -->
    <div class="layui-header my-header">
        <a href="/">
            <!--<img class="my-header-logo" src="" alt="logo">-->
            <div class="my-header-logo" id="webName"></div>
        </a>
        <div class="my-header-btn">
            <button class="layui-btn layui-btn-small btn-nav">
                <i class="layui-icon">&#xe65f;</i>
            </button>
        </div>

        <!-- 顶部左侧添加选项卡监听 -->
        <ul class="layui-nav topMeun" lay-filter="side-top-left" style="padding-right: 0px;">

            <!--<li class="layui-nav-item"><a href="javascript:;" href-url="demo/btn.html"><i class="layui-icon">&#xe621;</i>按钮</a></li>
    <li class="layui-nav-item">
        <a href="javascript:;"><i class="layui-icon">&#xe621;</i>基础</a>
        <dl class="layui-nav-child">
            <dd><a href="javascript:;" href-url="demo/btn.html"><i class="layui-icon">&#xe621;</i>按钮</a></dd>
            <dd><a href="javascript:;" href-url="demo/form.html"><i class="layui-icon">&#xe621;</i>表单</a></dd>
        </dl>
    </li>-->
        </ul>
        <!--
                <ul class="layui-nav my-header-user-nav postion" lay-filter="side-top-middle" layui-element-append='2' style="padding-right: 0px;">

                    <li class="layui-nav-item" >
                        <a href="javascript:;" href-url="">开元棋牌余额
                            <span class="layui-badge">0</span>
                        </a>
                    </li>
                </ul> -->

        <ul class="layui-nav my-header-user-nav postion" lay-filter="side-top-right" layui-element-append='2'
            style="padding-right: 0px;">
            <!-- <li class="layui-nav-item">
                <a href="javascript:clearCache();">
                <i class="layui-icon" id="clearCache" >&#xe621;</i>更新缓存</a>
            </li>
 -->            <!-- <li class="layui-nav-item" >
                <a href="javascript:;" href-url="demo/btn.html">控制台
                    <span class="layui-badge">0</span>
                </a>
            </li> -->
            <!-- <li class="layui-nav-item refresh">
                <a href="javascript:updateNum();" id="reflash" >刷新
                    <i class="layui-icon">&#x1002;</i>
                </a>
            </li> -->

            <li class="layui-nav-item">
                <a class="name" href="javascript:;">
                    <i class="layui-icon">&#xe629;</i>主题</a>
                <dl class="layui-nav-child">
                    <dd data-skin="0">
                        <a href="javascript:;">默认</a>
                    </dd>
                    <dd data-skin="1">
                        <a href="javascript:;">纯白</a>
                    </dd>
                    <dd data-skin="2">
                        <a href="javascript:;">蓝白</a>
                    </dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a class="name" href="/">
                    {{ session('adminInfo.admin_name') }} </a>
            </li>
            <li class="layui-nav-item">
                <!-- <a class="name" href="/admin/login/logout">退出</a> -->
            </li>

        </ul>


    </div>
    <!-- side -->
    <div class="layui-side my-side">
        <div class="layui-side-scroll">
            <!-- 左侧主菜单添加选项卡监听 -->
            <ul class="layui-nav layui-nav-tree" lay-filter="side-main">

            </ul>

        </div>
    </div>
    <!-- body -->
    <div class="layui-body my-body">
        <div class="layui-tab layui-tab-card my-tab" lay-filter="card" lay-allowClose="true">
            <ul class="layui-tab-title">
                <li class="layui-this" lay-id="1">
						<span>
							<i class="layui-icon">&#xe638;</i>欢迎页</span>
                </li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <iframe id="iframe" src="/admin/index/welcome" name="iframe" frameborder="0"></iframe>
                </div>
            </div>
        </div>
    </div>
    <!-- footer -->
    <div class="layui-footer my-footer">
        <div class="center">
            <span class="server"></span>
            <span class="current"></span>
        </div>
    </div>
</div>


<!-- 右键菜单 -->
<div class="my-dblclick-box none">
    <table class="layui-tab dblclick-tab">
        <tr class="card-refresh">
            <td>
                <i class="layui-icon">&#x1002;</i>刷新当前标签
            </td>
        </tr>
        <tr class="card-close">
            <td>
                <i class="layui-icon">&#x1006;</i>关闭当前标签
            </td>
        </tr>
        <tr class="card-close-all">
            <td>
                <i class="layui-icon">&#x1006;</i>关闭所有标签
            </td>
        </tr>
    </table>
</div>

<script type="text/javascript" src="/frame/layui/layui.js"></script>
<script type="text/javascript" src="/frame/static/js/vip_comm.js"></script>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/music.js"></script>
<script type="text/javascript">
    function tabRefresh() {
        $('.layui-show iframe').attr('src', $('.layui-show iframe').attr('src'));
    }

    function setNotifyNum(index, num) {

        try {
            $('*[lay-filter=side-top-right] > li:eq(' + index + ') > a span.layui-badge').remove();
        } catch (ex) {
        }

        try {
            if (num > 0) {
                $('*[lay-filter=side-top-right] > li:eq(' + index + ') > a').append('<span class=layui-badge>' + num + '</span>');
            }
        } catch (ex) {
        }

        try {
            $('*[lay-filter=side-top-middle] > li:eq(' + index + ') > a span.layui-badge').remove();
        } catch (ex) {
        }

        try {
            if (num > 0) {
                $('*[lay-filter=side-top-middle] > li:eq(' + index + ') > a').append('<span class=layui-badge>' + num + '</span>');
            }
        } catch (ex) {
        }
    }

    let li = '', liarr = {};
    setTimeout(function () {
        li = document.querySelectorAll('*[lay-filter=side-top-right] > li>a')
        for (let i = 0; i < li.length; i++) {
            if (li[i].attributes[1].value !== "javascript:;" && li[i].attributes[1].value !== "iframe") {
                liarr[li[i].attributes[1].value.trim()] = i
            } else {
                liarr[li[i].attributes[0].value.trim()] = i
            }
        }
    }, 4000)

    function updateNum() {
        $.ajax({
            type: 'get',
            url: '/admin/money/getNum',
            data: {},
            async: false,
            dataType: 'json',
            success: function (json) {
                var val = json.data;
                // if (liarr['/admin/rgame/egamerecord?type=3'] != 'undefined')
                //     setNotifyNum(liarr['/admin/rgame/egamerecord?type=3'], val.back);
                if (liarr['/admin/remittance/index?status=0'] != 'undefined')
                    setNotifyNum(liarr['/admin/remittance/index?status=0'], val.rimit);
                if (liarr['/admin/take/index'] != 'undefined')
                    setNotifyNum(liarr['/admin/take/index'], val.take);
                if (liarr['/admin/lottery_money_log/index'] != 'undefined')
                    setNotifyNum(liarr['/admin/lottery_money_log/index'], val.lotteryMoney);
                if (liarr['/admin/uservip/index'] != 'undefined')
                    setNotifyNum(liarr['/admin/uservip/index'], val.vip);
                // if (liarr['/admin/agent/approval'] != 'undefined')
                //     setNotifyNum(liarr['/admin/agent/approval'], val.agent);
                // if (liarr['/admin/Index/welcome'] != 'undefined')
                //     setNotifyNum(liarr['/admin/Index/welcome'], val.msg);

                if (val.rimit > 0) {
                    if (val.rimit != music.numCount.recharge) {
                        playMusic('recharge');
                    }

                }
                music.numCount.recharge = val.rimit;
                if (val.take > 0) {
                    if (val.take != music.numCount.take) {
                        playMusic('take');
                    }

                }
                music.numCount.take = val.take;
            }
        });
    }

    setInterval(function () {
        updateNum();
    }, 5000);

    // function updatem() {
    //     $.ajax({
    //         type: 'get',
    //         url: '/admin/Allowip/getC',
    //         data: {},
    //         async: false,
    //         dataType: 'json',
    //         success: function (json) {
    //             var val = json.data;
    //             if (liarr['/admin/RgameCash/kygameInfo'] != 'undefined')
    //                 setNotifyNum(liarr['/admin/RgameCash/kygameInfo'], val.agent_money);
    //         }
    //     });
    // }

    setInterval(function () {
        updatem();
    }, 10000);

    $(document).ready(function () {

    });
    let current='',serverS=''
    layui.use(['layer', 'vip_nav', 'vip_tab'], function () {
        // 操作对象
        var layer = layui.layer
            , vipNav = layui.vip_nav
            , vipTab = layui.vip_tab
            , $ = layui.jquery;

        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });

        // 顶部左侧菜单生成 [请求地址,过滤ID,是否展开,携带参数]
        vipNav.top_left('/admin/menu/top', 'side-top-left', false);

        // 主体菜单生成 [请求地址,过滤ID,是否展开,携带参数]
        vipNav.main('/admin/menu/left', 'side-main', false);

        vipNav.quick('/admin/menu/quick', 'side-top-right', false);

        function addTab(title, url) {
            vipTab.add($(this), title, url);
        }
        //得到标准时区的时间的函数
        function currentTime(url, pos) {
            $.ajax({
                type: 'get',
                url: url,
                data: {},
                dataType: 'json',
                success: function (json) {
                    //console.log(json)
                    var server = json.data.time;
                    var ps = server.split(" ");
                    var pd = ps[0].split("-");
                    var pt = ps.length > 1 ? ps[1].split(":") : [0, 0, 0];
                    var nx = new Date(pd[0], pd[1] - 1, pd[2], pt[0], pt[1], pt[2]);
//                    var nx = new Date(server)
                    var len = nx.getTime();
                    //本地时间与GMT时间的时间偏移差
                    var offset = nx.getTimezoneOffset() * 60000;

                   clearInterval(current)

                    current=setInterval(function () {
                        //得到现在的格林尼治时间
                        var utcTime = len + offset;
                        var n = new Date(utcTime + 3600000 * 8).toISOString().slice(0, 19);
                        var d = n.replace("T", " ");
                        // var n = new Date(utcTime + 3600000 * 8);
                        $('.current').html(pos + '：' + d);
                        len += 1000;

                    }, 1000);
                }
            });
        }

         function serverTime( url, pos) {
                    $.ajax({
                        type: 'get',
                        url: url,
                        data: {},
                        dataType: 'json',
                        success: function (json) {
                            //console.log(json)
                            var server = json.data.time;
                            var ps = server.split(" ");
                            var pd = ps[0].split("-");
                            var pt = ps.length > 1 ? ps[1].split(":") : [0, 0, 0];
                            var nx = new Date(pd[0], pd[1] - 1, pd[2], pt[0], pt[1], pt[2]);
        //                    var nx = new Date(server)
                            var len = nx.getTime();
                            //本地时间与GMT时间的时间偏移差
                            var offset = nx.getTimezoneOffset() * 60000;

                           clearInterval(serverS)

                            serverS=setInterval(function () {
                                //得到现在的格林尼治时间
                                var utcTime = len + offset;
                                var n = new Date(utcTime + 3600000 * 8).toISOString().slice(0, 19);
                                var d = n.replace("T", " ");
                                // var n = new Date(utcTime + 3600000 * 8);
                                $('.server').html(pos + '：' + d);
                                len += 1000;

                            }, 1000);
                        }
                    });
                }

        currentTime('/admin/index/pullTime', '前台服务器时间');
         serverTime('/admin/index/getTime', '后台服务器时间');
        setInterval(()=>{
            currentTime( '/admin/index/pullTime', '前台服务器时间')
            serverTime( '/admin/index/getTime', '后台服务器时间')
        }, 300000);

    });

   function clearCache() {

        $.ajax({
            type: 'get',
            url: '/admin/BaseSet/clearCache',
            data: {},
            dataType: 'json',
            success: function (e) {
                alert(e.msg);
            }
        });
    }
    window.onload = function () {
        updateNum();
    };
    window.onload = function () {
        updatem();
    };
    $.ajax({
        url: '/admin/baseSet/getWebTitle',
        dataType: 'json',
        success: function (data) {
            $('#title').text(data.data.infocontent + '管理系统');
            $('#webName').text(data.data.infocontent + '管理系统');
        }
    });

</script>

<!-- <audio class="name" id="bgm" src="" preload="metadata" autoplay ></audio> -->
{{--	<!-- <audio class="name" id="agent" src="{{ URL::asset('audio/agent.mp3')}}" preload="metadata"></audio>--}}
{{--<audio class="name" id="save" src="{{ URL::asset('audio/save.mp3')}}" preload="metadata"></audio> -->--}}
<style>
    .layui-born-system {
        float: inherit;
        right: -70px;
    }
</style>
</body>

</html>