Repository navigation
Expand file tree
/
Copy pathuserList.blade.php
More file actions
308 lines (292 loc) · 17.6 KB
/
Copy pathuserList.blade.php
File metadata and controls
308 lines (292 loc) · 17.6 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
@extends('admin.layouts')
@section('css')
<link href="/assets/global/plugins/datatables/datatables.min.css" rel="stylesheet" type="text/css" />
<link href="/assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.css" rel="stylesheet" type="text/css" />
<style type="text/css">
input,select {
margin-bottom: 5px;
}
</style>
@endsection
@section('content')
<!-- BEGIN CONTENT BODY -->
<div class="page-content" style="padding-top:0;">
<!-- BEGIN PAGE BASE CONTENT -->
<div class="row">
<div class="col-md-12">
<!-- BEGIN EXAMPLE TABLE PORTLET-->
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-dark">
<span class="caption-subject bold uppercase"> 用户列表 </span>
</div>
<div class="actions">
<div class="btn-group btn-group-devided">
<button class="btn sbold red" onclick="exportSSJson()"> 导出JSON </button>
<button class="btn sbold blue" onclick="batchAddUsers()"> 批量生成 </button>
<button class="btn sbold blue" onclick="addUser()"> 添加用户 </button>
</div>
</div>
</div>
<div class="portlet-body">
<div class="row">
<div class="col-md-3 col-sm-4 col-xs-12">
<input type="text" class="col-md-4 col-sm-4 col-xs-12 form-control" name="username" value="{{Request::get('username')}}" id="username" placeholder="用户名" onkeydown="if(event.keyCode==13){doSearch();}">
</div>
<div class="col-md-3 col-sm-4 col-xs-12">
<input type="text" class="col-md-4 col-sm-4 col-xs-12 form-control" name="wechat" value="{{Request::get('wechat')}}" id="wechat" placeholder="微信" onkeydown="if(event.keyCode==13){doSearch();}">
</div>
<div class="col-md-3 col-sm-4 col-xs-12">
<input type="text" class="col-md-4 col-sm-4 col-xs-12 form-control" name="qq" value="{{Request::get('qq')}}" id="qq" placeholder="QQ" onkeydown="if(event.keyCode==13){doSearch();}">
</div>
<div class="col-md-3 col-sm-4 col-xs-12">
<input type="text" class="col-md-4 form-control" name="port" value="{{Request::get('port')}}" id="port" placeholder="端口" onkeydown="if(event.keyCode==13){doSearch();}">
</div>
<div class="col-md-3 col-sm-4 col-xs-12">
<select class="form-control" name="pay_way" id="pay_way" onChange="doSearch()">
<option value="" @if(Request::get('pay_way') == '') selected @endif>付费方式</option>
<option value="0" @if(Request::get('pay_way') == '0') selected @endif>免费</option>
<option value="1" @if(Request::get('pay_way') == '1') selected @endif>月付</option>
<option value="2" @if(Request::get('pay_way') == '2') selected @endif>季付</option>
<option value="3" @if(Request::get('pay_way') == '3') selected @endif>半年付</option>
<option value="4" @if(Request::get('pay_way') == '4') selected @endif>年付</option>
</select>
</div>
<div class="col-md-3 col-sm-4 col-xs-12">
<select class="form-control" name="status" id="status" onChange="doSearch()">
<option value="" @if(Request::get('status') == '') selected @endif>账号状态</option>
<option value="-1" @if(Request::get('status') == '-1') selected @endif>禁用</option>
<option value="0" @if(Request::get('status') == '0') selected @endif>未激活</option>
<option value="1" @if(Request::get('status') == '1') selected @endif>正常</option>
</select>
</div>
<div class="col-md-3 col-sm-4 col-xs-12">
<select class="form-control" name="enable" id="enable" onChange="doSearch()">
<option value="" @if(Request::get('enable') == '') selected @endif>代理状态</option>
<option value="1" @if(Request::get('enable') == '1') selected @endif>启用</option>
<option value="0" @if(Request::get('enable') == '0') selected @endif>禁用</option>
</select>
</div>
<div class="col-md-3 col-sm-4 col-xs-12">
<button type="button" class="btn blue" onclick="doSearch();">查询</button>
<button type="button" class="btn grey" onclick="doReset();">重置</button>
</div>
</div>
<div class="table-scrollable table-scrollable-borderless">
<table class="table table-hover table-light">
<thead>
<tr>
<th> # </th>
<th> 用户名 </th>
<th> 端口 </th>
<th> 加密方式 </th>
<!--<th> 协议 </th>
<th> 混淆 </th>-->
<th> 已消耗 </th>
<th> 最后使用 </th>
<th> 有效期 </th>
<th> 状态 </th>
<th> 代理 </th>
<th> 操作 </th>
</tr>
</thead>
<tbody>
@if ($userList->isEmpty())
<tr>
<td colspan="12" style="text-align: center;">暂无数据</td>
</tr>
@else
@foreach ($userList as $user)
<tr class="odd gradeX {{$user->trafficWarning ? 'danger' : ''}}">
<td> {{$user->id}} </td>
<td> {{$user->username}} </td>
<td> <span class="label label-danger"> {{$user->port ? $user->port : '未分配'}} </span> </td>
<td> <span class="label label-default"> {{$user->method}} </span> </td>
<!--<td> <span class="label label-default"> {{$user->protocol}} </span> </td>
<td> <span class="label label-default"> {{$user->obfs}} </span> </td>-->
<td class="center"> {{$user->used_flow}} / {{$user->transfer_enable}} </td>
<td class="center"> {{empty($user->t) ? '未使用' : date('Y-m-d H:i:s', $user->t)}} </td>
<td class="center">
@if ($user->expireWarning == '-1')
<span class="label label-danger"> {{$user->expire_time}} </span>
@elseif ($user->expireWarning == '0')
<span class="label label-warning"> {{$user->expire_time}} </span>
@elseif ($user->expireWarning == '1')
<span class="label label-default"> {{$user->expire_time}} </span>
@else
{{$user->expire_time}}
@endif
</td>
<td>
@if ($user->status > 0)
<span class="label label-info">正常</span>
@elseif ($user->status < 0)
<span class="label label-danger">禁用</span>
@else
<span class="label label-default">未激活</span>
@endif
</td>
<td>
@if ($user->enable)
<span class="label label-info">启用</span>
@else
<span class="label label-danger">禁用</span>
@endif
</td>
<td>
<div class="btn-group">
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="javascript:;" aria-expanded="false"> 操作
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<a href="javascript:editUser('{{$user->id}}');"> 编辑 </a>
</li>
<li>
<a href="javascript:delUser('{{$user->id}}');"> 删除 </a>
</li>
<li>
<a href="javascript:doExport('{{$user->id}}');"> 配置信息 </a>
</li>
<li>
<a href="javascript:doMonitor('{{$user->id}}');"> 流量概况 </a>
</li>
<li>
<a href="javascript:resetTraffic('{{$user->id}}');"> 流量清零 </a>
</li>
<li>
<a href="javascript:switchToUser('{{$user->id}}');"> 切换身份 </a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
<div class="row">
<div class="col-md-4 col-sm-4">
<div class="dataTables_info" role="status" aria-live="polite">共 {{$userList->total()}} 个账号</div>
</div>
<div class="col-md-8 col-sm-8">
<div class="dataTables_paginate paging_bootstrap_full_number pull-right">
{{ $userList->links() }}
</div>
</div>
</div>
</div>
</div>
<!-- END EXAMPLE TABLE PORTLET-->
</div>
</div>
<!-- END PAGE BASE CONTENT -->
</div>
<!-- END CONTENT BODY -->
@endsection
@section('script')
<script type="text/javascript">
// 导出原版json配置
function exportSSJson() {
layer.msg("成功导出原版SS的用户配置信息,加密方式为系统默认的加密方式");
window.location.href = '{{url('admin/exportSSJson')}}';
}
// 批量生成账号
function batchAddUsers() {
layer.confirm('将自动生成5个账号,确定继续吗?', {icon: 3, title:'警告'}, function(index) {
$.post("{{url('admin/batchAddUsers')}}", {_token:'{{csrf_token()}}'}, function(ret) {
layer.msg(ret.message, {time:1000}, function() {
if (ret.status == 'success') {
window.location.reload();
}
});
});
layer.close(index);
});
}
// 添加账号
function addUser() {
window.location.href = '{{url('admin/addUser')}}';
}
// 编辑账号
function editUser(id) {
window.location.href = '{{url('admin/editUser?id=')}}' + id + '&page=' + '{{Request::get('page', 1)}}';
}
// 删除账号
function delUser(id) {
layer.confirm('确定删除账号?', {icon: 2, title:'警告'}, function(index) {
$.post("{{url('admin/delUser')}}", {id:id, _token:'{{csrf_token()}}'}, function(ret) {
layer.msg(ret.message, {time:1000}, function() {
if (ret.status == 'success') {
window.location.reload();
}
});
});
layer.close(index);
});
}
// 搜索
function doSearch() {
var username = $("#username").val();
var wechat = $("#wechat").val();
var qq = $("#qq").val();
var port = $("#port").val();
var pay_way = $("#pay_way option:checked").val();
var status = $("#status option:checked").val();
var enable = $("#enable option:checked").val();
window.location.href = '{{url('admin/userList')}}' + '?username=' + username + '&wechat=' + wechat + '&qq=' + qq + '&port=' + port + '&pay_way=' + pay_way + '&status=' + status + '&enable=' + enable;
}
// 重置
function doReset() {
window.location.href = '{{url('admin/userList')}}';
}
// 导出配置
function doExport(id) {
window.location.href = '{{url('admin/export?id=')}}' + id;
}
// 流量监控
function doMonitor(id) {
window.location.href = '{{url('admin/userMonitor?id=')}}' + id;
}
// 重置流量
function resetTraffic(id) {
layer.confirm('确定重置该用户流量吗?', {icon: 7, title:'警告'}, function(index) {
$.post("{{url('admin/resetUserTraffic')}}", {_token:'{{csrf_token()}}', id:id}, function (ret) {
layer.msg(ret.message, {time:1000}, function() {
if (ret.status == 'success') {
window.location.reload();
}
});
});
layer.close(index);
});
}
// 切换用户身份
function switchToUser(user_id) {
$.ajax({
'url': "{{url("/admin/switchToUser")}}",
'data': {
'user_id': user_id,
'_token': '{{csrf_token()}}'
},
'dataType': "json",
'type': "POST",
success: function (ret) {
layer.msg(ret.message, {time: 1000}, function () {
if (ret.status == 'success') {
window.location.href = "/";
}
});
}
});
}
// 修正table的dropdown
$('.table-scrollable').on('show.bs.dropdown', function () {
$('.table-scrollable').css( "overflow", "inherit" );
});
$('.table-scrollable').on('hide.bs.dropdown', function () {
$('.table-scrollable').css( "overflow", "auto" );
});
</script>
@endsection