vest.php
5.9 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
use yii\web\View;
$this->title = '管理后台首页';
?>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h5 class="panel-title">导入马甲</h5>
<p>剩余马甲数:<?php echo $imVestNums?></p>
</div>
<div class="panel-body">
<form class="form-inline">
<div class="form-group">
<label class="sr-only" for="offset">offset</label>
<input type="text" class="form-control" id="offset" placeholder="offset">
</div><!-- form-group -->
<div class="form-group">
<label class="sr-only" for="limit">limit</label>
<input type="text" class="form-control" id="limit" placeholder="limit">
</div><!-- form-group -->
<div class="form-group" id="btn_bar">
<button type="button" class="btn btn-primary mr5" id="import">导入</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h5 class="panel-title">查看观看人数</h5>
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-sm-3 control-label">请输入房间号:</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="room_id" name="room_id" >
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-primary mr5" id="search_audi_btn">查询</button>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">观看数:</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="actual_num" disabled>
</div>
<div class="col-sm-1">
+
</div>
<div class="col-sm-2">
<input type="text" class="form-control" id="addup_num">
</div>
<div class="col-sm-1">
*10 =
</div>
<div class="col-sm-2">
<input type="text" class="form-control" id="result_num" disabled>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary" id="modify_addup_btn">修改</button>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">点赞数:</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="like_num">
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary" id="modify_like_btn">修改</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<p>马甲库里总共可用马甲为4902条,如果要全部导入,须分5批导入,每批1000条</p>
<p>offset:导入马甲的起始序号,第一次填0,后面会自动根据导入的批量累加</p>
<p>limit:每批次导入马甲的数量</p>
<p>(ps:不会的不要乱添加,否则后果自负!!!)</p>
</div>
<script>
$(function(){
$('#import').live("click",function(){
var offset = $('#offset').val();
var limit = $('#limit').val();
var loading_html = "<img src='/images/loaders/loader6.gif'>";
var import_html = "<button type='button' class='btn btn-primary mr5' id='import'>导入</button>";
if(limit > 1000){
alert('每次导入条数不得超过1000');return;
}
$("#btn_bar").html(loading_html);
$.get("/system/vest",{offset:offset,limit:limit},function(data){
// alert(stat);return;
if(data.code==200){
$('#offset').val(Number(offset)+Number(limit));
alert('成功导入'+data.data+'条');
}else{
alert('设置失败');
}
$("#btn_bar").html(import_html);
},'json');
});
//查询房间信息
$('#search_audi_btn').live("click",function(){
var room_id = $('#room_id').val();
if(room_id == '')
return;
$.post("/system/getaudnums",{room_id:room_id},function(data){
if(data.code==200){
var values = data.data;
$("#actual_num").val(values.audience);
$("#addup_num").val(values.addup);
$("#result_num").val(Number(values.audience)+Number(values.addup)*10);
$("#like_num").val(values.like);
}
},'json')
});
//修改观看数
$('#modify_addup_btn').live("click",function(){
var room_id = $('#room_id').val();
var addup_num = $('#addup_num').val();
if(room_id == '')
return;
modify_cache(room_id,'addup',addup_num);
});
//修改点赞数
$('#modify_like_btn').live("click",function(){
var room_id = $('#room_id').val();
var like_num = $('#like_num').val();
if(room_id == '')
return;
modify_cache(room_id,'like',like_num);
});
function modify_cache(room_id,cache_key,cache_val) {
$.post("/system/modifycache",{room_id:room_id,cache_key:cache_key,cache_val:cache_val},function(data){
if(data.code==200) {
alert(data.msg);
}else {
alert(data.msg);
}
},'json')
}
});
</script>