comment.php
2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
use yii\helpers\Html;
use backend\widgets\LinkPager;
?>
<div class="col-md-6">
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-dark mb30">
<thead>
<tr>
<th>用户昵称</th>
<th>内容</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($list as $v):?>
<tr>
<td><?php echo $v['name']."(".$v['uid'].")"?></td>
<td>
<?php
if($v['cmd']==5){
echo $v['comment'];
}elseif($v['cmd']==4){
echo '@'.$v['name'].'加入了房间';
}
?>
</td>
<td><?php echo date('Y-m-i H:i:s',$v['create_time'])?></td>
<td><button class="btn btn-danger jinyan" uid="<?php echo $v['uid']?>" name="<?php echo $v['name']?>" room_id="<?php echo $v['room_id']?>">禁言</button></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<!-- table-responsive -->
<?php echo LinkPager::widget(['pagination' => $pagination]);?>
</div>
<!-- col-md-12 -->
</div>
</div>
<script>
$(function(){
//5s自动刷新页面
setInterval(function(){
window.location.reload();
},5000);//1000为1秒钟
//禁言按钮
$('.jinyan').click(function(){
if(confirm('禁言该用户?')){
var uid = $(this).attr('uid');
var room_id = $(this).attr('room_id');
var name = $(this).attr('name');
$.post("/forbidden/create",{uid:uid,name:name,room_id:room_id},function(data){
alert(data.message);
},'json');
}
});
})
</script>