@extends('base.base')
@section('base')
    <style>
        /* 移动端优化样式 */
        @media screen and (max-width: 991px) {
            /* 让卡片内的表格可以横向滚动 */
            .card-body {
                overflow-x: auto !important;
                -webkit-overflow-scrolling: touch !important;
            }

            /* 表格基础样式 */
            .table-bordered {
                font-size: 0.75rem !important;
                margin-bottom: 1rem !important;
                min-width: 600px; /* 确保表格有最小宽度才能滚动 */
            }

            .table-bordered td,
            .table-bordered th {
                white-space: nowrap !important;
                padding: 0.4rem 0.5rem !important;
                vertical-align: middle !important;
            }

            /* 固定第一列 */
            .table-bordered td:first-child,
            .table-bordered th:first-child {
                position: sticky;
                left: auto;
                background: #fff;
                z-index: 2;
                box-shadow: 2px 0 5px rgba(0,0,0,0.05);
            }

            .table-bordered thead th:first-child {
                z-index: 3;
                background: #f8f9fa;
            }

            /* 处理使用float的单元格内容 */
            .table-bordered td > div[style*="float"] {
                display: inline-block;
                float: left;
                margin-right: 0.5rem;
            }

            /* 清除浮动 */
            .table-bordered td > div::after {
                content: "";
                display: table;
                clear: both;
            }
        }

        @media screen and (max-width: 576px) {
            .table-bordered {
                font-size: 0.7rem !important;
            }

            .table-bordered td,
            .table-bordered th {
                padding: 0.3rem 0.4rem !important;
            }
        }
    </style>

    <style>
        /* 移动端优化样式 */
        @media screen and (max-width: 991px) {
            /* 卡片内容区域可横向滚动 */
            .card-body {
                overflow-x: auto !important;
                -webkit-overflow-scrolling: touch !important;
            }

            /* 表格基础样式 */
            .table-bordered {
                font-size: 0.75rem !important;
                margin-bottom: 1rem !important;
                width: max-content !important;
                min-width: 100% !important;
            }

            .table-bordered td,
            .table-bordered th {
                white-space: nowrap !important;
                padding: 0.5rem !important;
                vertical-align: middle !important;
            }

            /* 嵌套表格样式 */
            .nested-table {
                width: 100%;
                margin: 0;
            }

            .nested-table td {
                padding: 0.3rem !important;
                font-size: 0.7rem !important;
                border: none !important;
            }

            .nested-table .label-row td {
                font-weight: 500;
                color: #666;
            }

            .nested-table .value-row td {
                font-weight: 600;
                color: #000;
            }
        }
    </style>

    <style>
        /* 移动端优化样式 */
        @media screen and (max-width: 991px) {
            /* 卡片内容区域可横向滚动 */
            .card-body {
                overflow-x: auto !important;
                -webkit-overflow-scrolling: touch !important;
            }

            /* 表格基础样式 */
            .table-bordered {
                font-size: 0.75rem !important;
                margin-bottom: 1rem !important;
                width: max-content !important;
                min-width: 100% !important;
            }

            .table-bordered td,
            .table-bordered th {
                white-space: nowrap !important;
                padding: 0.5rem !important;
                vertical-align: middle !important;
            }

            /* 嵌套表格样式 */
            .nested-table {
                width: 100%;
                margin: 0;
            }

            .nested-table td {
                padding: 0.3rem !important;
                font-size: 0.7rem !important;
                border: none !important;
            }

            .nested-table .label-row td {
                font-weight: 500;
                color: #666;
            }

            .nested-table .value-row td {
                font-weight: 600;
                color: #000;
            }
        }
    </style>

    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="page-header">
                <h3 class="page-title">
                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
                        <i class="mdi mdi-settings"></i>
                    </span>
                    {{ __('auto.游戏概括') }}
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">{{ __('auto.实时数据') }}</a></li>
                        <li class="breadcrumb-item active" aria-current="page">{{ __('auto.游戏概括') }}</li>
                    </ol>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card" style=";margin:10px 0;padding:0">
                    <div class="card">
                        <div class="card-body">

                            <table class="table table-bordered">

                                <tr>
                                    <th><a href="/admin/withdrawal/waitWithdrawal">{{ __('auto.待处理茶叶') }}</a>
                                    </th>

                                    <th>{{ __('auto.申请：') }}
                                        {{$applyUserCount->userCount ?? 0}} {{ __('auto.人') }} {{$applyUserCount->count ?? 0}}
                                        {{ __('auto.笔') }}&nbsp;&nbsp;{{ __('auto.总计：') }}{{$applyUserCount->WithDraw ?? 0}} &nbsp;&nbsp;
                                    </th>


                                    <th><a href="/admin/complaint/opinion"> 24{{ __('auto.小时内客服') }}</a>
                                    </th>


                                    <th>{{ __('auto.未回复总计：') }}{{$message->count}}{{ __('auto.条') }} {{ __('auto.已回复：') }}{{$message->replycount}}{{ __('auto.条') }}
                                        {{ __('auto.已读：') }}{{$message->readcount}}{{ __('auto.条') }}
                                    </th>

                                </tr>


                            </table>


                            <table class="table table-bordered">
                                <tbody>
                                @foreach($alldata['plays'] as $item)
                                    <tr>
                                        <td><a href="{{$item['url']}}" target="_blank">{{$item['name']}}</a></td>
                                        <td>{{ $item['package'] ?? '' }}</td>
                                        <td>
                                            @if($item['status']==200)
                                                <span class="text-success">{{ __('auto.运行中') }}</span>

                                            @else
                                                <span class="text-danger">{{ __('auto.下架') }}</span>


                                            @endif


                                        </td>
                                        <td>
                                            @if(isset($item['downtime']))
                                                ({{ __('auto.下架时间') }}:<?php echo date("m-d H:i",$item['downtime'])?>)
                                            @elseif(isset($item['uptime']))
                                                ({{ __('auto.上架时间') }}:<?php echo date("m-d H:i",$item['uptime'])?>)
                                            @endif

                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>

                            <table class="table table-bordered">
                                <tbody>
                                @foreach($dataGropSums as $channel=>$item)
                                    @if (isset($alldata[$channel])&&$data=$alldata[$channel])
                                    <tr>
                                        <td width="20%"><span class="card-title">{{$Channels[$channel]}}({{$channel}})</span></td>
                                        <td width="12%">{{ __('auto.新增：') }}&nbsp;{{$data['today_register']}}<span style="font-size:0.7em;color:<?php echo intval($data['new_rhb'])>=0?"green":"red" ?>">({{$data['new_rhb']}})</span></td>
                                        <td width="10%">d0：&nbsp;{{$data['d0_day_pay_count']}}<span style="font-size:0.7em;color:<?php echo intval($data['d0_day_pay_rhb'])>=0?"green":"red" ?>">({{$data['d0_day_pay_rhb']}})</span></td>
                                        <td width="21%">{{ __('auto.充值：') }}&nbsp;{{$data['today_pay_sum']}}<span style="font-size:0.7em;color:<?php echo intval($data['pay_sum_rhb'])>=0?"green":"red" ?>">({{$data['pay_sum_rhb']}})</span>(U:{{$data['today_pay_sum_u']}})</td>
                                        <td width="22%">{{ __('auto.付费人数/新增：') }}&nbsp;{{$data['today_pay_count']}}/{{$data['day_pay_count']}}</td>
                                        <td width="15%">{{ __('auto.日活：') }}&nbsp;{{$data['today_live']}}</td>
                                    </tr>

                                    @endif
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                @foreach($adminChannels as $channel)
                    @if (isset($alldata[$channel])&&$data=$alldata[$channel])

                        <div class="col-lg-12 grid-margin stretch-card" id="short_{{$channel}}"
                             style="display: block;margin:0;padding:0" onclick="openBoard({{$channel}})">
                            <div class="card" style=";margin:0;padding:0">
                                <div class="card-body" style=";margin:0;padding:0 10px">

                                    <table
                                           class="table table-bordered">
                                        <tr>
                                        <td width="20%"><span class="card-title">({{$channel}}){{$Channels[$channel]??$channel}}</span></td>
                                        <td width="12%">{{ __('auto.新增：') }}&nbsp;{{$data['today_register']}}<span style="font-size:0.7em;color:<?php echo intval($data['new_rhb'])>=0?"green":"red" ?>">({{$data['new_rhb']}})</span></td>
                                        <td width="10%">d0：&nbsp;{{$data['d0_day_pay_count']}}<span style="font-size:0.7em;color:<?php echo intval($data['d0_day_pay_rhb'])>=0?"green":"red" ?>">({{$data['d0_day_pay_rhb']}})</span></td>
                                        <td width="21%">{{ __('auto.充值：') }}&nbsp;{{$data['today_pay_sum']}}<span style="font-size:0.7em;color:<?php echo intval($data['pay_sum_rhb'])>=0?"green":"red" ?>">({{$data['pay_sum_rhb']}})</span></td>
                                        <td width="22%">{{ __('auto.付费人数/新增：') }}&nbsp;{{$data['today_pay_count']}}/{{$data['day_pay_count']}}</td>
                                        <td width="15%">{{ __('auto.日活：') }}&nbsp;{{$data['today_live']}}</td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-12 grid-margin stretch-card" id="expend_{{$channel}}"
                             style="display: none;margin:10px 0;padding:0" onclick="closeBoard({{$channel}})">
                            <div class="card">
                                <div class="card-body">
                                    <h4 class="card-title">({{$channel}}){{$Channels[$channel]??$channel}}</h4>
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <th width="23%">{{ __('auto.新增用户') }}</th>
                                            <th width="23%">{{ __('auto.参游比') }}</th>
                                            <th width="18%">{{ __('auto.日活跃用户') }}</th>
                                            <th width="18%">{{ __('auto.周活跃用户') }}</th>
                                            <th width="18%">{{ __('auto.月活跃用户') }}</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr>
                                            <td width="23%">
                                                <table class="nested-table table-sm table-borderless">
                                                    <tr class="label-row">
                                                        <td width="33%">{{ __('auto.今日新增') }}</td>
                                                        <td width="33%">{{ __('auto.即时日环比') }}</td>
                                                        <td width="34%">{{ __('auto.昨日总新增') }}</td>
                                                    </tr>
                                                    <tr class="value-row">
                                                        <td>{{$data['today_register']}}</td>
                                                        <td>{{$data['new_rhb']}}</td>
                                                        <td>{{$data['yesterday_register']}}</td>
                                                    </tr>
                                                </table>
                                            </td>
                                            <td width="23%">
                                                <table class="nested-table table-sm table-borderless">
                                                    <tr class="label-row">
                                                        <td width="33%">{{ __('auto.今日参游') }}</td>
                                                        <td width="33%">{{ __('auto.日对比') }}</td>
                                                        <td width="34%">{{ __('auto.昨日参游') }}</td>
                                                    </tr>
                                                    <tr class="value-row">
                                                        <td>{{$data['today_play_rate']}}%</td>
                                                        <td>{{$data['play_rhb']}}</td>
                                                        <td>{{$data['yesterday_play_rate']}}%</td>
                                                    </tr>
                                                </table>
                                            </td>
                                            <td width="18%">
                                                <table class="nested-table table-sm table-borderless">
                                                    <tr class="label-row">
                                                        <td width="50%">{{ __('auto.本日') }}</td>
                                                        <td width="50%">{{ __('auto.日环比') }}</td>
                                                    </tr>
                                                    <tr class="value-row">
                                                        <td>{{$data['today_live']}}</td>
                                                        <td>{{$data['live_rhb']}}</td>
                                                    </tr>
                                                </table>
                                            </td>
                                            <td width="18%">
                                                <table class="nested-table table-sm table-borderless">
                                                    <tr class="label-row">
                                                        <td width="50%">{{ __('auto.本周') }}</td>
                                                        <td width="50%">{{ __('auto.周环比') }}</td>
                                                    </tr>
                                                    <tr class="value-row">
                                                        <td>{{$data['week_login']}}</td>
                                                        <td>{{$data['week_rhb']}}</td>
                                                    </tr>
                                                </table>
                                            </td>
                                            <td width="18%">
                                                <table class="nested-table table-sm table-borderless">
                                                    <tr class="label-row">
                                                        <td width="50%">{{ __('auto.本月') }}</td>
                                                        <td width="50%">{{ __('auto.月环比') }}</td>
                                                    </tr>
                                                    <tr class="value-row">
                                                        <td>{{$data['month_login']}}</td>
                                                        <td>{{$data['month_rhb']}}</td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                    <table>
                                        <div align="center" style=" padding: 10px;">{{ __('auto.总注册用户：') }}{{$data['user_count']}}，{{ __('auto.休眠用户：') }}{{$data['dormancy_user']}}</div>
                                    </table>
                                    @if (hidden() != 'service')
                                        <table class="table table-bordered">
                                            <thead>
                                            <tr>
                                                <th width="22%">{{ __('auto.充值金额') }}</th>
                                                <th width="21%">{{ __('auto.付费人数') }}</th>
                                                <th width="21%">d0{{ __('auto.付费人数') }}</th>
                                                <th width="21%">{{ __('auto.新增付费人数') }}</th>
                                                <th width="15%">ltv</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr>
                                                <td width="22%">
                                                    <table class="nested-table table-sm table-borderless">
                                                        <tr class="label-row">
                                                            <td width="33%">{{ __('auto.今日充值') }}</td>
                                                            <td width="33%">{{ __('auto.即时环比') }}</td>
                                                            <td width="34%">{{ __('auto.昨日总额') }}</td>
                                                        </tr>
                                                        <tr class="value-row">
                                                            <td>{{$data['today_pay_sum']}}</td>
                                                            <td>{{$data['pay_sum_rhb']}}</td>
                                                            <td>{{$data['yesterday_pay_sum']}}</td>
                                                        </tr>
                                                    </table>
                                                </td>
                                                <td width="21%">
                                                    <table class="nested-table table-sm table-borderless">
                                                        <tr class="label-row">
                                                            <td width="33%">{{ __('auto.本日') }}</td>
                                                            <td width="33%">{{ __('auto.即时环比') }}</td>
                                                            <td width="34%">{{ __('auto.昨日总数') }}</td>
                                                        </tr>
                                                        <tr class="value-row">
                                                            <td>{{$data['today_pay_count']}}</td>
                                                            <td>{{$data['pay_count_rhb']}}</td>
                                                            <td>{{$data['yesterday_pay_count']}}</td>
                                                        </tr>
                                                    </table>
                                                </td>
                                                <td width="21%">
                                                    <table class="nested-table table-sm table-borderless">
                                                        <tr class="label-row">
                                                            <td width="33%">d0</td>
                                                            <td width="33%">{{ __('auto.即时环比') }}</td>
                                                            <td width="34%">{{ __('auto.昨日') }}d0</td>
                                                        </tr>
                                                        <tr class="value-row">
                                                            <td>{{$data['d0_day_pay_count']}}</td>
                                                            <td>{{$data['d0_day_pay_rhb']}}</td>
                                                            <td>{{$data['d0_yday_pay_count']}}</td>
                                                        </tr>
                                                    </table>
                                                </td>
                                                <td width="21%">
                                                    <table class="nested-table table-sm table-borderless">
                                                        <tr class="label-row">
                                                            <td width="33%">{{ __('auto.本日') }}</td>
                                                            <td width="33%">{{ __('auto.即时环比') }}</td>
                                                            <td width="34%">{{ __('auto.昨日总新') }}</td>
                                                        </tr>
                                                        <tr class="value-row">
                                                            <td>{{$data['day_pay_count']}}</td>
                                                            <td>{{$data['day_pay_rhb']}}</td>
                                                            <td>{{$data['yday_pay_count']}}</td>
                                                        </tr>
                                                    </table>
                                                </td>

                                                <td width="15%">
                                                    <table class="nested-table table-sm table-borderless">
                                                        <tr class="label-row">
                                                            <td width="50%">d0_ltv</td>
                                                            <td width="50%">{{ __('auto.昨日') }}ltv</td>
                                                        </tr>
                                                        <tr class="value-row">
                                                            <td>{{$data['d0_day_pay']['ltv_now']}}</td>
                                                            <td>{{$data['yes_day_pay']['ltv_now']}}</td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                        <table>
                                            <div align="center">
                                                <a style="width: 20%" href="/admin/recharge/rank?start_time={{$alldata['time']}}&end_time={{$alldata['time']}}&Channel={{$channel}}" class="btn btn-sm btn-gradient-info btn-icon-text">{{ __('auto.今日充值排行榜') }}</a>
                                                <a style="width: 20%" href="/admin/recharge/list?&Channel={{$channel}}" class="btn btn-sm btn-gradient-info btn-icon-text">{{ __('auto.各档位充值明细') }}</a>
                                            </div>

                                        </table>
                                    @endif

                                </div>
                            </div>
                        </div>
                    @endif
                @endforeach


            </div>
        </div>
    </div>
    <script>
        function openBoard(channel){
            $('#expend_'+channel).show();
            $('#short_'+channel).hide();
        }

        function closeBoard(channel){
            $('#expend_'+channel).hide();
            $('#short_'+channel).show();
        }
        $(function(){
            cutStr(50);
        });
        // function update(id){
        //     myConfirm("是否继续?",function(){
        //         var nullity= document.getElementById('nullity').value;
        //         myRequest("/admin/user/freeze/"+id,"post",{nullity:nullity},function(res){
        //             layer.msg(res.msg)
        //             setTimeout(function(){
        //                 window.location.reload();
        //             },1500)
        //         });
        //     });
        // }
            setInterval(function (){
            window.location.reload();
        },300000)

    </script>
@endsection
