<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>

<div class="content_wrapper">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>查询</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#statistics/propertyStatistics" name="stanpform">
                                        <input type="hidden" value="1" name="payuserpost"/>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>开始时间</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($stime) echo $stime;?>" placeholder="开始时间" name="payuserindex_stime" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>结束时间</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($etime) echo $etime;?>" placeholder="结束时间" name="payuserindex_etime" />
                                        </div>
                                        <button type="submit" class="btn btn-primary">查询</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>金币统计</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>体力统计</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container2" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>登录时长统计</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container5" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>盾牌统计</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container3" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>星星统计</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container4" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>
</div>
</div>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/highcharts.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/exporting.js"></script>
<script type="text/javascript">

    Highcharts.chart('container', {
        chart: {
            type: 'line'
        },
        title: {
            text: '金币统计'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php foreach ($add as $key=>$row){ echo '"'.$key.'",';}?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name:'增量',
                data:[<?php foreach ($add as $key=>$row){ echo empty($row['money'])?'0,':$row['money'].',';}?>]
            },
            {
                name:'减量',
                data:[<?php foreach ($low as $key=>$row){ echo empty($row['money'])?'0,':$row['money'].',';}?>]
            }
        ]
    });

    Highcharts.chart('container2', {
        chart: {
            type: 'line'
        },
        title: {
            text: '体力&转动统计'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php foreach ($add as $key=>$row){ echo '"'.$key.'",';}?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        series: [
            {
                name:'体力发放',
                data:[<?php foreach ($add as $key=>$row){ echo empty($row['spins'])?'0,':$row['spins'].',';}?>]
            },
            {
                name:'体力消耗',
                data:[<?php foreach ($low as $key=>$row){ echo empty($row['spins'])?'0,':$row['spins'].',';}?>]
            },{
                name:'老虎机转动次数',
                data:[<?php foreach ($add as $key=>$row){ echo empty($row['slotCount'])?'0,':$row['slotCount'].',';}?>]
            },{
                name:'人均转动次数',
                data:[<?php foreach ($add as $key=>$row){ echo empty($row['slotCount']) || empty($total[$key])?'0,':ceil($row['slotCount']/$total[$key]).',';}?>]
            },{
                name:'人均体力消耗',
                data:[<?php foreach ($low as $key=>$row){ echo empty($row['spins']) || empty($total[$key])?'0,':ceil($row['spins']/$total[$key]).',';}?>]
            },{
                name:'人均体力发放',
                data:[<?php foreach ($add as $key=>$row){ echo empty($row['spins']) || empty($total[$key])?'0,':ceil($row['spins']/$total[$key]).',';}?>]
            },{
                name:'平均bet',
                data:[<?php foreach ($low as $key=>$row){ 
                	if(empty($row['spins']) || empty($add[$key]['slotCount'])){
                		echo "0,";
                	}else{
                		echo round($row['spins']/$add[$key]['slotCount'],2).',';
                	}
                }?>]
            }
        ]
    });

    Highcharts.chart('container3', {
        chart: {
            type: 'line'
        },
        title: {
            text: '盾牌统计'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php foreach ($add as $key=>$row){ echo '"'.$key.'",';}?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name:'增量',
                data:[<?php foreach ($add as $key=>$row){ echo empty($row['shield'])?'0,':$row['shield'].',';}?>]
            },
            {
                name:'减量',
                data:[<?php foreach ($low as $key=>$row){ echo empty($row['shield'])?'0,':$row['shield'].',';}?>]
            }
        ]
    });

    Highcharts.chart('container4', {
        chart: {
            type: 'line'
        },
        title: {
            text: '星星统计'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php foreach ($add as $key=>$row){ echo '"'.$key.'",';}?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name:'增量',
                data:[<?php foreach ($add as $key=>$row){ echo empty($row['star'])?'0,':$row['star'].',';}?>]
            },
            {
                name:'减量',
                data:[<?php foreach ($low as $key=>$row){ echo empty($row['star'])?'0,':$row['star'].',';}?>]
            }
        ]
    });

    Highcharts.chart('container5', {
        chart: {
            type: 'line'
        },
        title: {
            text: '时长统计'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php foreach ($time as $key=>$row){ echo '"'.$key.'",';}?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name:'总时长',
                data:[<?php foreach ($time as $key=>$row){ echo empty($row)?'0,':$row.',';}?>]
            },
            {
                name:'人均',
                data:[<?php foreach ($time as $key=>$row){ echo empty($row) || empty($total[$key])?'0,':ceil($row/$total[$key]).',';}?>]
            },
            {
                name:'VIVO总时长',
                data:[<?php foreach ($vivo_logintime as $key=>$row){ echo empty($row)?'0,':$row.',';}?>]
            },
            {
                name:'VIVO人均',
                data:[<?php foreach ($vivo_logintime as $key=>$row){ echo empty($row) || empty($vivo_total[$key])?'0,':ceil($row/$vivo_total[$key]).',';}?>]
            }
        ]
    });


</script>
<script type="text/javascript">
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });
</script>