Skip to content

Commit b874903

Browse files
committed
日常开发
1 parent af10d38 commit b874903

9 files changed

Lines changed: 46 additions & 58 deletions

File tree

app/Console/Commands/AutoBanUserJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function handle()
3333
{
3434
// 封禁24小时内流量异常账号
3535
if (self::$config['is_traffic_ban']) {
36-
$userList = User::query()->where('enable', 1)->get();
36+
$userList = User::query()->where('status', '>=', 0)->where('enable', 1)->get();
3737
foreach ($userList as $user) {
3838
$time = date('Y-m-d H:i:s', time() - 24 * 60 * 60);
3939
$totalTraffic = UserTrafficHourly::query()->where('user_id', $user->id)->where('node_id', 0)->where('created_at', '>=', $time)->sum('total');

app/Console/Commands/AutoReopenUserJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct()
2020
public function handle()
2121
{
2222
// 解封账号
23-
$userList = User::query()->where('ban_time', '>', 0)->get();
23+
$userList = User::query()->where('status', '>=', 0)->where('ban_time', '>', 0)->get();
2424
foreach ($userList as $user) {
2525
if ($user->ban_time < time()) {
2626
User::query()->where('id', $user->id)->update(['enable' => 1, 'ban_time' => 0]);

app/Http/Controllers/AdminController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,8 @@ public function nodeMonitor(Request $request)
541541
$view['trafficDaily'] = SsNodeTrafficDaily::query()->where('node_id', $node_id)->whereBetween('created_at', [$daily_start_time, $daily_end_time])->get();
542542

543543
// 24小时内流量
544-
$hourly_start_time = date('Y-m-d 00:00:00');
545-
$hourly_end_time = date('Y-m-d 23:59:59', strtotime("-1 hour"));
544+
$hourly_start_time = date('Y-m-d H:i:s', strtotime("-24 hours"));
545+
$hourly_end_time = date('Y-m-d H:i:s', strtotime("-1 hour"));
546546
$view['trafficHourly'] = SsNodeTrafficHourly::query()->where('node_id', $node_id)->whereBetween('created_at', [$hourly_start_time, $hourly_end_time])->get();
547547

548548
$view['node'] = $node;

app/Http/Controllers/SubscribeController.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ public function index(Request $request, $code)
6464
$nodeList = SsNode::query()->whereIn('id', $node_ids)->get();
6565
$scheme = self::$config['subscribe_max'] > 0 ? 'MAX=' . self::$config['subscribe_max'] . "\n" : '';
6666
foreach ($nodeList as $node) {
67-
$obfs_param = $user->obfs_param ? $this->base64url_encode($user->obfs_param) : '';
68-
$protocol_param = $user->protocol_param ? $this->base64url_encode($user->protocol_param) : '';
67+
$obfs_param = $node->single ? '' : base64_encode($user->obfs_param);
68+
$protocol_param = $node->single ? base64_encode($user->port . ':' . $user->passwd) : base64_encode($user->protocol_param);
6969

7070
// 生成ssr scheme
7171
$ssr_str = '';
72-
$ssr_str .= $node->server . ':' . $user->port;
73-
$ssr_str .= ':' . $user->protocol . ':' . $user->method;
74-
$ssr_str .= ':' . $user->obfs . ':' . $this->base64url_encode($user->passwd);
75-
$ssr_str .= '/?obfsparam=' . $this->base64url_encode($obfs_param);
76-
$ssr_str .= '&protoparam=' . $this->base64url_encode($protocol_param);
77-
$ssr_str .= '&remarks=' . $this->base64url_encode($node->name);
78-
$ssr_str .= '&group=' . $this->base64url_encode('VPN');
72+
$ssr_str .= $node->server . ':' . ($node->single ? $node->single_port : $user->port);
73+
$ssr_str .= ':' . ($node->single ? $node->single_protocol : $user->protocol) . ':' . ($node->single ? $node->single_method : $user->method);
74+
$ssr_str .= ':' . ($node->single ? 'tls1.2_ticket_auth' : $user->obfs) . ':' . base64_encode($user->passwd);
75+
$ssr_str .= '/?obfsparam=' . $obfs_param;
76+
$ssr_str .= '&protoparam=' . $protocol_param;
77+
$ssr_str .= '&remarks=' . base64_encode($node->name);
78+
$ssr_str .= '&group=' . base64_encode('VPN');
7979
$ssr_str = $this->base64url_encode($ssr_str);
8080
$scheme .= 'ssr://' . $ssr_str . "\n";
8181
}

resources/views/admin/groupList.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<i class="fa fa-circle"></i>
1616
</li>
1717
<li>
18-
<a href="{{url('admin/groupList')}}">节点分组列表</a>
18+
<a href="{{url('admin/groupList')}}">节点分组</a>
1919
</li>
2020
</ul>
2121
<!-- END PAGE BREADCRUMB -->
@@ -27,7 +27,7 @@
2727
<div class="portlet-title">
2828
<div class="caption font-dark">
2929
<i class="icon-grid font-dark"></i>
30-
<span class="caption-subject bold uppercase"> 节点分组列表 </span>
30+
<span class="caption-subject bold uppercase"> 节点分组 </span>
3131
</div>
3232
<div class="actions">
3333
<div class="btn-group">

resources/views/admin/layouts.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
<li class="nav-item {{Request::getRequestUri() == '/admin/groupList' ? 'active open' : ''}}">
185185
<a href="{{url('admin/groupList')}}" class="nav-link ">
186186
<i class="icon-grid"></i>
187-
<span class="title">节点分组列表</span>
187+
<span class="title">节点分组</span>
188188
</a>
189189
</li>
190190
</ul>

resources/views/admin/nodeMonitor.blade.php

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,23 @@
3434
<div class="portlet light bordered">
3535
<div class="portlet-title">
3636
<div class="caption">
37-
<span class="caption-subject font-dark sbold uppercase">【{{$node->name}}】</span>
37+
<span class="caption-subject font-dark sbold uppercase">节点流量监控<small>{{$node->name}}</small></span>
3838
</div>
3939
</div>
4040
<div class="portlet-body">
4141
<div class="alert alert-danger">
4242
<button class="close" data-close="alert"></button>
4343
<strong>提示:</strong> 仅统计SSR的流量,如果使用锐速或BBR等加速工具,可能跟VPS管理面板上看到的不一致(通常是VPS管理面板上看到实际消耗流量更多)。
4444
</div>
45+
<div class="note note-info">
46+
<h4>24小时内流量</h4>
47+
<div id="chart" class="chart"> </div>
48+
</div>
49+
<div class="note note-info">
50+
<h4>30天内流量</h4>
51+
<div id="chart2" class="chart"> </div>
52+
</div>
4553

46-
<h4>24小时内流量(未统计本小时)</h4>
47-
<div id="chart1" class="chart"> </div>
48-
49-
<h4>30天内流量(未统计今日)</h4>
50-
<div id="chart2" class="chart"> </div>
5154
</div>
5255
</div>
5356
@endif
@@ -76,27 +79,21 @@
7679
}
7780
7881
function chart() {
79-
if ($('#chart1').size() != 1) {
82+
if ($('#chart').size() != 1) {
8083
return;
8184
}
8285
83-
@if (!empty($traffic))
84-
@foreach ($traffic as $node_id => $node_traffic_list)
85-
{{ 'var node_' . $node_id}} = [
86-
@foreach ($node_traffic_list as $key => $vo)
87-
[{{$key + 1}}, {{$vo->total}}],
88-
@endforeach
89-
];
90-
@endforeach
91-
@endif
92-
93-
var plot = $.plot($("#chart1"), [
94-
@if (!empty($nodeList))
95-
@foreach($nodeList as $node)
96-
{data: {{'node_' . $node->id}}, label: "{{$node->name}}", lines: {lineWidth: 1}, shadowSize: 0},
86+
var chartData = [
87+
@if (!empty($trafficHourly))
88+
@foreach ($trafficHourly as $key => $vo)
89+
[{{$key + 1}}, {{$vo->total}}],
9790
@endforeach
9891
@endif
99-
], {
92+
];
93+
94+
var plot = $.plot($("#chart"), [
95+
{data: chartData, label: "24小时内流量走势", lines: {lineWidth: 1}, shadowSize: 0},
96+
], {
10097
series: {
10198
lines: {
10299
show: true,
@@ -154,7 +151,7 @@ function showTooltip(x, y, contents) {
154151
}
155152
156153
var previousPoint = null;
157-
$("#chart1").bind("plothover", function(event, pos, item) {
154+
$("#chart").bind("plothover", function(event, pos, item) {
158155
$("#x").text(pos.x.toFixed(2));
159156
$("#y").text(pos.y.toFixed(2));
160157

resources/views/user/index.blade.php

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
<div class="row">
4848
<div class="col-md-8">
4949
<div class="alert alert-danger">
50-
<strong>结算比例:</strong> 1表示用100M就结算100M,0.1表示用100M结算10M,5表示用100M结算500M,以此类推,越是优质节点则比例越高。
51-
<button class="btn btn-sm blue" onclick="subscribe()"> 订阅节点 </button>
50+
<strong>结算比例:</strong> 1表示用100M就结算100M,0.1表示用100M结算10M,5表示用100M结算500M,越是优质节点则比例越高。
51+
<button class="btn btn-sm red" onclick="subscribe()"> 订阅节点 </button>
5252
</div>
5353
<div class="row widget-row">
5454
@if(!$nodeList->isEmpty())
@@ -97,7 +97,9 @@
9797
<a href="javascript:;" data-toggle="modal" data-target="#excharge_modal" style="color:#FFF;">兑换</a>
9898
</span>
9999
</p>
100-
<p class="text-muted"> 账号到期:{{date('Y-m-d 0:0:0') > $info['expire_time'] ? '已过期' : $info['expire_time']}} &ensp;&ensp; 最后使用:{{empty($info['t']) ? '从未使用' : date('Y-m-d H:i:s', $info['t'])}}</p>
100+
<p class="text-muted"> 账号到期:{{date('Y-m-d 0:0:0') > $info['expire_time'] ? '已过期' : $info['expire_time']}} </p>
101+
<p class="text-muted"> 最后使用:{{empty($info['t']) ? '从未使用' : date('Y-m-d H:i:s', $info['t'])}} </p>
102+
<p class="text-muted"> 最后登录:{{empty($info['last_login']) ? '未登录' : date('Y-m-d H:i:s', $info['last_login'])}} </p>
101103
<p class="text-muted">
102104
已用流量:{{$info['usedTransfer']}}{{$info['totalTransfer']}}
103105
<div class="progress progress-striped active" style="margin-bottom:0;" title="共有流量{{$info['totalTransfer']}},已用{{$info['usedTransfer']}}">
@@ -106,7 +108,6 @@
106108
</div>
107109
</div>
108110
</p>
109-
<p class="text-muted"> 最后登录:{{empty($info['last_login']) ? '未登录' : date('Y-m-d H:i:s', $info['last_login'])}} </p>
110111
</div>
111112
</div>
112113
<div class="portlet box blue">
@@ -117,20 +118,11 @@
117118
</div>
118119
</div>
119120
<div class="portlet-body">
120-
<div class="row">
121-
<div class="col-md-12">
122-
<ul class="list-group">
123-
@foreach($articleList as $k => $article)
124-
<li class="list-group-item">
125-
<a href="{{url('user/article?id=') . $article->id}}" class="alert-link" target="_blank"> {{$article->title}} </a>
126-
<div class="pull-right">
127-
[{{date('Y/m/d', strtotime($article->created_at))}}]
128-
</div>
129-
</li>
130-
@endforeach
131-
</ul>
132-
</div>
133-
</div>
121+
@foreach($articleList as $k => $article)
122+
<p class="text-muted">
123+
[{{date('m/d', strtotime($article->created_at))}}] <a href="{{url('user/article?id=') . $article->id}}" target="_blank"> {{$article->title}} </a>
124+
</p>
125+
@endforeach
134126
</div>
135127
</div>
136128
</div>

resources/views/user/trafficLog.blade.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
@section('script')
3939
<script src="/assets/global/plugins/flot/jquery.flot.min.js" type="text/javascript"></script>
4040
<script src="/assets/global/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
41-
<script src="/assets/global/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
4241

4342
<script type="text/javascript">
4443
var ChartsFlotcharts = function() {

0 commit comments

Comments
 (0)