admin %!s(int64=7) %!d(string=hai) anos
pai
achega
5096f108e1

+ 0 - 1
app/Components/Helpers.php

@@ -141,7 +141,6 @@ class Helpers
         $log->content = $content;
         $log->status = $status;
         $log->error = $error;
-        $log->created_at = date('Y-m-d H:i:s');
 
         return $log->save();
     }

+ 0 - 1
app/Components/ServerChan.php

@@ -52,7 +52,6 @@ class ServerChan
         $log->content = $content;
         $log->status = $status;
         $log->error = $error;
-        $log->created_at = date('Y-m-d H:i:s');
 
         return $log->save();
     }

+ 1 - 1
app/Console/Commands/upgradeUserSpeedLimit.php

@@ -28,7 +28,7 @@ class upgradeUserSpeedLimit extends Command
             ];
 
             User::query()->where('id', $user->id)->update($data);
-            Log::info('---用户[ID:' . $user->id . ' - ' . $user->username . ']的限速字段值被重置为10M---');
+            Log::info('---用户[ID:' . $user->id . ' - ' . $user->username . ']的限速字段值被重置为10G---');
         }
 
         Log::info('----------------------------【重置用户限速字段】结束----------------------------');

+ 13 - 16
app/Http/Controllers/AdminController.php

@@ -2353,22 +2353,16 @@ EOF;
     public function userOnlineIPList(Request $request)
     {
         $username = trim($request->get('username'));
-        $status = $request->get('status');
         $port = intval($request->get('port'));
         $wechat = trim($request->get('wechat'));
         $qq = trim($request->get('qq'));
-        $enable = intval($request->get('enable'));
 
-        $query = User::query();
+        $query = User::query()->where('status', '>=', 0)->where('enable', 1);
 
         if ($username) {
             $query->where('username', 'like', '%' . $username . '%');
         }
 
-        if ($status != '') {
-            $query->where('status', intval($status));
-        }
-
         if (!empty($wechat)) {
             $query->where('wechat', 'like', '%' . $wechat . '%');
         }
@@ -2377,19 +2371,15 @@ EOF;
             $query->where('qq', 'like', '%' . $qq . '%');
         }
 
-        if (!empty($port)) {
-            $query->where('port', intval($port));
-        }
-
-        if ($enable != '') {
-            $query->where('enable', intval($enable));
+        if ($port) {
+            $query->where('port', $port);
         }
 
         $userList = $query->paginate(15)->appends($request->except('page'));
         if (!$userList->isEmpty()) {
             foreach ($userList as &$user) {
-                // 最近10条在线IP记录,如果后端设置为60秒上报一次,则为10分钟内的在线IP
-                $user->onlineIPList = SsNodeIp::query()->with(['node', 'user'])->where('type', 'tcp')->where('port', $user->port)->where('created_at', '>=', strtotime("-10 minutes"))->orderBy('id', 'desc')->limit(10)->get();
+                // 最近5条在线IP记录,如果后端设置为60秒上报一次,则为10分钟内的在线IP
+                $user->onlineIPList = SsNodeIp::query()->with(['node'])->where('type', 'tcp')->where('port', $user->port)->where('created_at', '>=', strtotime("-10 minutes"))->orderBy('id', 'desc')->limit(5)->get();
             }
         }
 
@@ -2502,11 +2492,12 @@ EOF;
         $username = trim($request->get('username'));
         $port = intval($request->get('port'));
         $nodeId = intval($request->get('nodeId'));
+        $userId = intval($request->get('id'));
 
         $query = SsNodeIp::query()->with(['node', 'user'])->where('type', 'tcp')->where('created_at', '>=', strtotime("-120 seconds"));
 
         if ($ip) {
-            $query->where('ip', 'like', '%' . $ip . '%');
+            $query->where('ip', $ip);
         }
 
         if ($username) {
@@ -2527,6 +2518,12 @@ EOF;
             });
         }
 
+        if ($userId) {
+            $query->whereHas('user', function ($q) use ($userId) {
+                $q->where('id', $userId);
+            });
+        }
+
         $list = $query->groupBy('port')->orderBy('id', 'desc')->paginate(20)->appends($request->except('page'));
 
         foreach ($list as $vo) {

+ 0 - 1
app/Http/Models/EmailLog.php

@@ -16,6 +16,5 @@ class EmailLog extends Model
 {
     protected $table = 'email_log';
     protected $primaryKey = 'id';
-    public $timestamps = false;
 
 }

+ 10 - 10
resources/views/admin/config.blade.php

@@ -36,8 +36,8 @@
                                         <button class="btn sbold blue" data-toggle="modal" data-target="#add_config_modal"> 新增 <i class="fa fa-plus"></i> </button>
                                     </div>
                                 </div>
-                                <div class="table-scrollable">
-                                    <table class="table table-striped table-bordered table-hover table-checkable order-column">
+                                <div class="table-scrollable table-scrollable-borderless">
+                                    <table class="table table-hover table-light table-checkable">
                                         <thead>
                                             <tr>
                                                 <th style="width: 50%;"> 名称 </th>
@@ -74,8 +74,8 @@
                                         <button class="btn sbold blue" data-toggle="modal" data-target="#add_config_modal"> 新增 <i class="fa fa-plus"></i> </button>
                                     </div>
                                 </div>
-                                <div class="table-scrollable">
-                                    <table class="table table-striped table-bordered table-hover table-checkable order-column">
+                                <div class="table-scrollable table-scrollable-borderless">
+                                    <table class="table table-hover table-light table-checkable">
                                         <thead>
                                             <tr>
                                                 <th style="width: 50%;"> 名称 </th>
@@ -112,8 +112,8 @@
                                         <button class="btn sbold blue" data-toggle="modal" data-target="#add_config_modal"> 新增 <i class="fa fa-plus"></i> </button>
                                     </div>
                                 </div>
-                                <div class="table-scrollable">
-                                    <table class="table table-striped table-bordered table-hover table-checkable order-column">
+                                <div class="table-scrollable table-scrollable-borderless">
+                                    <table class="table table-hover table-light table-checkable">
                                         <thead>
                                         <tr>
                                             <th style="width: 50%;"> 名称 </th>
@@ -150,8 +150,8 @@
                                         <button class="btn sbold blue" data-toggle="modal" data-target="#add_level_modal"> 新增 <i class="fa fa-plus"></i> </button>
                                     </div>
                                 </div>
-                                <div class="table-scrollable">
-                                    <table class="table table-striped table-bordered table-hover table-checkable order-column">
+                                <div class="table-scrollable table-scrollable-borderless">
+                                    <table class="table table-hover table-light table-checkable">
                                         <thead>
                                             <tr>
                                                 <th style="width: 35%;"> 等级 </th>
@@ -188,8 +188,8 @@
                                         <button class="btn sbold blue" data-toggle="modal" data-target="#add_country_modal"> 新增 <i class="fa fa-plus"></i> </button>
                                     </div>
                                 </div>
-                                <div class="table-scrollable">
-                                    <table class="table table-striped table-bordered table-hover table-checkable order-column">
+                                <div class="table-scrollable table-scrollable-borderless">
+                                    <table class="table table-hover table-light table-checkable">
                                         <thead>
                                             <tr>
                                                 <th style="width: 20%;"> 图标 </th>

+ 6 - 2
resources/views/admin/onlineIPMonitor.blade.php

@@ -23,6 +23,9 @@
                     </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="id" value="{{Request::get('id')}}" id="id" placeholder="用户ID" 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="ip" value="{{Request::get('ip')}}" id="ip" placeholder="IP" onkeydown="if(event.keyCode==13){doSearch();}">
                             </div>
@@ -71,7 +74,7 @@
                                                 <td>{{$vo->type}}</td>
                                                 <td>{{$vo->node ? $vo->node->name : '【节点已删除】'}}</td>
                                                 <td>{{$vo->user ? $vo->user->username : '【用户已删除】'}}</td>
-                                                <td>{{$vo->ip}}</td>
+                                                <td><a href="https://www.ipip.net/ip/{{$vo->ip}}.html" target="_blank">{{$vo->ip}}</a></td>
                                                 <td>{{$vo->ipInfo}}</td>
                                             </tr>
                                         @endforeach
@@ -103,12 +106,13 @@
     <script type="text/javascript">
         // 搜索
         function doSearch() {
+            var id = $("#id").val();
             var ip = $("#ip").val();
             var username = $("#username").val();
             var port = $("#port").val();
             var nodeId = $("#nodeId option:checked").val();
 
-            window.location.href = '{{url('admin/onlineIPMonitor')}}' + '?ip=' + ip + '&username=' + username + '&port=' + port + '&nodeId=' + nodeId;
+            window.location.href = '{{url('admin/onlineIPMonitor')}}' + '?id=' + id + '&ip=' + ip + '&username=' + username + '&port=' + port + '&nodeId=' + nodeId;
         }
 
         // 重置

+ 8 - 1
resources/views/admin/userList.blade.php

@@ -158,6 +158,9 @@
                                                             <li>
                                                                 <a href="javascript:doMonitor('{{$user->id}}');"> 流量概况 </a>
                                                             </li>
+                                                            <li>
+                                                                <a href="javascript:ipMonitor('{{$user->id}}');"> 在线巡查 </a>
+                                                            </li>
                                                             <li>
                                                                 <a href="javascript:resetTraffic('{{$user->id}}');"> 流量清零 </a>
                                                             </li>
@@ -223,7 +226,7 @@
 
         // 编辑账号
         function editUser(id) {
-            window.location.href = '{{url('admin/editUser?id=')}}' + id + '&page=' + '{{Request::get('page', 1)}}';
+            window.location.href = '{{url('admin/editUser?id=')}}' + id;
         }
 
         // 删除账号
@@ -270,6 +273,10 @@
             window.location.href = '{{url('admin/userMonitor?id=')}}' + id;
         }
 
+        function ipMonitor(id) {
+            window.location.href = '{{url('admin/onlineIPMonitor?id=')}}' + id;
+        }
+
         // 重置流量
         function resetTraffic(id) {
             layer.confirm('确定重置该用户流量吗?', {icon: 7, title:'警告'}, function(index) {

+ 3 - 20
resources/views/admin/userOnlineIPList.blade.php

@@ -35,21 +35,6 @@
                             <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="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>
@@ -70,7 +55,7 @@
                                 <tbody>
                                     @if ($userList->isEmpty())
                                         <tr>
-                                            <td colspan="13" style="text-align: center;">暂无数据</td>
+                                            <td colspan="5" style="text-align: center;">暂无数据</td>
                                         </tr>
                                     @else
                                         @foreach ($userList as $user)
@@ -111,7 +96,7 @@
                                                                     <td>{{$vo->created_at}}</td>
                                                                     <td>{{$vo->node ? $vo->node->name : '【节点已删除】'}}</td>
                                                                     <td>{{$vo->type}}</td>
-                                                                    <td>{{$vo->ip}}</td>
+                                                                    <td><a href="https://www.ipip.net/ip/{{$vo->ip}}.html" target="_blank">{{$vo->ip}}</a></td>
                                                                 </tr>
                                                             @endforeach
                                                             </tbody>
@@ -152,10 +137,8 @@
             var wechat = $("#wechat").val();
             var qq = $("#qq").val();
             var port = $("#port").val();
-            var status = $("#status option:checked").val();
-            var enable = $("#enable option:checked").val();
 
-            window.location.href = '{{url('admin/userOnlineIPList')}}' + '?username=' + username + '&wechat=' + wechat + '&qq=' + qq + '&port=' + port + '&status=' + status + '&enable=' + enable;
+            window.location.href = '{{url('admin/userOnlineIPList')}}' + '?username=' + username + '&wechat=' + wechat + '&qq=' + qq + '&port=' + port;
         }
 
         // 重置

+ 18 - 16
sql/db.sql

@@ -65,8 +65,8 @@ CREATE TABLE `ss_node` (
   `v2_host` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'V2ray伪装的域名',
   `v2_path` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'V2ray WS/H2路径',
   `v2_tls` TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'V2ray底层传输安全 0 未开启 1 开启',
-  `created_at` DATETIME NOT NULL,
-  `updated_at` DATETIME NOT NULL,
+  `created_at` datetime NOT NULL,
+  `updated_at` datetime NOT NULL,
   PRIMARY KEY (`id`),
   INDEX `idx_group` (`group_id`),
 	INDEX `idx_sub` (`is_subscribe`)
@@ -132,8 +132,8 @@ CREATE TABLE `user` (
   `protocol_param` varchar(255) DEFAULT '' COMMENT '协议参数',
   `obfs` varchar(30) NOT NULL DEFAULT 'plain' COMMENT '混淆',
   `obfs_param` varchar(255) DEFAULT '' COMMENT '混淆参数',
-  `speed_limit_per_con` bigint(20) NOT NULL DEFAULT '10737418240' COMMENT '单连接限速,默认10M,为0表示不限速,单位Byte',
-  `speed_limit_per_user` bigint(20) NOT NULL DEFAULT '10737418240' COMMENT '单用户限速,默认10M,为0表示不限速,单位Byte',
+  `speed_limit_per_con` bigint(20) NOT NULL DEFAULT '10737418240' COMMENT '单连接限速,默认10G,为0表示不限速,单位Byte',
+  `speed_limit_per_user` bigint(20) NOT NULL DEFAULT '10737418240' COMMENT '单用户限速,默认10G,为0表示不限速,单位Byte',
   `gender` tinyint(4) NOT NULL DEFAULT '1' COMMENT '性别:0-女、1-男',
   `wechat` varchar(30) DEFAULT '' COMMENT '微信',
   `qq` varchar(20) DEFAULT '' COMMENT 'QQ',
@@ -648,14 +648,14 @@ CREATE TABLE `user_balance_log` (
 -- Table structure for `user_traffic_modify_log`
 -- ----------------------------
 CREATE TABLE `user_traffic_modify_log` (
-	`id` INT(11) NOT NULL AUTO_INCREMENT,
-	`user_id` INT(11) NOT NULL DEFAULT '0' COMMENT '用户ID',
-	`order_id` INT(11) NOT NULL DEFAULT '0' COMMENT '发生的订单ID',
-	`before` BIGINT(20) NOT NULL DEFAULT '0' COMMENT '操作前流量',
-	`after` BIGINT(20) NOT NULL DEFAULT '0' COMMENT '操作后流量',
-	`desc` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '描述',
-	`created_at` DATETIME NOT NULL,
-	`updated_at` DATETIME NOT NULL,
+	`id` int(11) NOT NULL AUTO_INCREMENT,
+	`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户ID',
+	`order_id` int(11) NOT NULL DEFAULT '0' COMMENT '发生的订单ID',
+	`before` bigint(20) NOT NULL DEFAULT '0' COMMENT '操作前流量',
+	`after` bigint(20) NOT NULL DEFAULT '0' COMMENT '操作后流量',
+	`desc` varchar(255) NOT NULL DEFAULT '' COMMENT '描述',
+	`created_at` datetime NOT NULL,
+	`updated_at` datetime NOT NULL,
 	PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户流量变动日志';
 
@@ -706,6 +706,7 @@ CREATE TABLE `email_log` (
   `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-发送成功、2-发送失败',
   `error` text COMMENT '发送失败抛出的异常信息',
   `created_at` datetime DEFAULT NULL COMMENT '创建时间',
+  `updated_at` datetime DEFAULT NULL COMMENT '最后更新时间',
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='邮件投递记录';
 
@@ -839,6 +840,7 @@ INSERT INTO `sensitive_words` (`words`) VALUES ('newairmail.com');
 INSERT INTO `sensitive_words` (`words`) VALUES ('temp-mail.org');
 INSERT INTO `sensitive_words` (`words`) VALUES ('linshiyouxiang.net');
 INSERT INTO `sensitive_words` (`words`) VALUES ('zwoho.com');
+INSERT INTO `sensitive_words` (`words`) VALUES ('mailboxy.fun');
 
 
 -- ----------------------------
@@ -1119,8 +1121,8 @@ CREATE TABLE `marketing` (
   `content` TEXT NOT NULL COMMENT '内容' COLLATE 'utf8mb4_unicode_ci',
   `error` VARCHAR(255) NULL COMMENT '错误信息' COLLATE 'utf8mb4_unicode_ci',
   `status` TINYINT(4) NOT NULL COMMENT '状态:-1-失败、0-待发送、1-成功',
-  `created_at` DATETIME NOT NULL,
-  `updated_at` DATETIME NOT NULL,
+  `created_at` datetime NOT NULL,
+  `updated_at` datetime NOT NULL,
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='营销';
 
@@ -1138,8 +1140,8 @@ CREATE TABLE `user_login_log` (
 	`county` CHAR(20) NOT NULL,
 	`isp` CHAR(20) NOT NULL,
 	`area` CHAR(20) NOT NULL,
-	`created_at` DATETIME NOT NULL,
-	`updated_at` DATETIME NOT NULL,
+	`created_at` datetime NOT NULL,
+	`updated_at` datetime NOT NULL,
 	PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户登录日志';
 

+ 2 - 2
sql/update/20190213.sql

@@ -1,7 +1,7 @@
 -- 适配vnet,修正限速字段,默认限速为10M
 ALTER TABLE `user`
-	CHANGE COLUMN `speed_limit_per_con` `speed_limit_per_con` BIGINT NOT NULL DEFAULT '10737418240' COMMENT '单连接限速,默认10M,为0表示不限速,单位Byte' AFTER `obfs_param`,
-	CHANGE COLUMN `speed_limit_per_user` `speed_limit_per_user` BIGINT NOT NULL DEFAULT '10737418240' COMMENT '单用户限速,默认10M,为0表示不限速,单位Byte' AFTER `speed_limit_per_con`;
+	CHANGE COLUMN `speed_limit_per_con` `speed_limit_per_con` BIGINT NOT NULL DEFAULT '10737418240' COMMENT '单连接限速,默认10G,为0表示不限速,单位Byte' AFTER `obfs_param`,
+	CHANGE COLUMN `speed_limit_per_user` `speed_limit_per_user` BIGINT NOT NULL DEFAULT '10737418240' COMMENT '单用户限速,默认10G,为0表示不限速,单位Byte' AFTER `speed_limit_per_con`;
 
 
 -- 优化数据库,防止暴库

+ 3 - 0
sql/update/20190215.sql

@@ -0,0 +1,3 @@
+-- 邮件投递记录增加最后更新字段
+ALTER TABLE `email_log`
+	ADD COLUMN `updated_at` DATETIME NULL DEFAULT NULL COMMENT '最后更新时间' AFTER `created_at`;