<link rel="stylesheet" href="<?php echo base_url();?>public/css/vendor/bootstrap/bootstrap-table.css">
<link rel="stylesheet" href="<?php echo base_url();?>public/css/vendor/bootstrap/table-fix-column.css">

<!--<script src="--><?php //echo base_url();?><!--public/js/vendor/bootstrap/src/bootstrap-table.js"></script>-->
<!--<script src="--><?php //echo base_url();?><!--public/js/vendor/bootstrap/src/table-fix-column.js"></script>-->
<style>
    /* CSS Document */
    .menu {
        margin:0 auto;
        border:1pt solid #999999;
        border-radius:5px;
        -webkit-border-radius: 5px;
        -moz-border-radius: 5px;
    }
    .menu a {
        text-decoration:none;
        height:100%;
        display:block;
        border-radius:5px;
        -webkit-border-radius: 5px;
        -moz-border-radius: 5px; color:#333;
    }
    .menu a:visited {
        text-decoration:none;
        color:#000000;
    }
    .menu a:active {
        text-decoration:none;
    }
    .link-web{
        width:210px;
        height:40px;
        margin:0 auto;
        border-radius:4px;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        /*text-shadow:0 2px 0 #FFF;*/
        font-family: "", "";
        font-size:18px;
    }
    .link-web a{
        text-decoration:none;
        width:210px;
        height:40px;
        display:block;
        border-radius:4px;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        background-color: #F5F5F5;
        border:1px dashed #cccccc;
        color:#333;
    }
    .link-web a:visited{
        text-decoration:none;
        color:#333;
    }
    .link-web a:active{
        text-decoration:none;
        color:#333;
    }
    .font-arial{
        font-family: "微软雅黑", "", Arial, "Arial Black";
    }
    .font-italic{
        font-style:italic;
    }
    .font-blod{
        font-weight:bold;
    }
    .font-app{
        text-align:left;
        font-size:25px;
        color: #666666;
    }
    .font-app-display{
        text-align:left;
        font-size:20px;
        color:#999999;
        text-shadow:0 2px 0 #FFF;
    }
    .font02{
        font-size:18px; color:#999999;
        text-align:left;
    }
    .dp_copy{
        margin-top:10px;
        text-align:center;
        color:#919090;
        font-size:22px;
    }
</style>
</head>
<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>好友查询(7天内活跃用户)</header>
                    <section>

                        <div class="row">
                            <div class="col-sm-12">
                                <form class="form-inline">
                                    <span class="gap"></span>
                                    <div class="form-group">
                                        <label>玩家id：</label>
                                        <input type="text" class="form-control" placeholder="用户UID" name="userid" id="userid" value="<?php echo $uid ?? '';?>">
                                    </div>
                                    <button type="button" class="btn btn-primary" id="SubmitBtn">查询</button>
                                </form>
                            </div>
                        </div>
                        <br>
<!--                        展示-->
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="table-responsive">
                                        <table class="table table-striped table-bordered table-hover"  width="100%" style="word-break:break-all; word-wrap:break-word; ">
                                            <thead>
                                            <tr>
                                                <th>类型</th>
                                                <th>好友列表</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                foreach ($list as $k=>$item){
                                                    echo "<tr><td>{$k}</td><td>{$item}</td></tr>";
                                                }
                                                ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </section>
                </aside>
            </div>
        </div>
    </div>
</div>
<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="row">
                            <div class="col-sm-12">
                                <form class="form-inline" id="addFriend">
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">用户UID</label>
                                        <div class="col-sm-1">
                                            <input type="text" class="form-control" placeholder="uid" name="uid" id="addUid">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-5 control-label">被添加用户UID</label>
                                        <div class="col-sm-1">
                                            <input type="text" class="form-control" placeholder="toUid" name="toUid">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class=" col-sm-12">
                                            <button type="button" class="btn btn-primary" id="SubmitBtn2">确定</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>
</div>
<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="row">
                            <div class="col-sm-12">
                                <form class="form-inline" id="delFriend">
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">用户UID</label>
                                        <div class="col-sm-1">
                                            <input type="text" class="form-control" placeholder="uid" name="uid" id="delUid">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-5 control-label">被删除用户UID</label>
                                        <div class="col-sm-1">
                                            <input type="text" class="form-control" placeholder="toUid" name="toUid">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class=" col-sm-12">
                                            <button type="button" class="btn btn-primary" id="SubmitBtn3">确定</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>
</div>
<script>


    $('#SubmitBtn').click(function(){
        var userId = $('#userid').val();
        var url = rootPath+"#customer/souchFriend/"+userId;
        window.location.href = url
    });

    $('#SubmitBtn2').click(function(){
        var datas = $('#addFriend').serializeArray();
        console.log(datas);
        $.post('/customer/addFriendApi', datas, function(res){
            if(typeof res == 'string')res = JSON.parse(res)
            console.log(res);
            if(res.ret == 0){
                alert("添加成功");
                // var url = rootPath+"#customer/souchFriend/"+res.data.uid;
                // window.location.href = url
                history.go(0)
            }else{
                alert(res.msg);
            }
        })
    })
    $('#SubmitBtn3').click(function(){
        var datas = $('#delFriend').serializeArray();
        // console.log(datas);
        $.post('/customer/delFriendApi', datas, function(res){
            if(typeof res == 'string')res = JSON.parse(res);
            console.log(res);
            if(res.ret == 0){
                alert("删除成功");
                // var url = rootPath+"#customer/souchFriend/"+res.data.uid;
                // window.location.href = url
                // window.location.Reload()
                history.go(0)
            }else{
                alert(res.msg);
            }
        })
    })
</script>