浏览代码

feat: add log display settings

M1Screw 2 年之前
父节点
当前提交
f497706a8d

+ 2 - 2
app/routes.php

@@ -64,8 +64,6 @@ return static function (Slim\App $app): void {
         $group->get('/ticket/{id}/view', App\Controllers\User\TicketController::class . ':ticketView');
         $group->put('/ticket/{id}', App\Controllers\User\TicketController::class . ':ticketUpdate');
 
-        $group->post('/buy_invite', App\Controllers\UserController::class . ':buyInvite');
-        $group->post('/custom_invite', App\Controllers\UserController::class . ':customInvite');
         $group->get('/edit', App\Controllers\UserController::class . ':edit');
         $group->post('/email', App\Controllers\UserController::class . ':updateEmail');
         $group->post('/username', App\Controllers\UserController::class . ':updateUsername');
@@ -260,6 +258,8 @@ return static function (Slim\App $app): void {
         $group->post('/setting/reg', App\Controllers\Admin\Setting\RegController::class . ':saveReg');
         $group->get('/setting/support', App\Controllers\Admin\Setting\SupportController::class . ':support');
         $group->post('/setting/support', App\Controllers\Admin\Setting\SupportController::class . ':saveSupport');
+        $group->get('/setting/feature', App\Controllers\Admin\Setting\FeatureController::class . ':feature');
+        $group->post('/setting/feature', App\Controllers\Admin\Setting\FeatureController::class . ':saveFeature');
         $group->post('/setting/test_email', App\Controllers\Admin\Setting\EmailController::class . ':testEmail');
 
         // 礼品卡

+ 30 - 20
config/settings.json

@@ -879,26 +879,6 @@
         "default": "0",
         "mark": "注册后是否默认接收每日用量邮件推送"
     },
-    {
-        "id": null,
-        "item": "invite_price",
-        "value": "-1",
-        "class": "invite",
-        "is_public": 1,
-        "type": "int",
-        "default": "-1",
-        "mark": "用户购买邀请码所需要的价格"
-    },
-    {
-        "id": null,
-        "item": "custom_invite_price",
-        "value": "-1",
-        "class": "invite",
-        "is_public": 1,
-        "type": "int",
-        "default": "-1",
-        "mark": "用户定制邀请码所需要的价格"
-    },
     {
         "id": null,
         "item": "sign_up_for_invitation_codes",
@@ -1359,6 +1339,36 @@
         "default": "",
         "mark": "面向游客的服务条款"
     },
+    {
+        "id": null,
+        "item": "display_media",
+        "value": "1",
+        "class": "feature",
+        "is_public": 1,
+        "type": "bool",
+        "default": "1",
+        "mark": "显示节点流媒体解锁情况"
+    },
+    {
+        "id": null,
+        "item": "display_subscribe_log",
+        "value": "1",
+        "class": "feature",
+        "is_public": 1,
+        "type": "bool",
+        "default": "1",
+        "mark": "显示用户订阅记录"
+    },
+    {
+        "id": null,
+        "item": "display_detect_log",
+        "value": "1",
+        "class": "feature",
+        "is_public": 1,
+        "type": "bool",
+        "default": "1",
+        "mark": "显示用户审计记录"
+    },
     {
         "id": null,
         "item": "db_version",

+ 102 - 0
resources/views/tabler/admin/setting/feature.tpl

@@ -0,0 +1,102 @@
+{include file='admin/tabler_header.tpl'}
+
+<div class="page-wrapper">
+    <div class="container-xl">
+        <div class="page-header d-print-none text-white">
+            <div class="row align-items-center">
+                <div class="col">
+                    <h2 class="page-title">
+                        <span class="home-title">功能设置</span>
+                    </h2>
+                    <div class="page-pretitle my-3">
+                        <span class="home-subtitle">设置站点的功能开关与显示</span>
+                    </div>
+                </div>
+                <div class="col-auto ms-auto d-print-none">
+                    <div class="btn-list">
+                        <a id="save-setting" href="#" class="btn btn-primary">
+                            <i class="icon ti ti-device-floppy"></i>
+                            保存
+                        </a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="page-body">
+        <div class="container-xl">
+            <div class="row row-deck row-cards">
+                <div class="col-md-12">
+                    <div class="card">
+                    <div class="card-header">
+                    <ul class="nav nav-tabs card-header-tabs" data-bs-toggle="tabs">
+                        <li class="nav-item">
+                            <a href="#display" class="nav-link active" data-bs-toggle="tab">功能显示</a>
+                        </li>
+                    </ul>
+                </div>
+                <div class="card-body">
+                    <div class="tab-content">
+                        <div class="tab-pane active show" id="display">
+                            <div class="card-body">
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">显示节点流媒体解锁情况</label>
+                                    <div class="col">
+                                        <select id="display_media" class="col form-select" value="{$settings['display_media']}">
+                                            <option value="0" {if $settings['display_media'] == false}selected{/if}>关闭</option>
+                                            <option value="1" {if $settings['display_media'] == true}selected{/if}>开启</option>
+                                        </select>
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">显示用户订阅记录</label>
+                                    <div class="col">
+                                        <select id="display_subscribe_log" class="col form-select" value="{$settings['display_subscribe_log']}">
+                                            <option value="0" {if $settings['display_subscribe_log'] == false}selected{/if}>关闭</option>
+                                            <option value="1" {if $settings['display_subscribe_log'] == true}selected{/if}>开启</option>
+                                        </select>
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">显示用户审计记录</label>
+                                    <div class="col">
+                                        <select id="display_detect_log" class="col form-select" value="{$settings['display_detect_log']}">
+                                            <option value="0" {if $settings['display_detect_log'] == false}selected{/if}>关闭</option>
+                                            <option value="1" {if $settings['display_detect_log'] == true}selected{/if}>开启</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script>
+    $("#save-setting").click(function() {
+        $.ajax({
+            url: '/admin/setting/feature',
+            type: 'POST',
+            dataType: "json",
+            data: {
+                {foreach $update_field as $key}
+                {$key}: $('#{$key}').val(),
+                {/foreach}
+            },
+            success: function(data) {
+                if (data.ret == 1) {
+                    $('#success-message').text(data.msg);
+                    $('#success-dialog').modal('show');
+                } else {
+                    $('#fail-message').text(data.msg);
+                    $('#fail-dialog').modal('show');
+                }
+            }
+        })
+    });
+</script>
+
+{include file='admin/tabler_footer.tpl'}

+ 0 - 12
resources/views/tabler/admin/setting/ref.tpl

@@ -54,18 +54,6 @@
                                         <input id="invitation_to_register_traffic_reward" type="text" class="form-control" value="{$settings['invitation_to_register_traffic_reward']}">
                                     </div>
                                 </div>
-                                <div class="form-group mb-3 row">
-                                    <label class="form-label col-3 col-form-label">邀请码价格,设为小于 0 时不开放购买</label>
-                                    <div class="col">
-                                        <input id="invite_price" type="text" class="form-control" value="{$settings['invite_price']}">
-                                    </div>
-                                </div>
-                                <div class="form-group mb-3 row">
-                                    <label class="form-label col-3 col-form-label">定制邀请码价格,设为小于 0 时不开放购买</label>
-                                    <div class="col">
-                                        <input id="custom_invite_price" type="text" class="form-control" value="{$settings['custom_invite_price']}">
-                                    </div>
-                                </div>
                             </div>
                         </div>
                         <div class="tab-pane" id="rebate">

+ 1 - 1
resources/views/tabler/admin/setting/support.tpl

@@ -85,7 +85,7 @@
                                 <div class="form-group mb-3 row">
                                     <label class="form-label col-3 col-form-label">是否显示管理员联系方式</label>
                                     <div class="col">
-                                        <select id="live_chat" class="col form-select" value="{$settings['enable_admin_contact']}">
+                                        <select id="enable_admin_contact" class="col form-select" value="{$settings['enable_admin_contact']}">
                                             <option value="0" {if $settings['enable_admin_contact'] == false}selected{/if}>关闭</option>
                                             <option value="1" {if $settings['enable_admin_contact'] == true}selected{/if}>开启</option>
                                         </select>

+ 3 - 0
resources/views/tabler/admin/tabler_header.tpl

@@ -116,6 +116,9 @@
                                                     <a href="/admin/setting/im" class="dropdown-item">
                                                       IM
                                                     </a>
+                                                    <a href="/admin/setting/feature" class="dropdown-item">
+                                                      功能
+                                                    </a>
                                                 </div>
                                             </div>
                                             <a class="dropdown-item" href="/admin/user">

+ 6 - 6
resources/views/tabler/auth/login.tpl

@@ -36,14 +36,14 @@
                             <span class="form-check-label">记住此设备</span>
                         </label>
                     </div>
-                    {if $config['enable_login_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+                    {if $public_setting['enable_login_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
                     <div class="mb-2">
                         <div class="input-group mb-2">
                             <div class="cf-turnstile" data-sitekey="{$captcha['turnstile_sitekey']}" data-theme="light"></div>
                         </div>
                     </div>
                     {/if}
-                    {if $config['enable_login_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+                    {if $public_setting['enable_login_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
                     <div class="mb-2">
                         <div class="input-group mb-2">
                             <div id="geetest"></div>
@@ -72,10 +72,10 @@
                     email: $('#email').val(),
                     passwd: $('#passwd').val(),
                     remember_me: $('#remember_me').val(),
-                    {if $config['enable_login_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+                    {if $public_setting['enable_login_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
                     turnstile: turnstile.getResponse(),
                     {/if}
-                    {if $config['enable_login_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+                    {if $public_setting['enable_login_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
                     geetest: geetest.getValidate(),
                     {/if}
                 },
@@ -93,10 +93,10 @@
         });
     </script>
 
-    {if $config['enable_login_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+    {if $public_setting['enable_login_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
     <script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha" async defer></script>
     {/if}
-    {if $config['enable_login_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+    {if $public_setting['enable_login_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
         <script src="http://static.geetest.com/v4/gt4.js"></script>
         <script>
             var geetest_result = '';

+ 14 - 14
resources/views/tabler/auth/register.tpl

@@ -28,11 +28,11 @@
                                 <input id="repasswd" type="password" class="form-control" placeholder="重复登录密码">
                             </div>
                         </div>
-                        {if $config['enable_reg_im'] == true}
+                        {if $public_setting['enable_reg_im'] == true}
                             <div class="mb-3">
                                 <select id="im_type" class="col form-select">
                                     <option value="0">请选择社交软件</option>
-                                    <option value="1">微信</option>
+                                    <option value="1">WeChat</option>
                                     <option value="2">QQ</option>
                                     <option value="4">Telegram</option>
                                     <option value="5">Discord</option>
@@ -44,14 +44,14 @@
                                 </div>
                             </div>
                         {/if}
-                        {if $config['register_mode'] != 'close' }
+                        {if $public_setting['reg_mode'] != 'close' }
                             <div class="mb-3">
                                 <div class="input-group input-group-flat">
-                                    <input id="code" type="text" class="form-control" placeholder="注册邀请码{if $config['register_mode'] == 'open'}(可选){else}(必填){/if}" value="{$code}">
+                                    <input id="code" type="text" class="form-control" placeholder="注册邀请码{if $public_setting['reg_mode'] == 'open'}(可选){else}(必填){/if}" value="{$code}">
                                 </div>
                             </div>
                         {/if}
-                        {if $config['enable_email_verify'] == true}
+                        {if $public_setting['reg_email_verify'] == true}
                             <div class="mb-3">
                                 <div class="input-group mb-2">
                                     <input id="emailcode" type="text" class="form-control" placeholder="邮箱验证码">
@@ -67,14 +67,14 @@
                                 </span>
                             </label>
                         </div>
-                        {if $config['enable_reg_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+                        {if $public_setting['enable_reg_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
                         <div class="mb-3">
                             <div class="input-group mb-2">
                                 <div class="cf-turnstile" data-sitekey="{$captcha['turnstile_sitekey']}" data-theme="light"></div>
                             </div>
                         </div>
                         {/if}
-                        {if $config['enable_reg_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+                        {if $public_setting['enable_reg_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
                         <div class="mb-2">
                             <div class="input-group mb-2">
                                 <div id="geetest"></div>
@@ -98,7 +98,7 @@
     </div>
 
     <script>
-        {if $config['enable_email_verify'] == true}
+        {if $public_setting['reg_email_verify'] === true}
             $("#email-verify").click(function() {
                 $.ajax({
                     type: 'POST',
@@ -126,11 +126,11 @@
                 url: '/auth/register',
                 dataType: "json",
                 data: {
-                    {if $config['enable_reg_im'] == true}
+                    {if $public_setting['enable_reg_im'] === true}
                         im_value: $('#im_value').val(),
                         im_type: $('#im_type').val(),
                     {/if}
-                    {if $config['enable_email_verify'] == true}
+                    {if $public_setting['reg_email_verify'] === true}
                         emailcode: $('#emailcode').val(),
                     {/if}
                     tos: $('#tos').prop('checked'), // true / false (string)
@@ -139,10 +139,10 @@
                     email: $('#email').val(),
                     passwd: $('#passwd').val(),
                     repasswd: $('#repasswd').val(),
-                    {if $config['enable_reg_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+                    {if $public_setting['enable_reg_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
                     turnstile: turnstile.getResponse(),
                     {/if}
-                    {if $config['enable_reg_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+                    {if $public_setting['enable_reg_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
                     geetest: geetest_result,
                     {/if}
                 },
@@ -160,10 +160,10 @@
         });
     </script>
 
-    {if $config['enable_reg_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+    {if $public_setting['enable_reg_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
     <script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha" async defer></script>
     {/if}
-    {if $config['enable_reg_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+    {if $public_setting['enable_reg_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
     <script src="http://static.geetest.com/v4/gt4.js"></script>
     <script>
         var geetest_result = '';

+ 4 - 4
resources/views/tabler/gateway/epay.tpl

@@ -7,22 +7,22 @@
         <input class="form-control maxwidth-edit" id="price" name="price" placeholder="输入金额,选择以下要付款的渠道"
             autofocus="autofocus" type="number" min="0.01" max="1000" step="0.01" required="required">
         <br />
-        {if $config['epay_alipay'] == true}
+        {if $public_setting['epay_alipay'] == true}
         <button class="btn btn-flat waves-attach" id="btnSubmit" type="submit" name="type" value="alipay">
             <img src="/images/alipay.png" height="50px" />
         </button>
         {/if}
-        {if $config['epay_wechat'] == true}
+        {if $public_setting['epay_wechat'] == true}
         <button class="btn btn-flat waves-attach" id="btnSubmit" type="submit" name="type" value="wxpay">
             <img src="/images/wechat.png" height="50px" />
         </button>
         {/if}
-        {if $config['epay_qq'] == true}
+        {if $public_setting['epay_qq'] == true}
         <button class="btn btn-flat waves-attach" id="btnSubmit" type="submit" name="type" value="qqpay">
             <img src="/images/qqpay.png" height="50px" />
         </button>
         {/if}
-        {if $config['epay_usdt'] == true}
+        {if $public_setting['epay_usdt'] == true}
         <button class="btn btn-flat waves-attach" id="btnSubmit" type="submit" name="type" value="usdt">
             <img src="/images/usdt.png" height="50px" />
         </button>

文件差异内容过多而无法显示
+ 2 - 0
resources/views/tabler/gateway/stripe_card.tpl


+ 10 - 13
resources/views/tabler/live_chat.tpl

@@ -1,8 +1,8 @@
-{if $config['live_chat'] == 'tawk'}
+{if $public_setting['live_chat'] == 'tawk'}
 <script type="text/javascript">
     var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
     (function(){
-        var id = "{$config['tawk_id']}";
+        var id = "{$public_setting['tawk_id']}";
         var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
         s1.async=true;
         s1.src='https://embed.tawk.to/' + id + '/default';
@@ -13,9 +13,9 @@
 </script>
 {/if}
 
-{if $config['live_chat'] == 'crisp'}
+{if $public_setting['live_chat'] == 'crisp'}
 <script type="text/javascript"> window.$crisp = [];
-    window.CRISP_WEBSITE_ID = "{$config["crisp_id"]}";
+    window.CRISP_WEBSITE_ID = "{$public_setting["crisp_id"]}";
     (function () {
         d = document;
         s = d.createElement("script");
@@ -41,12 +41,10 @@
 </script>
 {/if}
 
-{if $config['live_chat'] == 'livechat'}
+{if $public_setting['live_chat'] == 'livechat'}
 <script>
-{literal}
-window.__lc = window.__lc || {};
-{/literal}
-window.__lc.license = "{$config['livechat_id']}";;
+window.__lc = window.__lc || { };
+window.__lc.license = "{$public_setting['livechat_id']}";;
 window.__lc.params = [
     { name: '用户编号', value: '{$user->id}' },
     { name: '用户类别', value: '{$user->class}' },
@@ -57,7 +55,7 @@ window.__lc.params = [
     { name: '剩余流量', value: '{$user->unusedTraffic()}' },
     { name: '账户余额', value: '{$user->money}' }
 ];
-{literal}
+
 (function(n, t, c) {
     function i(n) {
         return e._h ? e._h.apply(null, n) : e._q.push(n)
@@ -93,13 +91,12 @@ window.__lc.params = [
     n.LiveChatWidget = n.LiveChatWidget || e
 } (window, document, [].slice))
 </script>
-{/literal}
 {/if}
 
-{if $config['live_chat'] == 'mylivechat'}
+{if $public_setting['live_chat'] == 'mylivechat'}
 <script type="text/javascript">
     (() => {
-        var hccid = "{$config['mylivechat_id']}";
+        var hccid = "{$public_setting['mylivechat_id']}";
         var nt = document.createElement("script");
         nt.async = true;
         nt.src = "https://mylivechat.com/chatinline.aspx?hccid=" + hccid;

+ 6 - 6
resources/views/tabler/password/reset.tpl

@@ -18,14 +18,14 @@
                         <label class="form-label">注册邮箱</label>
                         <input id="email" type="email" class="form-control">
                     </div>
-                    {if $config['enable_reset_password_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+                    {if $public_setting['enable_reset_password_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
                     <div class="mb-3">
                         <div class="input-group mb-3">
                             <div class="cf-turnstile" data-sitekey="{$captcha['turnstile_sitekey']}" data-theme="light"></div>
                         </div>
                     </div>
                     {/if}
-                    {if $config['enable_reset_password_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+                    {if $public_setting['enable_reset_password_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
                     <div class="mb-3">
                         <div class="input-group mb-3">
                             <div id="geetest"></div>
@@ -54,10 +54,10 @@
                 dataType: "json",
                 data: {
                     email: $('#email').val(),
-                    {if $config['enable_reset_password_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+                    {if $public_setting['enable_reset_password_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
                     turnstile: turnstile.getResponse(),
                     {/if}
-                    {if $config['enable_reset_password_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+                    {if $public_setting['enable_reset_password_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
                     geetest: geetest_result,
                     {/if}
                 },
@@ -78,10 +78,10 @@
         });
     </script>
 
-    {if $config['enable_reset_password_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+    {if $public_setting['enable_reset_password_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
     <script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha" async defer></script>
     {/if}
-    {if $config['enable_reset_password_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+    {if $public_setting['enable_reset_password_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
     <script src="http://static.geetest.com/v4/gt4.js"></script>
     <script>
         var geetest_result = '';

+ 3 - 0
resources/views/tabler/tabler_footer.tpl

@@ -47,6 +47,9 @@
 </div>
 
 <script src="//cdn.jsdelivr.net/npm/@tabler/core@latest/dist/js/tabler.min.js"></script>
+
+{include file='live_chat.tpl'}
+
 </body>
 
 </html>

+ 7 - 7
resources/views/tabler/user/code.tpl

@@ -16,16 +16,16 @@
                                 <div class="card-inner">
                                     <p class="card-heading">注意事项</p>
                                     <p>充值完成后需刷新网页以查看余额,通常一分钟内到账。因余额不足而未能完成的自动续费,在余额足够时会自动划扣续费。</p>
-                                    {if $config['enable_admin_contact'] == true}
+                                    {if $public_setting['enable_admin_contact'] == true}
                                         <p class="card-heading">如充值未到账,请联系:</p>
-                                        {if $config['admin_contact1'] != ''}
-                                            <li>{$config['admin_contact1']}</li>
+                                        {if $public_setting['admin_contact1'] != ''}
+                                            <li>{$public_setting['admin_contact1']}</li>
                                         {/if}
-                                        {if $config['admin_contact2'] != ''}
-                                            <li>{$config['admin_contact2']}</li>
+                                        {if $public_setting['admin_contact2'] != ''}
+                                            <li>{$public_setting['admin_contact2']}</li>
                                         {/if}
-                                        {if $config['admin_contact3'] != ''}
-                                            <li>{$config['admin_contact3']}</li>
+                                        {if $public_setting['admin_contact3'] != ''}
+                                            <li>{$public_setting['admin_contact3']}</li>
                                         {/if}
                                     {/if}
                                     <br/>

+ 6 - 6
resources/views/tabler/user/index.tpl

@@ -453,10 +453,10 @@
                                     {if !$user->isAbleToCheckin()}
                                     <button id="check-in" class="btn btn-primary ms-auto" disabled>已签到</button>
                                     {else}
-                                    {if $config['enable_checkin_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+                                    {if $public_setting['enable_checkin_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
                                     <div class="cf-turnstile" data-sitekey="{$captcha['turnstile_sitekey']}" data-theme="light"></div>
                                     {/if}
-                                    {if $config['enable_checkin_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+                                    {if $public_setting['enable_checkin_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
                                     <div id="geetest"></div>
                                     {/if} 
                                     <button id="check-in" class="btn btn-primary ms-auto">签到</button>
@@ -484,10 +484,10 @@
                 url: "/user/checkin",
                 dataType: "json",              
                 data: {
-                    {if $config['enable_checkin_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+                    {if $public_setting['enable_checkin_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
                     turnstile: turnstile.getResponse(),
                     {/if}
-                    {if $config['enable_checkin_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+                    {if $public_setting['enable_checkin_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
                     geetest: geetest_result,
                     {/if}
                 },
@@ -504,10 +504,10 @@
         });
     </script>
 
-    {if $config['enable_checkin_captcha'] === true && $config['captcha_provider'] === 'turnstile'}
+    {if $public_setting['enable_checkin_captcha'] === true && $public_setting['captcha_provider'] === 'turnstile'}
     <script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha" async defer></script>
     {/if}
-    {if $config['enable_checkin_captcha'] === true && $config['captcha_provider'] === 'geetest'}
+    {if $public_setting['enable_checkin_captcha'] === true && $public_setting['captcha_provider'] === 'geetest'}
     <script src="http://static.geetest.com/v4/gt4.js"></script>
     <script>
         var geetest_result = '';

+ 1 - 1
resources/views/tabler/user/invite.tpl

@@ -23,7 +23,7 @@
                         <div class="card-body">
                             <h3 class="card-title">邀请规则</h3>
                             <ul>
-                                <li>邀请注册的用户在账单确认后,您可获得其账单金额的 <code>{$config['code_payback'] * 100} %</code>
+                                <li>邀请注册的用户在账单确认后,您可获得其账单金额的 <code>{$public_setting['rebate_ratio'] * 100} %</code>
                                     作为返利</li>
                                 <li>具体邀请返利规则请查看公告,或通过工单系统询问管理员</li>
                                 <li>部分商品的返利比例可能不遵循上面的比例</li>

+ 2 - 13
resources/views/tabler/user/main.tpl

@@ -59,16 +59,11 @@
                         <li>
                             <a href="/user/edit"><i class="mdi mdi-account-edit icon-lg"></i>&nbsp;资料编辑</a>
                         </li>
-                        {if $config['subscribeLog']===true && $config['subscribeLog_show']===true}
+                        {if $config['enable_ticket']===true}
                         <li>
-                            <a href="/user/subscribe_log"><i class="mdi mdi-file-find icon-lg"></i>&nbsp;订阅记录</a>
+                            <a href="/user/ticket"><i class="mdi mdi-comment-question icon-lg"></i>&nbsp;工单系统</a>
                         </li>
                         {/if}
-                        {if $config['enable_ticket']===true}
-                            <li>
-                                <a href="/user/ticket"><i class="mdi mdi-comment-question icon-lg"></i>&nbsp;工单系统</a>
-                            </li>
-                        {/if}
                         <li>
                             <a href="/user/invite"><i class="mdi mdi-account-multiple-plus icon-lg"></i>&nbsp;邀请链接</a>
                         </li>
@@ -78,18 +73,12 @@
                         <li>
                             <a href="/user/server"><i class="mdi mdi-server icon-lg"></i>&nbsp;节点列表</a>
                         </li>
-                        <li>
-                            <a href="/user/media"><i class="mdi mdi-multimedia icon-lg"></i>&nbsp;流媒体解锁</a>
-                        </li>
                         <li>
                             <a href="/user/announcement"><i class="mdi mdi-bullhorn-variant icon-lg"></i>&nbsp;站点公告</a>
                         </li>
                         <li>
                             <a href="/user/detect"><i class="mdi mdi-account-filter icon-lg"></i>&nbsp;审计规则</a>
                         </li>
-                        <li>
-                            <a href="/user/detect/log"><i class="mdi mdi-calendar-filter icon-lg"></i>&nbsp;审计记录</a>
-                        </li>
                     </ul>
                     <a class="waves-attach" data-toggle="collapse" href="#ui_menu_help">商店</a>
                     <ul class="menu-collapse collapse in" id="ui_menu_help">

+ 35 - 49
resources/views/tabler/user/media.tpl

@@ -20,61 +20,47 @@
             <div class="row row-deck row-cards">
                 <div class="col-12">
                     <div class="card">
-                        {if $results != null}
-                            <div class="table-responsive">
-                                <table class="table card-table table-vcenter text-nowrap datatable">
-                                    <thead>
-                                        <tr>
-                                            <th>节点</th>
-                                            {foreach $results['0']['unlock_item'] as $key => $value}
-                                                {if $key != 'BilibiliChinaMainland'}
-                                                    {if $key == 'BilibiliHKMCTW'}
-                                                        <th>港澳台B站</th>
-                                                    {else if $key == 'BilibiliTW'}
-                                                        <th>台湾B站</th>
-                                                    {else}
-                                                        <th>{$key}</th>
-                                                    {/if}
+                        <div class="table-responsive">
+                            <table class="table card-table table-vcenter text-nowrap datatable">
+                                <thead>
+                                    <tr>
+                                        <th>节点</th>
+                                        {foreach $results['0']['unlock_item'] as $key => $value}
+                                            {if $key != 'BilibiliChinaMainland'}
+                                                {if $key == 'BilibiliHKMCTW'}
+                                                    <th>Bilibili(港澳台)</th>
+                                                {else if $key == 'BilibiliTW'}
+                                                    <th>Bilibili(台湾)</th>
+                                                {else}
+                                                    <th>{$key}</th>
                                                 {/if}
-                                            {/foreach}
-                                            <th>更新时间</th>
-                                        </tr>
-                                    </thead>
-                                    <tbody>
-                                        {foreach $results as $result}
-                                            <tr>
-                                                <td>{$result['node_name']}</td>
-                                                <td>{$result['unlock_item']['YouTube']}</td>
-                                                <td>{$result['unlock_item']['Netflix']}</td>
-                                                <td>{$result['unlock_item']['DisneyPlus']}</td>
-                                                <td>{$result['unlock_item']['BilibiliHKMCTW']}</td>
-                                                <td>{$result['unlock_item']['BilibiliTW']}</td>
-                                                <td>{$result['unlock_item']['MyTVSuper']}
-                                                <td>{$result['unlock_item']['BBC']}</td>
-                                                <td>{$result['unlock_item']['Abema']}</td>
-                                                <td>{date('Y-m-d H:i:s', $result['created_at'])}</td>
-                                            </tr>
+                                            {/if}
                                         {/foreach}
-                                    </tbody>
-                                </table>
-                            </div>
-                        {else}
-                            <div class="card-body">
-                                <p>管理员未启用此功能。</p>
-                            </div>
-                        {/if}
+                                        <th>更新时间</th>
+                                    </tr>
+                                </thead>
+                                <tbody>
+                                    {foreach $results as $result}
+                                        <tr>
+                                            <td>{$result['node_name']}</td>
+                                            <td>{$result['unlock_item']['YouTube']}</td>
+                                            <td>{$result['unlock_item']['Netflix']}</td>
+                                            <td>{$result['unlock_item']['DisneyPlus']}</td>
+                                            <td>{$result['unlock_item']['BilibiliHKMCTW']}</td>
+                                            <td>{$result['unlock_item']['BilibiliTW']}</td>
+                                            <td>{$result['unlock_item']['MyTVSuper']}
+                                            <td>{$result['unlock_item']['BBC']}</td>
+                                            <td>{$result['unlock_item']['Abema']}</td>
+                                            <td>{date('Y-m-d H:i:s', $result['created_at'])}</td>
+                                        </tr>
+                                    {/foreach}
+                                </tbody>
+                            </table>
+                        </div>
                     </div>
                 </div>
             </div>
         </div>
     </div>
-
-    <script>
-        // https://article.docway.net/it/details/60f8c4b1791936603cddc187    
-        $("td:contains('Yes')").css("color", "green");
-        $("td:contains('No')").css("color", "red");
-        $("td:contains('Unknow')").css("color", "orange");
-        $("td:contains('仅限自制')").css("color", "purple");
-    </script>
     
 {include file='user/tabler_footer.tpl'}

+ 3 - 0
resources/views/tabler/user/tabler_footer.tpl

@@ -91,6 +91,9 @@
 </script>
 <script src="//cdn.jsdelivr.net/npm/@tabler/core@latest/dist/js/tabler.min.js"></script>
 <script>console.table([['数据库查询', '执行时间'], ['{count($queryLog)} 次', '{$optTime} ms']])</script>
+
+{include file='live_chat.tpl'}
+
 </body>
 
 </html>

+ 15 - 11
resources/views/tabler/user/tabler_header.tpl

@@ -97,10 +97,10 @@
                                                 资料修改
                                             </a>
                                             {if $config['enable_ticket'] == true}
-                                                <a class="dropdown-item" href="/user/ticket">
-                                                    <i class="ti ti-ticket"></i>&nbsp;
-                                                    工单系统
-                                                </a>
+                                            <a class="dropdown-item" href="/user/ticket">
+                                                <i class="ti ti-ticket"></i>&nbsp;
+                                                工单系统
+                                            </a>
                                             {/if}
                                             <a class="dropdown-item" href="/user/invite">
                                                 <i class="ti ti-friends"></i>&nbsp;
@@ -125,10 +125,12 @@
                                         <i class="ti ti-server"></i>&nbsp;
                                         节点列表
                                     </a>
+                                    {if $public_setting['display_media'] === true}
                                     <a class="dropdown-item" href="/user/media">
                                         <i class="ti ti-key"></i>&nbsp;
                                         流媒体解锁
                                     </a>
+                                    {/if}
                                 </div>
                             </li>
                             <li class="nav-item dropdown">
@@ -138,7 +140,7 @@
                                         <i class="ti ti-dots-circle-horizontal icon"></i>
                                     </span>
                                     <span class="nav-link-title">
-                                        更多
+                                        信息
                                     </span>
                                 </a>
                                 <div class="dropdown-menu">
@@ -146,11 +148,11 @@
                                         <i class="ti ti-speakerphone"></i>&nbsp;
                                         站点公告
                                     </a>
-                                    {if $config['subscribeLog_show'] == true && $config['subscribeLog'] == true}
-                                        <a class="dropdown-item" href="/user/subscribe/log">
-                                            <i class="ti ti-rss"></i></i>&nbsp;
-                                            订阅日志
-                                        </a>
+                                    {if $public_setting['display_subscribe_log'] === true}
+                                    <a class="dropdown-item" href="/user/subscribe/log">
+                                        <i class="ti ti-rss"></i></i>&nbsp;
+                                        订阅日志
+                                    </a>
                                     {/if}
                                 </div>
                             </li>
@@ -169,10 +171,12 @@
                                         <i class="ti ti-barrier-block"></i>&nbsp;
                                         审计规则
                                     </a>
+                                    {if $public_setting['display_detect_log'] === true}
                                     <a class="dropdown-item" href="/user/detect/log">
                                         <i class="ti ti-notes"></i>&nbsp;
                                         审计日志
                                     </a>
+                                    {/if}
                                 </div>
                             </li>
                             <li class="nav-item dropdown">
@@ -216,4 +220,4 @@
                     </div>
                 </div>
             </div>
-</header>
+</header>

+ 65 - 0
src/Controllers/Admin/Setting/FeatureController.php

@@ -0,0 +1,65 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Controllers\Admin\Setting;
+
+use App\Controllers\BaseController;
+use App\Models\Setting;
+
+final class FeatureController extends BaseController
+{
+    public static $update_field = [
+        'display_media',
+        'display_subscribe_log',
+        'display_detect_log',
+    ];
+
+    public function feature($request, $response, $args)
+    {
+        $settings = [];
+        $settings_raw = Setting::get(['item', 'value', 'type']);
+
+        foreach ($settings_raw as $setting) {
+            if ($setting->type === 'bool') {
+                $settings[$setting->item] = (bool) $setting->value;
+            } else {
+                $settings[$setting->item] = (string) $setting->value;
+            }
+        }
+
+        return $response->write(
+            $this->view()
+                ->assign('update_field', self::$update_field)
+                ->assign('settings', $settings)
+                ->fetch('admin/setting/feature.tpl')
+        );
+    }
+
+    public function saveFeature($request, $response, $args)
+    {
+        $list = self::$update_field;
+
+        foreach ($list as $item) {
+            $setting = Setting::where('item', '=', $item)->first();
+
+            if ($setting->type === 'array') {
+                $setting->value = \json_encode($request->getParam("${item}"));
+            } else {
+                $setting->value = $request->getParam("${item}");
+            }
+
+            if (! $setting->save()) {
+                return $response->withJson([
+                    'ret' => 0,
+                    'msg' => "保存 ${item} 时出错",
+                ]);
+            }
+        }
+
+        return $response->withJson([
+            'ret' => 1,
+            'msg' => '保存成功',
+        ]);
+    }
+}

+ 0 - 2
src/Controllers/Admin/Setting/RefController.php

@@ -12,8 +12,6 @@ final class RefController extends BaseController
     public static $update_field = [
         'invitation_to_register_balance_reward',
         'invitation_to_register_traffic_reward',
-        'invite_price',
-        'custom_invite_price',
         'invitation_mode',
         'invite_rebate_mode',
         'rebate_ratio',

+ 0 - 4
src/Controllers/User/LogController.php

@@ -20,10 +20,6 @@ final class LogController extends BaseController
      */
     public function subscribe(ServerRequest $request, Response $response, array $args)
     {
-        if ($_ENV['subscribeLog_show'] === false) {
-            return $response->withStatus(302)->withHeader('Location', '/user');
-        }
-
         $logs = UserSubscribeLog::orderBy('id', 'desc')->where('user_id', $this->user->id)->get();
 
         return $response->write($this->view()

+ 0 - 74
src/Controllers/UserController.php

@@ -415,80 +415,6 @@ final class UserController extends BaseController
             ->fetch('user/invite.tpl'));
     }
 
-    /**
-     * @param array     $args
-     */
-    public function buyInvite(ServerRequest $request, Response $response, array $args)
-    {
-        $antiXss = new AntiXSS();
-
-        $price = Setting::obtain('invite_price');
-        $num = $antiXss->xss_clean($request->getParam('num'));
-        $num = trim($num);
-
-        if (! Tools::isInt($num) || $price < 0 || $num <= 0) {
-            return ResponseHelper::error($response, '非法请求');
-        }
-
-        $amount = $price * $num;
-
-        $user = $this->user;
-
-        if (! $user->isLogin) {
-            return $response->withJson([ 'ret' => -1 ]);
-        }
-
-        if ($user->money < $amount) {
-            return ResponseHelper::error($response, '余额不足,总价为' . $amount . '元。');
-        }
-        $user->invite_num += $num;
-        $user->money -= $amount;
-        $user->save();
-
-        return ResponseHelper::successfully($response, '邀请次数添加成功');
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function customInvite(ServerRequest $request, Response $response, array $args)
-    {
-        $antiXss = new AntiXSS();
-
-        $price = Setting::obtain('custom_invite_price');
-        $customcode = trim($antiXss->xss_clean($request->getParam('customcode')));
-
-        if (Tools::isSpecialChars($customcode) || $price < 0 || $customcode === '' || strlen($customcode) > 32) {
-            return ResponseHelper::error(
-                $response,
-                '定制失败,邀请链接不能为空,后缀不能包含特殊符号且长度不能大于32字符'
-            );
-        }
-
-        if (InviteCode::where('code', $customcode)->count() !== 0) {
-            return ResponseHelper::error($response, '此后缀名被抢注了');
-        }
-
-        $user = $this->user;
-
-        if (! $user->isLogin) {
-            return $response->withJson([ 'ret' => -1 ]);
-        }
-
-        if ($user->money < $price) {
-            return ResponseHelper::error(
-                $response,
-                '余额不足,总价为' . $price . '元。'
-            );
-        }
-        $code = InviteCode::where('user_id', $user->id)->first();
-        $code->code = $customcode;
-        $user->money -= $price;
-        $user->save();
-        $code->save();
-        return ResponseHelper::successfully($response, '定制成功');
-    }
-
     /**
      * @param array     $args
      */

+ 0 - 1
src/Models/User.php

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

+ 1 - 46
src/Services/Config.php

@@ -4,8 +4,6 @@ declare(strict_types=1);
 
 namespace App\Services;
 
-use App\Models\Setting;
-
 // Config is singleton instance store all config
 final class Config
 {
@@ -15,52 +13,10 @@ final class Config
 
     public static function getPublicConfig()
     {
-        $public_configs = Setting::getPublicConfig();
-
-        // 鉴于还未完成配置的全面数据库化,先这么用着
-
         return [
-            'version' => VERSION,
             'appName' => $_ENV['appName'],
             'baseUrl' => $_ENV['baseUrl'],
-            // 充值
-            'stripe_min_recharge' => $public_configs['stripe_min_recharge'],
-            'stripe_max_recharge' => $public_configs['stripe_max_recharge'],
-            // 客服系统
-            'live_chat' => $public_configs['live_chat'],
-            'tawk_id' => $public_configs['tawk_id'],
-            'crisp_id' => $public_configs['crisp_id'],
-            'livechat_id' => $public_configs['livechat_id'],
-            'mylivechat_id' => $public_configs['mylivechat_id'],
-            // 联系方式
-            'enable_admin_contact' => $public_configs['enable_admin_contact'],
-            'admin_contact1' => $public_configs['admin_contact1'],
-            'admin_contact2' => $public_configs['admin_contact2'],
-            'admin_contact3' => $public_configs['admin_contact3'],
-            // 验证码
-            'captcha_provider' => $public_configs['captcha_provider'],
-            'enable_reg_captcha' => $public_configs['enable_reg_captcha'],
-            'enable_login_captcha' => $public_configs['enable_login_captcha'],
-            'enable_checkin_captcha' => $public_configs['enable_checkin_captcha'],
-            'enable_reset_password_captcha' => $public_configs['enable_reset_password_captcha'],
-            // 注册
-            'register_mode' => $public_configs['reg_mode'],
-            'enable_email_verify' => $public_configs['reg_email_verify'],
-            'enable_reg_im' => $public_configs['enable_reg_im'],
-            'min_port' => $public_configs['min_port'],
-            'max_port' => $public_configs['max_port'],
-            'invite_price' => $public_configs['invite_price'],
-            'custom_invite_price' => $public_configs['custom_invite_price'],
-            // 邀请
-            'invite_get_money' => $public_configs['invitation_to_register_balance_reward'],
-            'invite_gift' => $public_configs['invitation_to_register_traffic_reward'],
-            'code_payback' => $public_configs['rebate_ratio'],
-            // EPay
-            'epay_alipay' => $public_configs['epay_alipay'],
-            'epay_wechat' => $public_configs['epay_wechat'],
-            'epay_qq' => $public_configs['epay_qq'],
-            'epay_usdt' => $public_configs['epay_usdt'],
-            // 待处理
+
             'enable_checkin' => $_ENV['enable_checkin'],
             'checkinMin' => $_ENV['checkinMin'],
             'checkinMax' => $_ENV['checkinMax'],
@@ -78,7 +34,6 @@ final class Config
             'enable_telegram_login' => $_ENV['enable_telegram_login'],
 
             'subscribeLog' => $_ENV['subscribeLog'],
-            'subscribeLog_show' => $_ENV['subscribeLog_show'],
             'subscribeLog_keep_days' => $_ENV['subscribeLog_keep_days'],
 
             'enable_auto_detect_ban' => $_ENV['enable_auto_detect_ban'],

+ 3 - 0
src/Services/View.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace App\Services;
 
+use App\Models\Setting;
 use App\Utils;
 use Smarty;
 
@@ -28,11 +29,13 @@ final class View
         if (Utils\Cookie::get('old_uid') && Utils\Cookie::get('old_email') && Utils\Cookie::get('old_key') && Utils\Cookie::get('old_ip') && Utils\Cookie::get('old_expire_in') && Utils\Cookie::get('old_local')) {
             $can_backtoadmin = 1;
         }
+
         $smarty->settemplatedir(BASE_PATH . '/resources/views/' . $theme . '/'); //设置模板文件存放目录
         $smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/'); //设置生成文件存放目录
         $smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/'); //设置缓存文件存放目录
         // add config
         $smarty->assign('config', Config::getPublicConfig());
+        $smarty->assign('public_setting', Setting::getPublicConfig());
         $smarty->assign('user', $user);
         $smarty->assign('can_backtoadmin', $can_backtoadmin);
 

部分文件因为文件数量过多而无法显示