index.php 4.84 KB
<?php
use yii\helpers\Html;
use backend\widgets\LinkPager;

?>
<div>
    <p class="lead">
        <span class="mr10">房间号:<?php echo $filter['room_id']?>#<?php echo $room['title']?></span>
        <span>直播状态:<?php echo Yii::$app->params['config']['room_living'][$room['living']]?></span>
    </p>
</div>
<div class="col-md-6">
    <div class="panel panel-default">
        <div class="panel-body">
            <form class="form-inline" method="post" action="/forbidden/create">
                <div>
                    <div class="form-group">
                        <label class="control-label">用户UID:</label>
                        <input class="form-control" name="uid" value="">
                    </div>
                    <div class="form-group">
                        <label class="control-label">用户昵称:</label>
                        <input class="form-control" name="name" value="">
                    </div>
                    <input type="hidden" name="room_id" value="<?php echo $filter['room_id']?>">
                    <button type="submit" class="btn btn-primary mr5">+添加</button>
                </div>
            </form>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-body">
            <form class="form-inline" method="get" >
                <div>
                    <div class="form-group">
                        <label class="control-label">用户UID:</label>
                        <input class="form-control" name="uid" value="<?php echo $filter['uid']?>">
                    </div>
                    <div class="form-group">
                        <label class="control-label">用户昵称:</label>
                        <input class="form-control" name="name" value="<?php echo $filter['name']?>">
                    </div>
                    <input type="hidden" name="room_id" value="<?php echo $filter['room_id']?>">
                    <button type="submit" class="btn btn-primary mr5">查询</button>
                </div>
            </form>
        </div>
    </div>
<!--    <div class="form-group">-->
<!--        <label>-->
<!--            <a href="/live/addmaster" class="btn btn-primary">+ 添加主播</a>-->
<!--        </label>-->
<!--    </div>-->
    <div class="row">
        <div class="col-md-12">
            <div class="table-responsive">
                <table class="table table-dark mb30">
                    <thead>
                    <tr>
                        <th>用户UID</th>
                        <th>用户昵称</th>
                        <th>最后一次发言时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach($list as $v):?>
                        <tr>
                            <td><?php echo $v->uid;?></td>
                            <td><?php echo $v->name;?></td>
                            <td></td>
                            <td>
                                <?php if($v->status==Yii::$app->params['config']['is_forbid_stat']){?>
                                    <a class="btn btn-info set-status" unqid="<?php echo $v->id;?>" stat="<?php echo (1-$v->status);?>">取消禁言</a>
                                <?php }else{?>
                                    <a class="btn btn-danger set-status" unqid="<?php echo $v->id;?>" stat="<?php echo (1-$v->status);?>">禁言</a>
                                <?php }?>
                            </td>
                        </tr>
                    <?php endforeach;?>
                    </tbody>
                </table>
            </div>
            <!-- table-responsive -->
            <?php echo LinkPager::widget(['pagination' => $pagination]);?>
        </div>
        <!-- col-md-12 -->
    </div>
</div>
<div class="col-md-6">
    <iframe height="600px" width="100%" src="/forbidden/getcomments?room_id=<?php echo $filter['room_id']?>">

    </iframe>
</div>
<script type="text/javascript">
    $(function(){
        $('.set-status').click(function(){
            var stat = $(this).attr('stat');
            var obj = $(this);
            $.get("/forbidden/set-status",{id:$(this).attr('unqid'),status:stat},function(data){
//                alert(stat);return;
                if(data.code==200){
                    if(stat==0){
                        obj.html('禁言');
                        obj.attr('stat',1).attr('class','btn btn-danger set-status');
//                        obj.className = "btn btn-info set-status";
                    }
                    if(stat==1){
                        obj.html('取消禁言');
                        obj.attr('stat',0).attr('class','btn btn-info set-status');
                    }
                }else{
                    alert('设置失败');
                }
            },'json');
        });
    });
</script>