Browse Source

chore: clean up unused code in tabler theme

Cat 2 years ago
parent
commit
3b2b388f07

+ 0 - 30
app/routes.php

@@ -194,13 +194,8 @@ return function (SlimApp $app): void {
         $this->post('/detect/log/ajax', App\Controllers\Admin\DetectController::class . ':ajaxLog');
 
         // IP Mange
-        $this->get('/block', App\Controllers\Admin\IpController::class . ':block');
-        $this->get('/unblock', App\Controllers\Admin\IpController::class . ':unblock');
-        $this->post('/unblock', App\Controllers\Admin\IpController::class . ':doUnblock');
         $this->get('/login', App\Controllers\Admin\IpController::class . ':index');
         $this->get('/alive', App\Controllers\Admin\IpController::class . ':alive');
-        $this->post('/block/ajax', App\Controllers\Admin\IpController::class . ':ajaxBlock');
-        $this->post('/unblock/ajax', App\Controllers\Admin\IpController::class . ':ajaxUnblock');
         $this->post('/login/ajax', App\Controllers\Admin\IpController::class . ':ajaxLogin');
         $this->post('/alive/ajax', App\Controllers\Admin\IpController::class . ':ajaxAlive');
 
@@ -236,28 +231,6 @@ return function (SlimApp $app): void {
         $this->get('/detect/ban', App\Controllers\Admin\DetectBanLogController::class . ':index');
         $this->post('/detect/ban/ajax', App\Controllers\Admin\DetectBanLogController::class . ':ajaxLog');
 
-        // 指定用户购买记录以及添加套餐
-        $this->get('/user/{id}/bought', App\Controllers\Admin\UserLog\BoughtLogController::class . ':bought');
-        $this->post('/user/{id}/bought/ajax', App\Controllers\Admin\UserLog\BoughtLogController::class . ':boughtAjax');
-        $this->delete('/user/bought', App\Controllers\Admin\UserLog\BoughtLogController::class . ':boughtDelete');
-        $this->post('/user/{id}/bought/buy', App\Controllers\Admin\UserLog\BoughtLogController::class . ':boughtAdd');
-
-        // 指定用户充值记录
-        $this->get('/user/{id}/code', App\Controllers\Admin\UserLog\CodeLogController::class . ':index');
-        $this->post('/user/{id}/code/ajax', App\Controllers\Admin\UserLog\CodeLogController::class . ':ajax');
-
-        // 指定用户订阅记录
-        $this->get('/user/{id}/sublog', App\Controllers\Admin\UserLog\SubLogController::class . ':index');
-        $this->post('/user/{id}/sublog/ajax', App\Controllers\Admin\UserLog\SubLogController::class . ':ajax');
-
-        // 指定用户审计记录
-        $this->get('/user/{id}/detect', App\Controllers\Admin\UserLog\DetectLogController::class . ':index');
-        $this->post('/user/{id}/detect/ajax', App\Controllers\Admin\UserLog\DetectLogController::class . ':ajax');
-
-        // 指定用户登录记录
-        $this->get('/user/{id}/login', App\Controllers\Admin\UserLog\LoginLogController::class . ':index');
-        $this->post('/user/{id}/login/ajax', App\Controllers\Admin\UserLog\LoginLogController::class . ':ajax');
-
         // 设置中心
         $this->get('/setting', App\Controllers\Admin\SettingController::class . ':index');
         $this->post('/setting', App\Controllers\Admin\SettingController::class . ':save');
@@ -293,9 +266,6 @@ return function (SlimApp $app): void {
         $this->post('/users/detectlog', App\Controllers\Node\UserController::class . ':addDetectLog');
         // 审计 & 杂七杂八的功能
         $this->get('/func/detect_rules', App\Controllers\Node\FuncController::class . ':getDetectLogs');
-        $this->post('/func/block_ip', App\Controllers\Node\FuncController::class . ':addBlockIp');
-        $this->get('/func/block_ip', App\Controllers\Node\FuncController::class . ':getBlockip');
-        $this->get('/func/unblock_ip', App\Controllers\Node\FuncController::class . ':getUnblockip');
         $this->get('/func/ping', App\Controllers\Node\FuncController::class . ':ping');
     })->add(new NodeToken());
 

+ 1 - 15
db/migrations/20000101000000_init_database.php.new

@@ -108,12 +108,7 @@ final class InitDatabase extends AbstractMigration
             ->addColumn('markdown', 'text', [])
             ->create();
 
-        $this->table('blockip', [ 'id' => false, 'primary_key' => [ 'id' ]])
-            ->addColumn('id', 'biginteger', [ 'identity' => true ])
-            ->addColumn('nodeid', 'integer', [])
-            ->addColumn('ip', 'string', [])
-            ->addColumn('datetime', 'biginteger', [])
-            ->create();
+        
 
         $this->table('bought', [ 'id' => false, 'primary_key' => [ 'id' ]])
             ->addColumn('id', 'biginteger', [ 'identity' => true ])
@@ -305,13 +300,6 @@ final class InitDatabase extends AbstractMigration
             ->addColumn('type', 'string', [ 'comment' => '工单类型', 'default' => 'other' ])
             ->create();
 
-        $this->table('unblockip', [ 'id' => false, 'primary_key' => [ 'id' ]])
-            ->addColumn('id', 'biginteger', [ 'identity' => true ])
-            ->addColumn('ip', 'string', [])
-            ->addColumn('datetime', 'biginteger', [])
-            ->addColumn('userid', 'biginteger', [])
-            ->create();
-
         $this->table('user_hourly_usage', [ 'id' => false, 'primary_key' => [ 'id' ]])
             ->addColumn('id', 'biginteger', [ 'identity' => true,'signed' => false ])
             ->addColumn('user_id', 'biginteger', [ 'signed' => false ])
@@ -352,7 +340,6 @@ final class InitDatabase extends AbstractMigration
         $this->table('node')->drop()->update();
         $this->table('alive_ip')->drop()->update();
         $this->table('announcement')->drop()->update();
-        $this->table('blockip')->drop()->update();
         $this->table('bought')->drop()->update();
         $this->table('code')->drop()->update();
         $this->table('config')->drop()->update();
@@ -373,7 +360,6 @@ final class InitDatabase extends AbstractMigration
         $this->table('user_password_reset')->drop()->update();
         $this->table('telegram_session')->drop()->update();
         $this->table('ticket')->drop()->update();
-        $this->table('unblockip')->drop()->update();
         $this->table('user_hourly_usage')->drop()->update();
         $this->table('user_subscribe_log')->drop()->update();
         $this->table('user_token')->drop()->update();

+ 35 - 0
db/migrations/20221124113800_remove_block.php

@@ -0,0 +1,35 @@
+<?php
+
+declare(strict_types=1);
+
+use Phinx\Migration\AbstractMigration;
+
+final class RemoveBlock extends AbstractMigration
+{
+    public function up(): void
+    {
+        if ($this->hasTable('blockip')) {
+            $this->table('blockip')->drop()->update();
+        }
+        if ($this->hasTable('unblockip')) {
+            $this->table('unblockip')->drop()->update();
+        }
+    }
+
+    public function down(): void
+    {
+        $this->table('blockip', [ 'id' => false, 'primary_key' => [ 'id' ]])
+            ->addColumn('id', 'biginteger', [ 'identity' => true ])
+            ->addColumn('nodeid', 'integer', [])
+            ->addColumn('ip', 'string', [])
+            ->addColumn('datetime', 'biginteger', [])
+            ->create();
+
+        $this->table('unblockip', [ 'id' => false, 'primary_key' => [ 'id' ]])
+            ->addColumn('id', 'biginteger', [ 'identity' => true ])
+            ->addColumn('ip', 'string', [])
+            ->addColumn('datetime', 'biginteger', [])
+            ->addColumn('userid', 'biginteger', [])
+            ->create();
+    }
+}

+ 0 - 78
resources/views/tabler/admin/ip/block.tpl

@@ -1,78 +0,0 @@
-{include file='admin/main.tpl'}
-
-<main class="content">
-    <div class="content-header ui-content-header">
-        <div class="container">
-            <h1 class="content-heading">节点被封IP</h1>
-        </div>
-    </div>
-    <div class="container">
-        <div class="col-lg-12 col-sm-12">
-            <section class="content-inner margin-top-no">
-                <div class="card">
-                    <div class="card-main">
-                        <div class="card-inner">
-                            <p>这里是最近的节点上捕捉到的进行非法行为的IP。</p>
-                            <p>显示表项:
-                                {include file='table/checkbox.tpl'}
-                            </p>
-                        </div>
-                    </div>
-                </div>
-                <div class="card">
-                    <div class="card-main">
-                        <div class="card-inner">
-                            <div class="form-group form-group-label">
-                                <label class="floating-label" for="ip">要解封的IP</label>
-                                <input class="form-control maxwidth-edit" id="ip" type="text">
-                            </div>
-                        </div>
-                        <div class="card-action">
-                            <div class="card-action-btn pull-left">
-                                <a class="btn btn-flat waves-attach" id="unblock"><span class="mdi mdi-check"></span>&nbsp;解封</a>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-                <div class="table-responsive">
-                    {include file='table/table.tpl'}
-                </div>
-                {include file='dialog.tpl'}
-        </div>
-    </div>
-</main>
-
-{include file='admin/footer.tpl'}
-
-<script>
-    {include file='table/js_1.tpl'}
-    $("#unblock").click(function () {
-        $.ajax({
-            type: "POST",
-            url: "/admin/unblock",
-            dataType: "json",
-            data: {
-                ip: $$getValue('ip')
-            },
-            success: data => {
-                if (data.ret) {
-                    $("#result").modal();
-                    $$.getElementById('msg').innerHTML = data.msg;
-                    window.setTimeout("location.href=window.location.href", {$config['jump_delay']});
-                } else {
-                    $("#result").modal();
-                    $$.getElementById('msg').innerHTML = data.msg;
-                }
-                // window.location.reload();
-            },
-            error: jqXHR => {
-                alert(`发生错误:${
-                        jqXHR.status
-                        }`);
-            }
-        })
-    });
-    window.addEventListener('load', () => {
-        {include file='table/js_2.tpl'}
-    });
-</script>

+ 0 - 36
resources/views/tabler/admin/ip/unblock.tpl

@@ -1,36 +0,0 @@
-{include file='admin/main.tpl'}
-
-<main class="content">
-    <div class="content-header ui-content-header">
-        <div class="container">
-            <h1 class="content-heading">解封IP记录</h1>
-        </div>
-    </div>
-    <div class="container">
-        <div class="col-lg-12 col-sm-12">
-            <section class="content-inner margin-top-no">
-
-                <div class="card">
-                    <div class="card-main">
-                        <div class="card-inner">
-                            <p>这里是最近的解封IP记录。</p>
-                            <p>显示表项: {include file='table/checkbox.tpl'}
-                            </p>
-                        </div>
-                    </div>
-                </div>
-                <div class="table-responsive">
-                    {include file='table/table.tpl'}
-                </div>
-        </div>
-    </div>
-</main>
-
-{include file='admin/footer.tpl'}
-
-<script>
-    {include file='table/js_1.tpl'}
-    window.addEventListener('load', () => {
-        {include file='table/js_2.tpl'}
-    });
-</script>

+ 0 - 2
resources/views/tabler/admin/main.tpl

@@ -77,8 +77,6 @@
                     <a class="waves-attach" data-toggle="collapse" href="#ui_menu_node">节点</a>
                     <ul class="menu-collapse collapse in" id="ui_menu_node">
                         <li><a href="/admin/node"><i class="mdi mdi-server icon-lg"></i>&nbsp;节点列表</a></li>
-                        <li><a href="/admin/block"><i class="mdi mdi-block-helper icon-lg"></i>&nbsp;已封禁IP</a></li>
-                        <li><a href="/admin/unblock"><i class="mdi mdi-check icon-lg"></i>&nbsp;已解封IP</a></li>
                     </ul>
                     <a class="waves-attach" data-toggle="collapse" href="#ui_menu_user">用户</a>
                     <ul class="menu-collapse collapse in" id="ui_menu_user">

+ 0 - 181
resources/views/tabler/admin/user/bought.tpl

@@ -1,181 +0,0 @@
-{include file='admin/main.tpl'}
-
-<main class="content">
-    <div class="content-header ui-content-header">
-        <div class="container">
-            <h1 class="content-heading">#{$user->id} [{$user->user_name}] 用户购买明细</h1>
-        </div>
-    </div>
-    <div class="container">
-        <div class="col-lg-12 col-sm-12">
-            <section class="content-inner margin-top-no">
-                <form id="main_form">
-                    <div class="card">
-                        <div class="card-main">
-                            <div class="card-inner">
-                                <div class="form-group form-group-label control-highlight-custom dropdown">
-                                    <label class="floating-label" for="buy_shop">选择套餐</label>
-                                    <button id="buy_shop" class="form-control maxwidth-edit" name="buy_shop"
-                                            data-toggle="dropdown">
-                                        请选择套餐
-                                    </button>
-                                    <ul class="dropdown-menu" aria-labelledby="buy_shop">
-                                        {foreach $shops as $shop}
-                                            <li>
-                                                <a href="#" class="dropdown-option" onclick="return false;"
-                                                   val="{$shop->id}" data="buy_shop">{$shop->name}</a>
-                                            </li>
-                                        {/foreach}
-                                    </ul>
-                                </div>
-                                <div class="form-group form-group-label control-highlight-custom dropdown">
-                                    <label class="floating-label" for="buy_type">类型</label>
-                                    <button id="buy_type" class="form-control maxwidth-edit" name="buy_type"
-                                            data-toggle="dropdown" value="0">
-                                        添加
-                                    </button>
-                                    <ul class="dropdown-menu" aria-labelledby="buy_type">
-                                        <li>
-                                            <a href="#" class="dropdown-option" onclick="return false;" val="0"
-                                               data="buy_type">添加</a>
-                                        </li>
-                                        <li>
-                                            <a href="#" class="dropdown-option" onclick="return false;" val="1"
-                                               data="buy_type">购买</a>
-                                        </li>
-                                    </ul>
-                                </div>
-
-                            </div>
-                        </div>
-                    </div>
-                    <div class="card">
-                        <div class="card-main">
-                            <div class="card-inner">
-                                <div class="form-group">
-                                    <div class="row">
-                                        <div class="col-md-10 col-md-push-1">
-                                            <button id="submit" type="submit" class="btn btn-block btn-brand">添加
-                                            </button>
-                                        </div>
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                </form>
-                <div class="card">
-                    <div class="card-main">
-                        <div class="card-inner">
-                            <p>显示表项: {include file='table/checkbox.tpl'}</p>
-                        </div>
-                    </div>
-                </div>
-                <div class="table-responsive">
-                    {include file='table/table.tpl'}
-                </div>
-                <div aria-hidden="true" class="modal modal-va-middle fade" id="delete_modal" role="dialog"
-                     tabindex="-1">
-                    <div class="modal-dialog modal-xs">
-                        <div class="modal-content">
-                            <div class="modal-heading">
-                                <a class="modal-close" data-dismiss="modal">×</a>
-                                <h2 class="modal-title">确认要删除该条购买记录?</h2>
-                            </div>
-                            <div class="modal-inner">
-                                <p>操作不可逆,请您确认。</p>
-                            </div>
-                            <div class="modal-footer">
-                                <p class="text-right">
-                                    <button class="btn btn-flat btn-brand-accent waves-attach waves-effect"
-                                            data-dismiss="modal" type="button">取消
-                                    </button>
-                                    <button class="btn btn-flat btn-brand-accent waves-attach" data-dismiss="modal"
-                                            id="delete_input" type="button">确定
-                                    </button>
-                                </p>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-                {include file='dialog.tpl'}
-        </div>
-    </div>
-</main>
-
-{include file='admin/footer.tpl'}
-
-<script>
-    {include file='table/js_1.tpl'}
-
-    window.addEventListener('load', () => {
-        {include file='table/js_2.tpl'}
-    });
-    function delete_modal_show(id) {
-        deleteid = id;
-        $("#delete_modal").modal();
-    }
-    $$.getElementById('delete_input').addEventListener('click', delete_id);
-    function delete_id() {
-        $.ajax({
-            type: "DELETE",
-            url: "/admin/user/bought",
-            dataType: "json",
-            data: {
-                id: deleteid
-            },
-            success: data => {
-                if (data.ret) {
-                    $("#result").modal();
-                    $$.getElementById('msg').innerHTML = data.msg;
-                    {include file='table/js_delete.tpl'}
-                } else {
-                    $("#result").modal();
-                    $$.getElementById('msg').innerHTML = data.msg;
-                }
-            },
-            error: jqXHR => {
-                $("#result").modal();
-                $$.getElementById('msg').innerHTML = `${ldelim}jqXHR{rdelim} 发生了错误。`;
-            }
-        });
-    }
-</script>
-
-{literal}
-<script>
-    $('#main_form').validate({
-        submitHandler: () => {
-            $.ajax({
-                type: "POST",
-                url: "bought/buy",
-                dataType: "json",
-                {/literal}
-                data: {
-                    buy_shop: $$getValue('buy_shop'),
-                    buy_type: $$getValue('buy_type'),
-                    {literal}
-                },
-                success: (data) => {
-                    if (data.ret) {
-                        $("#result").modal();
-                        $$.getElementById('msg').innerHTML = data.msg;
-                        {/literal}
-                        window.setTimeout("window.location.reload()", {$config['jump_delay']});
-                        {literal}
-                    } else {
-                        $("#result").modal();
-                        $$.getElementById('msg').innerHTML = data.msg;
-                    }
-                },
-                error: (jqXHR) => {
-                    $("#result").modal();
-                    $$.getElementById('msg').innerHTML = `${
-                            data.msg
-                            } 发生错误了`;
-                }
-            });
-        }
-    });
-</script>
-{/literal}

+ 0 - 33
resources/views/tabler/admin/user/code.tpl

@@ -1,33 +0,0 @@
-{include file='admin/main.tpl'}
-
-<main class="content">
-    <div class="content-header ui-content-header">
-        <div class="container">
-            <h1 class="content-heading">#{$user->id} [{$user->user_name}] 用户充值明细</h1>
-        </div>
-    </div>
-    <div class="container">
-        <div class="col-lg-12 col-sm-12">
-            <section class="content-inner margin-top-no">
-                <div class="card">
-                    <div class="card-main">
-                        <div class="card-inner">
-                            <p>显示表项: {include file='table/checkbox.tpl'}</p>
-                        </div>
-                    </div>
-                </div>
-                <div class="table-responsive">
-                    {include file='table/table.tpl'}
-                </div>
-        </div>
-    </div>
-</main>
-
-{include file='admin/footer.tpl'}
-
-<script>
-    {include file='table/js_1.tpl'}
-    window.addEventListener('load', () => {
-        {include file='table/js_2.tpl'}
-    });
-</script>

+ 0 - 35
resources/views/tabler/admin/user/detect.tpl

@@ -1,35 +0,0 @@
-{include file='admin/main.tpl'}
-
-<main class="content">
-    <div class="content-header ui-content-header">
-        <div class="container">
-            <h1 class="content-heading">#{$user->id} [{$user->user_name}] 用户审计记录</h1>
-        </div>
-    </div>
-    <div class="container">
-        <div class="col-lg-12 col-sm-12">
-            <section class="content-inner margin-top-no">
-
-                <div class="card">
-                    <div class="card-main">
-                        <div class="card-inner">
-                            <p>显示表项: {include file='table/checkbox.tpl'}</p>
-                        </div>
-                    </div>
-                </div>
-
-                <div class="table-responsive">
-                    {include file='table/table.tpl'}
-                </div>
-        </div>
-    </div>
-</main>
-
-{include file='admin/footer.tpl'}
-
-<script>
-    {include file='table/js_1.tpl'}
-    window.addEventListener('load', () => {
-        {include file='table/js_2.tpl'}
-    });
-</script>

+ 0 - 32
resources/views/tabler/admin/user/login.tpl

@@ -1,32 +0,0 @@
-{include file='admin/main.tpl'}
-<main class="content">
-    <div class="content-header ui-content-header">
-        <div class="container">
-            <h1 class="content-heading">#{$user->id} [{$user->user_name}] 用户登录记录</h1>
-        </div>
-    </div>
-    <div class="container">
-        <div class="col-lg-12 col-sm-12">
-            <section class="content-inner margin-top-no">
-                <div class="card">
-                    <div class="card-main">
-                        <div class="card-inner">
-                            <p>显示表项: {include file='table/checkbox.tpl'}</p>
-                        </div>
-                    </div>
-                </div>
-                <div class="table-responsive">
-                    {include file='table/table.tpl'}
-                </div>
-        </div>
-    </div>
-</main>
-
-{include file='admin/footer.tpl'}
-
-<script>
-    {include file='table/js_1.tpl'}
-    window.addEventListener('load', () => {
-        {include file='table/js_2.tpl'}
-    });
-</script>

+ 0 - 34
resources/views/tabler/admin/user/sublog.tpl

@@ -1,34 +0,0 @@
-{include file='admin/main.tpl'}
-
-<main class="content">
-    <div class="content-header ui-content-header">
-        <div class="container">
-            <h1 class="content-heading">#{$user->id} [{$user->user_name}] 用户订阅记录</h1>
-        </div>
-    </div>
-    <div class="container">
-        <div class="col-lg-12 col-sm-12">
-            <section class="content-inner margin-top-no">
-
-                <div class="card">
-                    <div class="card-main">
-                        <div class="card-inner">
-                            <p>显示表项: {include file='table/checkbox.tpl'}</p>
-                        </div>
-                    </div>
-                </div>
-                <div class="table-responsive">
-                    {include file='table/table.tpl'}
-                </div>
-        </div>
-    </div>
-</main>
-
-{include file='admin/footer.tpl'}
-
-<script>
-    {include file='table/js_1.tpl'}
-    window.addEventListener('load', () => {
-        {include file='table/js_2.tpl'}
-    });
-</script>

+ 0 - 33
resources/views/tabler/admin/user/traffic.tpl

@@ -1,33 +0,0 @@
-{include file='admin/main.tpl'}
-
-<main class="content">
-    <div class="content-header ui-content-header">
-        <div class="container">
-            <h1 class="content-heading">#{$user->id} [{$user->user_name}] 用户流量记录</h1>
-        </div>
-    </div>
-    <div class="container">
-        <div class="col-lg-12 col-sm-12">
-            <section class="content-inner margin-top-no">
-                <div class="card">
-                    <div class="card-main">
-                        <div class="card-inner">
-                            <p>显示表项: {include file='table/checkbox.tpl'}</p>
-                        </div>
-                    </div>
-                </div>
-                <div class="table-responsive">
-                    {include file='table/table.tpl'}
-                </div>
-        </div>
-    </div>
-</main>
-
-{include file='admin/footer.tpl'}
-
-<script>
-    {include file='table/js_1.tpl'}
-    window.addEventListener('load', () => {
-        {include file='table/js_2.tpl'}
-    });
-</script>

+ 0 - 4
src/Command/Job.php

@@ -5,7 +5,6 @@ declare(strict_types=1);
 namespace App\Command;
 
 use App\Models\Ann;
-use App\Models\BlockIp;
 use App\Models\Bought;
 use App\Models\DetectBanLog;
 use App\Models\DetectLog;
@@ -20,7 +19,6 @@ use App\Models\Shop;
 use App\Models\StreamMedia;
 use App\Models\TelegramSession;
 use App\Models\Token;
-use App\Models\UnblockIp;
 use App\Models\User;
 use App\Models\UserHourlyUsage;
 use App\Models\UserSubscribeLog;
@@ -76,8 +74,6 @@ EOL;
         EmailQueue::where('time', '<', \time() - 86400 * 3)->delete();
         PasswordReset::where('expire_time', '<', \time() - 86400 * 3)->delete();
         Ip::where('datetime', '<', \time() - 300)->delete();
-        UnblockIp::where('datetime', '<', \time() - 300)->delete();
-        BlockIp::where('datetime', '<', \time() - 86400)->delete();
         StreamMedia::where('created_at', '<', \time() - 86400 * 30)->delete();
         TelegramSession::where('datetime', '<', \time() - 900)->delete();
         // ------- 清理各表记录

+ 0 - 149
src/Controllers/Admin/IpController.php

@@ -5,10 +5,8 @@ declare(strict_types=1);
 namespace App\Controllers\Admin;
 
 use App\Controllers\BaseController;
-use App\Models\BlockIp;
 use App\Models\Ip;
 use App\Models\LoginIp;
-use App\Models\UnblockIp;
 use App\Utils\QQWry;
 use App\Utils\ResponseHelper;
 use App\Utils\Tools;
@@ -162,151 +160,4 @@ final class IpController extends BaseController
             'data' => $data,
         ]);
     }
-
-    /**
-     * 节点被封IP
-     *
-     * @param array     $args
-     */
-    public function block(Request $request, Response $response, array $args)
-    {
-        return $response->write(
-            $this->view()
-                ->assign('table_config', ResponseHelper::buildTableConfig([
-                    'id' => 'ID',
-                    'node_name' => '节点名称',
-                    'ip' => 'IP',
-                    'location' => '归属地',
-                    'datetime' => '时间',
-                ], 'block/ajax'))
-                ->display('admin/ip/block.tpl')
-        );
-    }
-
-    /**
-     * 节点被封IP AJAX
-     *
-     * @param array     $args
-     */
-    public function ajaxBlock(Request $request, Response $response, array $args)
-    {
-        $query = BlockIp::getTableDataFromAdmin(
-            $request,
-            static function (&$order_field): void {
-                if (\in_array($order_field, ['node_name'])) {
-                    $order_field = 'nodeid';
-                }
-                if (\in_array($order_field, ['location'])) {
-                    $order_field = 'ip';
-                }
-            }
-        );
-
-        $data = [];
-        $QQWry = new QQWry();
-        foreach ($query['datas'] as $value) {
-            /** @var BlockIp $value */
-
-            $tempdata = [];
-            $tempdata['id'] = $value->id;
-            $tempdata['node_name'] = $value->node_name();
-            $tempdata['ip'] = $value->ip;
-            $tempdata['location'] = $value->location($QQWry);
-            $tempdata['datetime'] = $value->datetime();
-
-            $data[] = $tempdata;
-        }
-
-        return $response->withJson([
-            'draw' => $request->getParam('draw'),
-            'recordsTotal' => BlockIp::count(),
-            'recordsFiltered' => $query['count'],
-            'data' => $data,
-        ]);
-    }
-
-    /**
-     * 解封IP
-     *
-     * @param array     $args
-     */
-    public function doUnblock(Request $request, Response $response, array $args)
-    {
-        $ip = trim($request->getParam('ip'));
-        BlockIp::where('ip', $ip)->delete();
-        $UIP = new UnblockIp();
-        $UIP->userid = $this->user->id;
-        $UIP->ip = $ip;
-        $UIP->datetime = \time();
-        $UIP->save();
-
-        return $response->withJson([
-            'ret' => 1,
-            'msg' => '发送解封命令解封 ' . $ip . ' 成功',
-        ]);
-    }
-
-    /**
-     * 解封IP记录
-     *
-     * @param array     $args
-     */
-    public function unblock(Request $request, Response $response, array $args)
-    {
-        return $response->write(
-            $this->view()
-                ->assign('table_config', ResponseHelper::buildTableConfig([
-                    'id' => 'ID',
-                    'userid' => '用户ID',
-                    'user_name' => '用户名',
-                    'ip' => 'IP',
-                    'location' => '归属地',
-                    'datetime' => '时间',
-                ], 'unblock/ajax'))
-                ->display('admin/ip/unblock.tpl')
-        );
-    }
-
-    /**
-     * 解封IP记录 AJAX
-     *
-     * @param array     $args
-     */
-    public function ajaxUnblock(Request $request, Response $response, array $args)
-    {
-        $query = UnblockIp::getTableDataFromAdmin(
-            $request,
-            static function (&$order_field): void {
-                if (\in_array($order_field, ['user_name'])) {
-                    $order_field = 'userid';
-                }
-                if (\in_array($order_field, ['location'])) {
-                    $order_field = 'ip';
-                }
-            }
-        );
-
-        $data = [];
-        $QQWry = new QQWry();
-        foreach ($query['datas'] as $value) {
-            /** @var UnblockIp $value */
-
-            $tempdata = [];
-            $tempdata['id'] = $value->id;
-            $tempdata['userid'] = $value->userid;
-            $tempdata['user_name'] = $value->userName();
-            $tempdata['ip'] = $value->ip;
-            $tempdata['location'] = $value->location($QQWry);
-            $tempdata['datetime'] = $value->datetime();
-
-            $data[] = $tempdata;
-        }
-
-        return $response->withJson([
-            'draw' => $request->getParam('draw'),
-            'recordsTotal' => UnblockIp::count(),
-            'recordsFiltered' => $query['count'],
-            'data' => $data,
-        ]);
-    }
 }

+ 0 - 175
src/Controllers/Admin/UserLog/BoughtLogController.php

@@ -1,175 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Controllers\Admin\UserLog;
-
-use App\Controllers\BaseController;
-use App\Models\Bought;
-use App\Models\Shop;
-use App\Models\User;
-use Psr\Http\Message\ResponseInterface;
-use Slim\Http\Request;
-use Slim\Http\Response;
-
-final class BoughtLogController extends BaseController
-{
-    /**
-     * @param array     $args
-     */
-    public function bought(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $id = $args['id'];
-        $user = User::find($id);
-        $table_config = [];
-        $table_config['total_column'] = [
-            'op' => '操作',
-            'id' => 'ID',
-            'name' => '商品名称',
-            'valid' => '是否有效期内',
-            'renew' => '自动续费时间',
-            'reset_time' => '流量重置时间',
-            'datetime' => '套餐购买时间',
-            'exp_time' => '套餐过期时间',
-            'content' => '商品详细内容',
-        ];
-        $table_config['default_show_column'] = ['op', 'name', 'valid', 'reset_time'];
-        $table_config['ajax_url'] = 'bought/ajax';
-        $shops = Shop::where('status', 1)->orderBy('name')->get();
-
-        return $response->write(
-            $this->view()
-                ->assign('table_config', $table_config)
-                ->assign('shops', $shops)
-                ->assign('user', $user)
-                ->display('admin/user/bought.tpl')
-        );
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function boughtAjax(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $user = User::find($args['id']);
-        $query = Bought::getTableDataFromAdmin(
-            $request,
-            static function (&$order_field): void {
-                if (\in_array($order_field, ['op', 'reset_time', 'valid', 'exp_time'])) {
-                    $order_field = 'id';
-                }
-                if (\in_array($order_field, ['content', 'name'])) {
-                    $order_field = 'shopid';
-                }
-            },
-            static function ($query) use ($user): void {
-                $query->where('userid', $user->id);
-            }
-        );
-
-        $data = [];
-        foreach ($query['datas'] as $value) {
-            /** @var Bought $value */
-
-            if ($value->shop() === null) {
-                Bought::shopIsNull($value);
-                continue;
-            }
-            $tempdata = [];
-            $tempdata['op'] = '<a class="btn btn-brand-accent" id="delete" href="javascript:void(0);" onClick="delete_modal_show(\'' . $value->id . '\')">删除</a>';
-            $tempdata['id'] = $value->id;
-            $tempdata['name'] = $value->shop()->name;
-            $tempdata['content'] = $value->content();
-            $tempdata['renew'] = $value->renew();
-            $tempdata['datetime'] = $value->datetime();
-            if ($value->shop()->useLoop()) {
-                $tempdata['valid'] = ($value->valid() ? '有效' : '已过期');
-            } else {
-                $tempdata['valid'] = '-';
-            }
-            $tempdata['reset_time'] = $value->resetTime();
-            $tempdata['exp_time'] = $value->expTime();
-
-            $data[] = $tempdata;
-        }
-
-        return $response->withJson([
-            'draw' => $request->getParam('draw'),
-            'recordsTotal' => Bought::where('userid', $user->id)->count(),
-            'recordsFiltered' => $query['count'],
-            'data' => $data,
-        ]);
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function boughtDelete(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $id = $request->getParam('id');
-        $Bought = Bought::find($id);
-        if (! $Bought->delete()) {
-            return $response->withJson([
-                'ret' => 0,
-                'msg' => '删除失败',
-            ]);
-        }
-        return $response->withJson([
-            'ret' => 1,
-            'msg' => '删除成功',
-        ]);
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function boughtAdd(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $id = $args['id'];
-        $user = User::find($id);
-        $shop_id = (int) $request->getParam('buy_shop');
-        $buy_type = (int) $request->getParam('buy_type');
-        if ($shop_id === '') {
-            return $response->withJson([
-                'ret' => 0,
-                'msg' => '请选择套餐',
-            ]);
-        }
-        $shop = Shop::find($shop_id);
-        if ($shop === null) {
-            return $response->withJson([
-                'ret' => 0,
-                'msg' => '套餐不存在',
-            ]);
-        }
-        if ($buy_type !== 0) {
-            if (bccomp($user->money, $shop->price, 2) === -1) {
-                return $response->withJson([
-                    'ret' => 0,
-                    'msg' => '喵喵喵~ 该用户余额不足。',
-                ]);
-            }
-            $user->money = bcsub($user->money, $shop->price, 2);
-            $user->save();
-        }
-        $boughts = Bought::where('userid', $user->id)->get();
-        foreach ($boughts as $disable_bought) {
-            $disable_bought->renew = 0;
-            $disable_bought->save();
-        }
-        $bought = new Bought();
-        $bought->userid = $user->id;
-        $bought->shopid = $shop->id;
-        $bought->datetime = \time();
-        $bought->renew = 0;
-        $bought->coupon = '';
-        $bought->price = $shop->price;
-        $bought->save();
-        $shop->buy($user);
-
-        return $response->withJson([
-            'ret' => 1,
-            'msg' => ($buy_type !== 0 ? '套餐购买成功' : '套餐添加成功'),
-        ]);
-    }
-}

+ 0 - 73
src/Controllers/Admin/UserLog/CodeLogController.php

@@ -1,73 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Controllers\Admin\UserLog;
-
-use App\Controllers\BaseController;
-use App\Models\Code;
-use App\Models\User;
-use App\Utils\ResponseHelper;
-use Psr\Http\Message\ResponseInterface;
-use Slim\Http\Request;
-use Slim\Http\Response;
-
-final class CodeLogController extends BaseController
-{
-    /**
-     * @param array     $args
-     */
-    public function index(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $id = $args['id'];
-        $user = User::find($id);
-        return $response->write(
-            $this->view()
-                ->assign('table_config', ResponseHelper::buildTableConfig([
-                    'id' => 'ID',
-                    'code' => '内容',
-                    'type' => '类型',
-                    'number' => '操作',
-                    'usedatetime' => '时间',
-                ], 'code/ajax'))
-                ->assign('user', $user)
-                ->display('admin/user/code.tpl')
-        );
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function ajax(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $user = User::find($args['id']);
-        $query = Code::getTableDataFromAdmin(
-            $request,
-            null,
-            static function ($query) use ($user): void {
-                $query->where('userid', $user->id);
-            }
-        );
-
-        $data = [];
-        foreach ($query['datas'] as $value) {
-            /** @var Code $value */
-
-            $tempdata = [];
-            $tempdata['id'] = $value->id;
-            $tempdata['code'] = $value->code;
-            $tempdata['type'] = $value->type();
-            $tempdata['number'] = $value->number();
-            $tempdata['usedatetime'] = $value->usedatetime;
-
-            $data[] = $tempdata;
-        }
-
-        return $response->withJson([
-            'draw' => $request->getParam('draw'),
-            'recordsTotal' => Code::where('userid', $user->id)->count(),
-            'recordsFiltered' => $query['count'],
-            'data' => $data,
-        ]);
-    }
-}

+ 0 - 97
src/Controllers/Admin/UserLog/DetectLogController.php

@@ -1,97 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Controllers\Admin\UserLog;
-
-use App\Controllers\BaseController;
-use App\Models\DetectLog;
-use App\Models\User;
-use App\Utils\ResponseHelper;
-use Psr\Http\Message\ResponseInterface;
-use Slim\Http\Request;
-use Slim\Http\Response;
-
-final class DetectLogController extends BaseController
-{
-    /**
-     * @param array     $args
-     */
-    public function index(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $id = $args['id'];
-        $user = User::find($id);
-
-        return $response->write(
-            $this->view()
-                ->assign('table_config', ResponseHelper::buildTableConfig([
-                    'id' => 'ID',
-                    'node_id' => '节点ID',
-                    'node_name' => '节点名',
-                    'list_id' => '规则ID',
-                    'rule_name' => '规则名',
-                    'rule_text' => '规则描述',
-                    'rule_regex' => '规则正则表达式',
-                    'rule_type' => '规则类型',
-                    'datetime' => '时间',
-                ], 'detect/ajax'))
-                ->assign('user', $user)
-                ->display('admin/user/detect.tpl')
-        );
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function ajax(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $user = User::find($args['id']);
-        $query = DetectLog::getTableDataFromAdmin(
-            $request,
-            static function (&$order_field): void {
-                if (\in_array($order_field, ['node_name'])) {
-                    $order_field = 'node_id';
-                }
-                if (\in_array($order_field, ['rule_name', 'rule_text', 'rule_regex', 'rule_type'])) {
-                    $order_field = 'list_id';
-                }
-            },
-            static function ($query) use ($user): void {
-                $query->where('user_id', $user->id);
-            }
-        );
-
-        $data = [];
-        foreach ($query['datas'] as $value) {
-            /** @var DetectLog $value */
-
-            if ($value->rule() === null) {
-                DetectLog::ruleIsNull($value);
-                continue;
-            }
-            if ($value->node() === null) {
-                DetectLog::nodeIsNull($value);
-                continue;
-            }
-            $tempdata = [];
-            $tempdata['id'] = $value->id;
-            $tempdata['node_id'] = $value->node_id;
-            $tempdata['node_name'] = $value->nodeName();
-            $tempdata['list_id'] = $value->list_id;
-            $tempdata['rule_name'] = $value->ruleName();
-            $tempdata['rule_text'] = $value->ruleText();
-            $tempdata['rule_regex'] = $value->ruleRegex();
-            $tempdata['rule_type'] = $value->ruleType();
-            $tempdata['datetime'] = $value->datetime();
-
-            $data[] = $tempdata;
-        }
-
-        return $response->withJson([
-            'draw' => $request->getParam('draw'),
-            'recordsTotal' => DetectLog::where('user_id', $user->id)->count(),
-            'recordsFiltered' => $query['count'],
-            'data' => $data,
-        ]);
-    }
-}

+ 0 - 78
src/Controllers/Admin/UserLog/LoginLogController.php

@@ -1,78 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Controllers\Admin\UserLog;
-
-use App\Controllers\BaseController;
-use App\Models\LoginIp;
-use App\Models\User;
-use App\Utils\QQWry;
-use App\Utils\ResponseHelper;
-use Psr\Http\Message\ResponseInterface;
-use Slim\Http\Request;
-use Slim\Http\Response;
-
-final class LoginLogController extends BaseController
-{
-    /**
-     * @param array     $args
-     */
-    public function index(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $id = $args['id'];
-        $user = User::find($id);
-        return $response->write(
-            $this->view()
-                ->assign('table_config', ResponseHelper::buildTableConfig([
-                    'id' => 'ID',
-                    'ip' => 'IP',
-                    'location' => '归属地',
-                    'datetime' => '时间',
-                    'type' => '类型',
-                ], 'login/ajax'))
-                ->assign('user', $user)
-                ->display('admin/user/login.tpl')
-        );
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function ajax(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $user = User::find($args['id']);
-        $query = LoginIp::getTableDataFromAdmin(
-            $request,
-            static function (&$order_field): void {
-                if (\in_array($order_field, ['location'])) {
-                    $order_field = 'ip';
-                }
-            },
-            static function ($query) use ($user): void {
-                $query->where('userid', $user->id);
-            }
-        );
-
-        $data = [];
-        $QQWry = new QQWry();
-        foreach ($query['datas'] as $value) {
-            /** @var LoginIp $value */
-            $tempdata = [];
-            $tempdata['id'] = $value->id;
-            $tempdata['ip'] = $value->ip;
-            $tempdata['location'] = $value->location($QQWry);
-            $tempdata['datetime'] = $value->datetime();
-            $tempdata['type'] = $value->type();
-
-            $data[] = $tempdata;
-        }
-
-        return $response->withJson([
-            'draw' => $request->getParam('draw'),
-            'recordsTotal' => LoginIp::where('userid', $user->id)->count(),
-            'recordsFiltered' => $query['count'],
-            'data' => $data,
-        ]);
-    }
-}

+ 0 - 82
src/Controllers/Admin/UserLog/SubLogController.php

@@ -1,82 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Controllers\Admin\UserLog;
-
-use App\Controllers\BaseController;
-use App\Models\User;
-use App\Models\UserSubscribeLog;
-use App\Utils\QQWry;
-use App\Utils\ResponseHelper;
-use Psr\Http\Message\ResponseInterface;
-use Slim\Http\Request;
-use Slim\Http\Response;
-
-final class SubLogController extends BaseController
-{
-    /**
-     * @param array     $args
-     */
-    public function index(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $id = $args['id'];
-        $user = User::find($id);
-
-        return $response->write(
-            $this->view()
-                ->assign('table_config', ResponseHelper::buildTableConfig([
-                    'id' => 'ID',
-                    'subscribe_type' => '类型',
-                    'request_ip' => 'IP',
-                    'location' => '归属地',
-                    'request_time' => '时间',
-                    'request_user_agent' => 'User-Agent',
-                ], 'sublog/ajax'))
-                ->assign('user', $user)
-                ->display('admin/user/sublog.tpl')
-        );
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function ajax(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $user = User::find($args['id']);
-        $query = UserSubscribeLog::getTableDataFromAdmin(
-            $request,
-            static function (&$order_field): void {
-                if (\in_array($order_field, ['location'])) {
-                    $order_field = 'request_ip';
-                }
-            },
-            static function ($query) use ($user): void {
-                $query->where('user_id', $user->id);
-            }
-        );
-
-        $data = [];
-        $QQWry = new QQWry();
-        foreach ($query['datas'] as $value) {
-            /** @var UserSubscribeLog $value */
-
-            $tempdata = [];
-            $tempdata['id'] = $value->id;
-            $tempdata['subscribe_type'] = $value->subscribe_type;
-            $tempdata['request_ip'] = $value->request_ip;
-            $tempdata['location'] = $value->location($QQWry);
-            $tempdata['request_time'] = $value->request_time;
-            $tempdata['request_user_agent'] = $value->request_user_agent;
-
-            $data[] = $tempdata;
-        }
-
-        return $response->withJson([
-            'draw' => $request->getParam('draw'),
-            'recordsTotal' => UserSubscribeLog::where('user_id', $user->id)->count(),
-            'recordsFiltered' => $query['count'],
-            'data' => $data,
-        ]);
-    }
-}

+ 0 - 70
src/Controllers/Node/FuncController.php

@@ -5,10 +5,7 @@ declare(strict_types=1);
 namespace App\Controllers\Node;
 
 use App\Controllers\BaseController;
-use App\Models\BlockIp;
 use App\Models\DetectRule;
-use App\Models\Node;
-use App\Models\UnblockIp;
 use App\Utils\ResponseHelper;
 use Psr\Http\Message\ResponseInterface;
 use Slim\Http\Request;
@@ -40,71 +37,4 @@ final class FuncController extends BaseController
             'data' => $rules,
         ]);
     }
-
-    /**
-     * @param array     $args
-     */
-    public function getBlockip(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $block_ips = BlockIp::Where('datetime', '>', \time() - 60)->get();
-
-        return ResponseHelper::etagJson($request, $response, [
-            'ret' => 1,
-            'data' => $block_ips,
-        ]);
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function getUnblockip(Request $request, Response $response, array $args): ResponseInterface
-    {
-        $unblock_ips = UnblockIp::Where('datetime', '>', \time() - 60)->get();
-
-        return ResponseHelper::etagJson($request, $response, [
-            'ret' => 1,
-            'data' => $unblock_ips,
-        ]);
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function addBlockIp(Request $request, Response $response, array $args)
-    {
-        $params = $request->getQueryParams();
-
-        $data = $request->getParam('data');
-        $node_id = $params['node_id'];
-        $node = Node::find($node_id);
-        if ($node === null) {
-            return $response->withJson([
-                'ret' => 0,
-            ]);
-        }
-
-        if (count($data) > 0) {
-            foreach ($data as $log) {
-                $ip = $log['ip'];
-
-                $exist_ip = BlockIp::where('ip', $ip)->first();
-                if ($exist_ip !== null) {
-                    continue;
-                }
-
-                // log
-                $ip_block = new BlockIp();
-                $ip_block->ip = $ip;
-                $ip_block->nodeid = $node_id;
-                $ip_block->datetime = \time();
-                $ip_block->save();
-            }
-        }
-
-        $res = [
-            'ret' => 1,
-            'data' => 'ok',
-        ];
-        return $response->withJson($res);
-    }
 }

+ 0 - 33
src/Controllers/UserController.php

@@ -5,7 +5,6 @@ declare(strict_types=1);
 namespace App\Controllers;
 
 use App\Models\Ann;
-use App\Models\BlockIp;
 use App\Models\Bought;
 use App\Models\Code;
 use App\Models\Docs;
@@ -18,7 +17,6 @@ use App\Models\Payback;
 use App\Models\Setting;
 use App\Models\StreamMedia;
 use App\Models\Token;
-use App\Models\UnblockIp;
 use App\Models\User;
 use App\Models\UserSubscribeLog;
 use App\Services\Auth;
@@ -454,22 +452,11 @@ final class UserController extends BaseController
     {
         $themes = Tools::getDir(BASE_PATH . '/resources/views');
 
-        $BIP = BlockIp::where('ip', $_SERVER['REMOTE_ADDR'])->first();
-        if ($BIP === null) {
-            $Block = 'IP: ' . $_SERVER['REMOTE_ADDR'] . ' 没有被封';
-            $isBlock = 0;
-        } else {
-            $Block = 'IP: ' . $_SERVER['REMOTE_ADDR'] . ' 已被封';
-            $isBlock = 1;
-        }
-
         $bind_token = TelegramSessionManager::addBindSession($this->user);
 
         return $this->view()
             ->assign('user', $this->user)
             ->assign('themes', $themes)
-            ->assign('isBlock', $isBlock)
-            ->assign('Block', $Block)
             ->assign('bind_token', $bind_token)
             ->assign('telegram_bot', $_ENV['telegram_bot'])
             ->registerClass('Config', Config::class)
@@ -673,26 +660,6 @@ final class UserController extends BaseController
         return ResponseHelper::successfully($response, '修改成功');
     }
 
-    /**
-     * @param array     $args
-     */
-    public function unblock(Request $request, Response $response, array $args)
-    {
-        $user = $this->user;
-        $BIP = BlockIp::where('ip', $_SERVER['REMOTE_ADDR'])->get();
-        foreach ($BIP as $bi) {
-            $bi->delete();
-        }
-
-        $UIP = new UnblockIp();
-        $UIP->userid = $user->id;
-        $UIP->ip = $_SERVER['REMOTE_ADDR'];
-        $UIP->datetime = \time();
-        $UIP->save();
-
-        return ResponseHelper::successfully($response, $_SERVER['REMOTE_ADDR']);
-    }
-
     /**
      * @param array     $args
      */

+ 0 - 53
src/Models/BlockIp.php

@@ -1,53 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Models;
-
-use App\Utils\QQWry;
-
-final class BlockIp extends Model
-{
-    protected $connection = 'default';
-
-    protected $table = 'blockip';
-
-    /**
-     * 节点
-     */
-    public function node(): ?Node
-    {
-        return Node::find($this->nodeid);
-    }
-
-    /**
-     * 节点名
-     */
-    public function nodeName(): string
-    {
-        if ($this->node() === null) {
-            return '节点已不存在';
-        }
-        return $this->node()->name;
-    }
-
-    /**
-     * 获取 IP 位置
-     */
-    public function location(?QQWry $QQWry = null): string
-    {
-        if ($QQWry === null) {
-            $QQWry = new QQWry();
-        }
-        $location = $QQWry->getlocation($this->ip);
-        return iconv('gbk', 'utf-8//IGNORE', $location['country'] . $location['area']);
-    }
-
-    /**
-     * 时间
-     */
-    public function datetime(): string
-    {
-        return date('Y-m-d H:i:s', $this->datetime);
-    }
-}

+ 0 - 53
src/Models/UnblockIp.php

@@ -1,53 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Models;
-
-use App\Utils\QQWry;
-
-final class UnblockIp extends Model
-{
-    protected $connection = 'default';
-
-    protected $table = 'unblockip';
-
-    /**
-     * 用户
-     */
-    public function user(): ?User
-    {
-        return User::find($this->userid);
-    }
-
-    /**
-     * 用户名
-     */
-    public function userName(): string
-    {
-        if ($this->user() === null) {
-            return '用户已不存在';
-        }
-        return $this->user()->user_name;
-    }
-
-    /**
-     * 获取 IP 位置
-     */
-    public function location(?QQWry $QQWry = null): string
-    {
-        if ($QQWry === null) {
-            $QQWry = new QQWry();
-        }
-        $location = $QQWry->getlocation($this->ip);
-        return iconv('gbk', 'utf-8//IGNORE', $location['country'] . $location['area']);
-    }
-
-    /**
-     * 时间
-     */
-    public function datetime(): string
-    {
-        return date('Y-m-d H:i:s', $this->datetime);
-    }
-}

+ 0 - 1
src/Models/User.php

@@ -446,7 +446,6 @@ final class User extends Model
         PasswordReset::where('email', '=', $email)->delete();
         TelegramSession::where('user_id', '=', $uid)->delete();
         Token::where('user_id', '=', $uid)->delete();
-        UnblockIp::where('userid', '=', $uid)->delete();
         UserSubscribeLog::where('user_id', '=', $uid)->delete();
 
         $this->delete();