浏览代码

feat: database config for telegram bot settings

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

+ 6 - 4
app/routes.php

@@ -51,7 +51,6 @@ return static function (Slim\App $app): void {
 
 
         // 审计
         // 审计
         $group->get('/detect', App\Controllers\User\DetectController::class . ':index');
         $group->get('/detect', App\Controllers\User\DetectController::class . ':index');
-        $group->get('/detect/log', App\Controllers\User\DetectController::class . ':log');
 
 
         $group->get('/shop', App\Controllers\User\ShopController::class . ':shop');
         $group->get('/shop', App\Controllers\User\ShopController::class . ':shop');
         $group->post('/coupon_check', App\Controllers\User\ShopController::class . ':couponCheck');
         $group->post('/coupon_check', App\Controllers\User\ShopController::class . ':couponCheck');
@@ -85,10 +84,12 @@ return static function (Slim\App $app): void {
 
 
         $group->get('/code_check', App\Controllers\UserController::class . ':codeCheck');
         $group->get('/code_check', App\Controllers\UserController::class . ':codeCheck');
         $group->post('/code', App\Controllers\UserController::class . ':codePost');
         $group->post('/code', App\Controllers\UserController::class . ':codePost');
+
         // MFA
         // MFA
         $group->post('/ga_check', App\Controllers\User\MFAController::class . ':checkGa');
         $group->post('/ga_check', App\Controllers\User\MFAController::class . ':checkGa');
         $group->post('/ga_set', App\Controllers\User\MFAController::class . ':setGa');
         $group->post('/ga_set', App\Controllers\User\MFAController::class . ':setGa');
         $group->post('/ga_reset', App\Controllers\User\MFAController::class . ':resetGa');
         $group->post('/ga_reset', App\Controllers\User\MFAController::class . ':resetGa');
+
         // Telegram
         // Telegram
         $group->post('/telegram_reset', App\Controllers\UserController::class . ':resetTelegram');
         $group->post('/telegram_reset', App\Controllers\UserController::class . ':resetTelegram');
         $group->get('/bought', App\Controllers\UserController::class . ':bought');
         $group->get('/bought', App\Controllers\UserController::class . ':bought');
@@ -96,11 +97,12 @@ return static function (Slim\App $app): void {
         $group->post('/url_reset', App\Controllers\UserController::class . ':resetURL');
         $group->post('/url_reset', App\Controllers\UserController::class . ':resetURL');
         $group->put('/invite', App\Controllers\UserController::class . ':resetInviteURL');
         $group->put('/invite', App\Controllers\UserController::class . ':resetInviteURL');
 
 
-        //深色模式
+        //深色模式切换
         $group->post('/switch_theme_mode', App\Controllers\UserController::class . ':switchThemeMode');
         $group->post('/switch_theme_mode', App\Controllers\UserController::class . ':switchThemeMode');
 
 
-        // 订阅记录
-        $group->get('/subscribe_log', App\Controllers\UserController::class . ':subscribeLog');
+        // 记录
+        $group->get('/subscribe/log', App\Controllers\User\LogController::class . ':subscribe');
+        $group->get('/detect/log', App\Controllers\User\LogController::class . ':detect');
 
 
         // getUserAllURL
         // getUserAllURL
         $group->get('/getUserAllURL', App\Controllers\UserController::class . ':getUserAllURL');
         $group->get('/getUserAllURL', App\Controllers\UserController::class . ':getUserAllURL');

+ 2 - 29
config/.config.example.php

@@ -116,30 +116,10 @@ $_ENV['enable_telegram']                    = false;        //是否开启 Teleg
 $_ENV['telegram_token']                     = '';           //Telegram bot,bot 的 token ,跟 father bot 申请
 $_ENV['telegram_token']                     = '';           //Telegram bot,bot 的 token ,跟 father bot 申请
 $_ENV['telegram_chatid']                    = -111;         //Telegram bot,群组会话 ID,把机器人拉进群里之后跟他 /ping 一下即可得到
 $_ENV['telegram_chatid']                    = -111;         //Telegram bot,群组会话 ID,把机器人拉进群里之后跟他 /ping 一下即可得到
 $_ENV['telegram_bot']                       = '_bot';       //Telegram 机器人账号
 $_ENV['telegram_bot']                       = '_bot';       //Telegram 机器人账号
-$_ENV['telegram_group_quiet']               = false;        //Telegram 机器人在群组中不回应
 $_ENV['telegram_request_token']             = '';           //Telegram 机器人请求Key,随意设置,由大小写英文和数字组成,更新这个参数之后请 php xcat Tool setTelegram
 $_ENV['telegram_request_token']             = '';           //Telegram 机器人请求Key,随意设置,由大小写英文和数字组成,更新这个参数之后请 php xcat Tool setTelegram
 
 
-# 通用
-$_ENV['finance_public']                     = true;         //财务报告是否向群公开
-$_ENV['enable_welcome_message']             = true;         //机器人发送欢迎消息
-
-# Telegram BOT 其他选项
-$_ENV['allow_to_join_new_groups']           = true;         //允许 Bot 加入下方配置之外的群组
-$_ENV['group_id_allowed_to_join']           = [];           //允许加入的群组 ID,格式为 PHP 数组
-$_ENV['telegram_admins']                    = [];           //额外的 Telegram 管理员 ID,格式为 PHP 数组
-$_ENV['enable_not_admin_reply']             = true;         //非管理员操作管理员功能是否回复
-$_ENV['not_admin_reply_msg']                = '!';          //非管理员操作管理员功能的回复内容
-$_ENV['no_user_found']                      = '!';          //管理员操作时,找不到用户的回复
-$_ENV['no_search_value_provided']           = '!';          //管理员操作时,没有提供用户搜索值的回复
-$_ENV['data_method_not_found']              = '!';          //管理员操作时,修改数据的字段没有找到的回复
-$_ENV['delete_message_time']                = 180;          //在以下时间后删除用户命令触发的 bot 回复,单位:秒,删除时间可能会因为定时任务而有差异,为 0 代表不开启此功能
-$_ENV['delete_admin_message_time']          = 86400;        //在以下时间后删除管理命令触发的 bot 回复,单位:秒,删除时间可能会因为定时任务而有差异,为 0 代表不开启此功能
-$_ENV['enable_delete_user_cmd']             = false;        //自动删除群组中用户发送的命令,使用 delete_message_time 配置的时间,删除时间可能会因为定时任务而有差异
-$_ENV['help_any_command']                   = false;        //允许任意未知的命令触发 /help 的回复
-
 $_ENV['remark_user_search_email']           = ['邮箱'];                     //用户搜索字段 email 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_search_email']           = ['邮箱'];                     //用户搜索字段 email 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_search_port']            = ['端口'];                     //用户搜索字段 port 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_search_port']            = ['端口'];                     //用户搜索字段 port 的别名,可多个,格式为 PHP 数组
-
 $_ENV['remark_user_option_is_admin']        = ['管理员'];                   //用户搜索字段 is_admin 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_option_is_admin']        = ['管理员'];                   //用户搜索字段 is_admin 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_option_enable']          = ['用户启用'];                  //用户搜索字段 enable 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_option_enable']          = ['用户启用'];                  //用户搜索字段 enable 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_option_money']           = ['金钱', '余额'];             //用户搜索字段 money 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_option_money']           = ['金钱', '余额'];             //用户搜索字段 money 的别名,可多个,格式为 PHP 数组
@@ -155,11 +135,6 @@ $_ENV['remark_user_option_expire_in']       = ['账号过期时间'];
 $_ENV['remark_user_option_node_speedlimit'] = ['限速'];                    //用户搜索字段 node_speedlimit 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_option_node_speedlimit'] = ['限速'];                    //用户搜索字段 node_speedlimit 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_option_node_connector']  = ['连接数', '客户端'];         //用户搜索字段 node_connector 的别名,可多个,格式为 PHP 数组
 $_ENV['remark_user_option_node_connector']  = ['连接数', '客户端'];         //用户搜索字段 node_connector 的别名,可多个,格式为 PHP 数组
 
 
-$_ENV['enable_user_email_group_show']       = false;                      //开启在群组搜寻用户信息时显示用户完整邮箱,关闭则会对邮箱中间内容打码,如 g****@gmail.com
-$_ENV['user_not_bind_reply']                = '您未绑定本站账号,您可以进入网站的 **资料编辑**,在右下方绑定您的账号.';                      //未绑定账户的回复
-$_ENV['telegram_general_pricing']           = '产品介绍.';                  //面向游客的产品介绍
-$_ENV['telegram_general_terms']             = '服务条款.';                  //面向游客的服务条款
-
 //社交登录设置
 //社交登录设置
 #Telegram
 #Telegram
 $_ENV['enable_telegram_login']              = false;   //开启这个设置前请先配置 Telegram bot 否则不会生效
 $_ENV['enable_telegram_login']              = false;   //开启这个设置前请先配置 Telegram bot 否则不会生效
@@ -168,8 +143,8 @@ $_ENV['enable_telegram_login']              = false;   //开启这个设置前
 $_ENV['enable_ticket']        = true;        //是否开启工单系统
 $_ENV['enable_ticket']        = true;        //是否开启工单系统
 $_ENV['mail_ticket']          = true;        //是否开启工单邮件提醒
 $_ENV['mail_ticket']          = true;        //是否开启工单邮件提醒
 
 
-# Server酱 用户提交新工单或者回复工单时用微信提醒机场主 https://sct.ftqq.com/
-$_ENV['useScFtqq']            = false;        //是否开启工单Server酱提醒
+# Server酱 https://sct.ftqq.com/
+$_ENV['useScFtqq']            = false;        //是否开启Server酱提醒工单/节点上下线
 $_ENV['ScFtqq_SCKEY']         = '';           //请填写您在Server酱获取的SCKEY  请仔细检查勿粘贴错
 $_ENV['ScFtqq_SCKEY']         = '';           //请填写您在Server酱获取的SCKEY  请仔细检查勿粘贴错
 
 
 #后台商品列表 销量统计
 #后台商品列表 销量统计
@@ -184,8 +159,6 @@ $_ENV['detect_gfw_count']                = '3';
 
 
 #离线检测
 #离线检测
 $_ENV['enable_detect_offline']           = true;
 $_ENV['enable_detect_offline']           = true;
-#离线检测是否推送到Server酱 请配置好上文的Server配置
-$_ENV['enable_detect_offline_useScFtqq'] = false;
 
 
 //以下所有均为高级设置(一般用不上,不用改---------------------------------------------------------------------
 //以下所有均为高级设置(一般用不上,不用改---------------------------------------------------------------------
 
 

+ 140 - 0
config/settings.json

@@ -1219,6 +1219,146 @@
         "default": "https://t.me/joinchat/XXXXX",
         "default": "https://t.me/joinchat/XXXXX",
         "mark": "用户群组链接"
         "mark": "用户群组链接"
     },
     },
+    {
+        "id": null,
+        "item": "enable_welcome_message",
+        "value": "0",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "bool",
+        "default": "0",
+        "mark": "Telegram 机器人发送欢迎消息"
+    },
+    {
+        "id": null,
+        "item": "telegram_group_quiet",
+        "value": "1",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "bool",
+        "default": "1",
+        "mark": "Telegram 机器人在群组中不回应"
+    },
+    {
+        "id": null,
+        "item": "allow_to_join_new_groups",
+        "value": "0",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "bool",
+        "default": "0",
+        "mark": "允许 Bot 加入下方配置之外的群组"
+    },
+    {
+        "id": null,
+        "item": "group_id_allowed_to_join",
+        "value": "[]",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "array",
+        "default": "[]",
+        "mark": "允许加入的群组 ID"
+    },
+    {
+        "id": null,
+        "item": "telegram_admins",
+        "value": "[]",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "array",
+        "default": "[]",
+        "mark": "额外的 Telegram 管理员 ID"
+    },
+    {
+        "id": null,
+        "item": "enable_not_admin_reply",
+        "value": "0",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "bool",
+        "default": "0",
+        "mark": "非管理员操作管理员功能是否回复"
+    },
+    {
+        "id": null,
+        "item": "not_admin_reply_msg",
+        "value": "",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "string",
+        "default": "",
+        "mark": "非管理员操作管理员功能的回复内容"
+    },
+    {
+        "id": null,
+        "item": "no_user_found",
+        "value": "",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "string",
+        "default": "",
+        "mark": "管理员操作时,找不到用户的回复"
+    },
+    {
+        "id": null,
+        "item": "data_method_not_found",
+        "value": "",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "string",
+        "default": "",
+        "mark": "管理员操作时,修改数据的字段没有找到的回复"
+    },
+    {
+        "id": null,
+        "item": "help_any_command",
+        "value": "0",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "bool",
+        "default": "0",
+        "mark": "允许任意未知的命令触发 /help 的回复"
+    },
+    {
+        "id": null,
+        "item": "enable_user_email_group_show",
+        "value": "0",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "bool",
+        "default": "0",
+        "mark": "开启在群组搜寻用户信息时显示用户完整邮箱,关闭则会对邮箱中间内容打码"
+    },
+    {
+        "id": null,
+        "item": "user_not_bind_reply",
+        "value": "您未绑定本站账号,您可以进入网站的 **资料编辑**,在右下方绑定您的账号。",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "string",
+        "default": "您未绑定本站账号,您可以进入网站的 **资料编辑**,在右下方绑定您的账号。",
+        "mark": "未绑定账户的回复"
+    },
+    {
+        "id": null,
+        "item": "telegram_general_pricing",
+        "value": "",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "string",
+        "default": "",
+        "mark": "面向游客的产品介绍"
+    },
+    {
+        "id": null,
+        "item": "telegram_general_terms",
+        "value": "",
+        "class": "telegram",
+        "is_public": 0,
+        "type": "string",
+        "default": "",
+        "mark": "面向游客的服务条款"
+    },
     {
     {
         "id": null,
         "id": null,
         "item": "db_version",
         "item": "db_version",

+ 1 - 0
phpinsights.php

@@ -14,6 +14,7 @@ return [
         PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\EvalSniff::class,
         PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\EvalSniff::class,
         PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\GlobalKeywordSniff::class,
         PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\GlobalKeywordSniff::class,
         PhpCsFixer\Fixer\Import\OrderedImportsFixer::class,
         PhpCsFixer\Fixer\Import\OrderedImportsFixer::class,
+        PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer::class,
         SlevomatCodingStandard\Sniffs\ControlStructures\DisallowShortTernaryOperatorSniff::class,
         SlevomatCodingStandard\Sniffs\ControlStructures\DisallowShortTernaryOperatorSniff::class,
         SlevomatCodingStandard\Sniffs\Classes\ForbiddenPublicPropertySniff::class,
         SlevomatCodingStandard\Sniffs\Classes\ForbiddenPublicPropertySniff::class,
         SlevomatCodingStandard\Sniffs\Classes\ModernClassNameReferenceSniff::class,
         SlevomatCodingStandard\Sniffs\Classes\ModernClassNameReferenceSniff::class,

+ 1 - 1
resources/views/tabler/admin/node/create.tpl

@@ -74,7 +74,7 @@
                                 <label class="form-label col-3 col-form-label">自定义配置</label>
                                 <label class="form-label col-3 col-form-label">自定义配置</label>
                                 <dev id="custom_config"></dev>
                                 <dev id="custom_config"></dev>
                                 <label class="form-label col-form-label">
                                 <label class="form-label col-form-label">
-                                    请参考 <a href="//wiki.sspanel.org/#/setup-custom-config" target="_blank">wiki.sspanel.org/#/setup-custom-config</a> 修改节点自定义配置
+                                    请参考 <a href="//wiki.sspanel.org/#/custom-config" target="_blank">wiki.sspanel.org/#/custom-config</a> 修改节点自定义配置
                                 </label>
                                 </label>
                             </div>
                             </div>
                             <div class="mb-3">
                             <div class="mb-3">

+ 1 - 1
resources/views/tabler/admin/node/edit.tpl

@@ -74,7 +74,7 @@
                                 <label class="form-label col-3 col-form-label">自定义配置</label>
                                 <label class="form-label col-3 col-form-label">自定义配置</label>
                                 <dev id="custom_config"></dev>
                                 <dev id="custom_config"></dev>
                                 <label class="form-label col-form-label">
                                 <label class="form-label col-form-label">
-                                    请参考 <a href="//wiki.sspanel.org/#/setup-custom-config" target="_blank">wiki.sspanel.org/#/setup-custom-config</a> 修改节点自定义配置
+                                    请参考 <a href="//wiki.sspanel.org/#/custom-config" target="_blank">wiki.sspanel.org/#/custom-config</a> 修改节点自定义配置
                                 </label>
                                 </label>
                             </div>
                             </div>
                             <div class="mb-3">
                             <div class="mb-3">

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

@@ -214,6 +214,108 @@
                                         <input id="telegram_group_link" type="text" class="form-control" value="{$settings['telegram_group_link']}">
                                         <input id="telegram_group_link" type="text" class="form-control" value="{$settings['telegram_group_link']}">
                                     </div>
                                     </div>
                                 </div>
                                 </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">Telegram 机器人发送欢迎消息</label>
+                                    <div class="col">
+                                        <select id="enable_welcome_message" class="col form-select" value="{$settings['enable_welcome_message']}">
+                                            <option value="0" {if $settings['enable_welcome_message'] == false}selected{/if}>关闭</option>
+                                            <option value="1" {if $settings['enable_welcome_message'] == true}selected{/if}>开启</option>
+                                        </select>
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">Telegram 机器人在群组中不回应</label>
+                                    <div class="col">
+                                        <select id="telegram_group_quiet" class="col form-select" value="{$settings['telegram_group_quiet']}">
+                                            <option value="0" {if $settings['telegram_group_quiet'] == false}selected{/if}>关闭</option>
+                                            <option value="1" {if $settings['telegram_group_quiet'] == true}selected{/if}>开启</option>
+                                        </select>
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">允许 Bot 加入下方配置之外的群组</label>
+                                    <div class="col">
+                                        <select id="allow_to_join_new_groups" class="col form-select" value="{$settings['allow_to_join_new_groups']}">
+                                            <option value="0" {if $settings['allow_to_join_new_groups'] == false}selected{/if}>关闭</option>
+                                            <option value="1" {if $settings['allow_to_join_new_groups'] == true}selected{/if}>开启</option>
+                                        </select>
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">允许加入的群组 ID</label>
+                                    <div class="col">
+                                        <input id="group_id_allowed_to_join" type="text" class="form-control" value="{$settings['group_id_allowed_to_join']}">
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">额外的 Telegram 管理员 ID</label>
+                                    <div class="col">
+                                        <input id="telegram_admins" type="text" class="form-control" value="{$settings['telegram_admins']}">
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">非管理员操作管理员功能是否回复</label>
+                                    <div class="col">
+                                        <select id="enable_not_admin_reply" class="col form-select" value="{$settings['enable_not_admin_reply']}">
+                                            <option value="0" {if $settings['enable_not_admin_reply'] == false}selected{/if}>关闭</option>
+                                            <option value="1" {if $settings['enable_not_admin_reply'] == 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">
+                                        <input id="not_admin_reply_msg" type="text" class="form-control" value="{$settings['not_admin_reply_msg']}">
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">管理员操作时,找不到用户的回复</label>
+                                    <div class="col">
+                                        <input id="no_user_found" type="text" class="form-control" value="{$settings['no_user_found']}">
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">管理员操作时,修改数据的字段没有找到的回复</label>
+                                    <div class="col">
+                                        <input id="data_method_not_found" type="text" class="form-control" value="{$settings['data_method_not_found']}">
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">允许任意未知的命令触发 /help 的回复</label>
+                                    <div class="col">
+                                        <select id="help_any_command" class="col form-select" value="{$settings['help_any_command']}">
+                                            <option value="0" {if $settings['help_any_command'] == false}selected{/if}>关闭</option>
+                                            <option value="1" {if $settings['help_any_command'] == 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="enable_user_email_group_show" class="col form-select" value="{$settings['enable_user_email_group_show']}">
+                                            <option value="0" {if $settings['enable_user_email_group_show'] == false}selected{/if}>关闭</option>
+                                            <option value="1" {if $settings['enable_user_email_group_show'] == 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">
+                                        <input id="user_not_bind_reply" type="text" class="form-control" value="{$settings['user_not_bind_reply']}">
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">面向游客的产品介绍</label>
+                                    <div class="col">
+                                        <input id="telegram_general_pricing" type="text" class="form-control" value="{$settings['telegram_general_pricing']}">
+                                    </div>
+                                </div>
+                                <div class="form-group mb-3 row">
+                                    <label class="form-label col-3 col-form-label">面向游客的服务条款</label>
+                                    <div class="col">
+                                        <input id="telegram_general_terms" type="text" class="form-control" value="{$settings['telegram_general_terms']}">
+                                    </div>
+                                </div>
                             </div>
                             </div>
                         </div>
                         </div>
                     </div>
                     </div>

+ 0 - 0
resources/views/tabler/user/subscribe_log.tpl → resources/views/tabler/user/subscribe/log.tpl


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

@@ -147,7 +147,7 @@
                                         站点公告
                                         站点公告
                                     </a>
                                     </a>
                                     {if $config['subscribeLog_show'] == true && $config['subscribeLog'] == true}
                                     {if $config['subscribeLog_show'] == true && $config['subscribeLog'] == true}
-                                        <a class="dropdown-item" href="/user/subscribe_log">
+                                        <a class="dropdown-item" href="/user/subscribe/log">
                                             <i class="ti ti-rss"></i></i>&nbsp;
                                             <i class="ti ti-rss"></i></i>&nbsp;
                                             订阅日志
                                             订阅日志
                                         </a>
                                         </a>
@@ -201,16 +201,16 @@
                                 </div>
                                 </div>
                             </li>
                             </li>
                             {if $user->is_admin}
                             {if $user->is_admin}
-                                <li class="nav-item">
-                                    <a class="nav-link" href="/admin">
-                                        <span class="nav-link-icon d-md-none d-lg-inline-block">
-                                            <i class="ti ti-settings icon"></i>
-                                        </span>
-                                        <span class="nav-link-title">
-                                            管理
-                                        </span>
-                                    </a>
-                                </li>
+                            <li class="nav-item">
+                                <a class="nav-link" href="/admin">
+                                    <span class="nav-link-icon d-md-none d-lg-inline-block">
+                                        <i class="ti ti-settings icon"></i>
+                                    </span>
+                                    <span class="nav-link-title">
+                                        管理
+                                    </span>
+                                </a>
+                            </li>
                             {/if}
                             {/if}
                         </ul>
                         </ul>
                     </div>
                     </div>

+ 0 - 28
src/Command/FinanceMail.php

@@ -6,7 +6,6 @@ namespace App\Command;
 
 
 use App\Models\User;
 use App\Models\User;
 use App\Services\Config;
 use App\Services\Config;
-use App\Utils\Telegram;
 use Ozdemir\Datatables\Datatables;
 use Ozdemir\Datatables\Datatables;
 use Ozdemir\Datatables\DB\MySQL;
 use Ozdemir\Datatables\DB\MySQL;
 
 
@@ -71,15 +70,6 @@ EOL;
                 []
                 []
             );
             );
         }
         }
-
-        if ($_ENV['finance_public']) {
-            Telegram::send(
-                '新鲜出炉的财务日报~' . PHP_EOL .
-                '昨日总收入笔数:' . $text_array['recordsTotal'] . PHP_EOL .
-                '昨日总收入金额:' . $income_total . PHP_EOL .
-                '凌晨也在努力工作~'
-            );
-        }
     }
     }
 
 
     public function week(): void
     public function week(): void
@@ -113,15 +103,6 @@ EOL;
                 []
                 []
             );
             );
         }
         }
-
-        if ($_ENV['finance_public']) {
-            Telegram::send(
-                '新鲜出炉的财务周报~' . PHP_EOL .
-                '上周总收入笔数:' . $text_array['recordsTotal'] . PHP_EOL .
-                '上周总收入金额:' . $income_total . PHP_EOL .
-                '周末也在努力工作~'
-            );
-        }
     }
     }
 
 
     public function month(): void
     public function month(): void
@@ -153,14 +134,5 @@ EOL;
                 []
                 []
             );
             );
         }
         }
-
-        if ($_ENV['finance_public']) {
-            Telegram::send(
-                '新鲜出炉的财务月报~' . PHP_EOL .
-                '上月总收入笔数:' . $text_array['recordsTotal'] . PHP_EOL .
-                '上月总收入金额:' . $income_total . PHP_EOL .
-                '月初也在努力工作~'
-            );
-        }
     }
     }
 }
 }

+ 4 - 4
src/Command/Job.php

@@ -237,12 +237,12 @@ EOL;
             $nodes = Node::all();
             $nodes = Node::all();
             foreach ($nodes as $node) {
             foreach ($nodes as $node) {
                 if ($node->isNodeOnline() === false && $node->online === true) {
                 if ($node->isNodeOnline() === false && $node->online === true) {
-                    if ($_ENV['useScFtqq'] === true && $_ENV['enable_detect_offline_useScFtqq'] === true) {
+                    if ($_ENV['useScFtqq'] === true) {
                         $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
                         $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
                         $text = '管理员您好,系统发现节点 ' . $node->name . ' 掉线了,请您及时处理。';
                         $text = '管理员您好,系统发现节点 ' . $node->name . ' 掉线了,请您及时处理。';
                         $postdata = http_build_query(
                         $postdata = http_build_query(
                             [
                             [
-                                'text' => $_ENV['appName'] . '-节点掉线了',
+                                'title' => $_ENV['appName'] . '-节点掉线了',
                                 'desp' => $text,
                                 'desp' => $text,
                             ]
                             ]
                         );
                         );
@@ -282,12 +282,12 @@ EOL;
                     $node->online = false;
                     $node->online = false;
                     $node->save();
                     $node->save();
                 } elseif ($node->isNodeOnline() === true && $node->online === false) {
                 } elseif ($node->isNodeOnline() === true && $node->online === false) {
-                    if ($_ENV['useScFtqq'] === true && $_ENV['enable_detect_offline_useScFtqq'] === true) {
+                    if ($_ENV['useScFtqq'] === true) {
                         $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
                         $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
                         $text = '管理员您好,系统发现节点 ' . $node->name . ' 恢复上线了。';
                         $text = '管理员您好,系统发现节点 ' . $node->name . ' 恢复上线了。';
                         $postdata = http_build_query(
                         $postdata = http_build_query(
                             [
                             [
-                                'text' => $_ENV['appName'] . '-节点恢复上线了',
+                                'title' => $_ENV['appName'] . '-节点恢复上线了',
                                 'desp' => $text,
                                 'desp' => $text,
                             ]
                             ]
                         );
                         );

+ 0 - 1
src/Command/Migration.php

@@ -94,7 +94,6 @@ END;
             }
             }
         } else {
         } else {
             ksort($queue);
             ksort($queue);
-            $current = 0;
             foreach ($queue as $version => $object) {
             foreach ($queue as $version => $object) {
                 echo "Forward to {$version}\n";
                 echo "Forward to {$version}\n";
                 $object->up();
                 $object->up();

+ 1 - 1
src/Command/Tool.php

@@ -29,7 +29,7 @@ final class Tool extends Command
 │ ├─ resetTraffic            - 重置所有用户流量
 │ ├─ resetTraffic            - 重置所有用户流量
 │ ├─ generateUUID            - 为所有用户生成新的 UUID
 │ ├─ generateUUID            - 为所有用户生成新的 UUID
 │ ├─ generateGa              - 为所有用户生成新的 Ga Secret
 │ ├─ generateGa              - 为所有用户生成新的 Ga Secret
-| ├─ generateApiToken        - 为所有用户生成新的 API Token
+ ├─ generateApiToken        - 为所有用户生成新的 API Token
 │ ├─ setTheme                - 为所有用户设置新的主题
 │ ├─ setTheme                - 为所有用户设置新的主题
 
 
 EOL;
 EOL;

+ 9 - 10
src/Command/Update.php

@@ -6,20 +6,20 @@ namespace App\Command;
 
 
 final class Update extends Command
 final class Update extends Command
 {
 {
-    public $description = '├─=: php xcat Update         - 更新并迁移配置' . PHP_EOL;
+    public $description = <<< END
+├─=: php xcat Update         - 更新并迁移配置
+END;
 
 
     public function boot(): void
     public function boot(): void
     {
     {
         global $_ENV;
         global $_ENV;
         $copy_result = copy(BASE_PATH . '/config/.config.php', BASE_PATH . '/config/.config.php.bak');
         $copy_result = copy(BASE_PATH . '/config/.config.php', BASE_PATH . '/config/.config.php.bak');
         if ($copy_result === true) {
         if ($copy_result === true) {
-            echo '.config.php 文件备份成功' . PHP_EOL;
+            echo ".config.php 文件备份成功。\n";
         } else {
         } else {
-            echo '.config.php 文件备份失败,迁移终止' . PHP_EOL;
+            echo ".config.php 文件备份失败,迁移终止。\n";
         }
         }
 
 
-        echo PHP_EOL;
-
         $config_old = file_get_contents(BASE_PATH . '/config/.config.php');
         $config_old = file_get_contents(BASE_PATH . '/config/.config.php');
         $config_new = file_get_contents(BASE_PATH . '/config/.config.example.php');
         $config_new = file_get_contents(BASE_PATH . '/config/.config.example.php');
 
 
@@ -30,7 +30,7 @@ final class Update extends Command
             $matches_new = [];
             $matches_new = [];
             preg_match($regex, $config_new, $matches_new);
             preg_match($regex, $config_new, $matches_new);
             if (isset($matches_new[0]) === false) {
             if (isset($matches_new[0]) === false) {
-                echo '未找到配置项:' . $key . ' 未能在新版本 .config.php 文件中找到,可能已被更名或废弃' . PHP_EOL;
+                echo "未找到配置项:" . $key . " 未能在新版本 .config.php 文件中找到,可能已被更名或废弃。\n";
                 continue;
                 continue;
             }
             }
 
 
@@ -40,7 +40,6 @@ final class Update extends Command
             $config_new = str_replace($matches_new[0], $matches_old[0], $config_new);
             $config_new = str_replace($matches_new[0], $matches_old[0], $config_new);
             $migrated[] = '_ENV[\'' . $key . '\']';
             $migrated[] = '_ENV[\'' . $key . '\']';
         }
         }
-        echo PHP_EOL;
 
 
         //检查新增了哪些config
         //检查新增了哪些config
         $regex_new = '/_ENV\[\'.*?\'\]/s';
         $regex_new = '/_ENV\[\'.*?\'\]/s';
@@ -69,11 +68,11 @@ final class Update extends Command
             $difference = substr($difference, 15);
             $difference = substr($difference, 15);
             $difference = substr($difference, 0, -2);
             $difference = substr($difference, 0, -2);
 
 
-            echo '新增 .config.php 配置项:' . $difference . ':' . $comment . PHP_EOL;
+            echo "新增 .config.php 配置项:" . $difference . ":" . $comment . " \n";
         }
         }
-        echo '没有任何新 .config.php 配置项需要添加' . PHP_EOL;
+        echo "没有任何新 .config.php 配置项需要添加。\n";
 
 
         file_put_contents(BASE_PATH . '/config/.config.php', $config_new);
         file_put_contents(BASE_PATH . '/config/.config.php', $config_new);
-        echo PHP_EOL . '迁移完成' . PHP_EOL;
+        echo "迁移完成。\n";
     }
     }
 }
 }

+ 14 - 0
src/Controllers/Admin/Setting/ImController.php

@@ -32,6 +32,20 @@ final class ImController extends BaseController
         'telegram_group_bound_user',
         'telegram_group_bound_user',
         'telegram_show_group_link',
         'telegram_show_group_link',
         'telegram_group_link',
         'telegram_group_link',
+        'enable_welcome_message',
+        'telegram_group_quiet',
+        'allow_to_join_new_groups',
+        'group_id_allowed_to_join',
+        'telegram_admins',
+        'enable_not_admin_reply',
+        'not_admin_reply_msg',
+        'no_user_found',
+        'data_method_not_found',
+        'help_any_command',
+        'enable_user_email_group_show',
+        'user_not_bind_reply',
+        'telegram_general_pricing',
+        'telegram_general_terms',
     ];
     ];
 
 
     public function im($request, $response, $args)
     public function im($request, $response, $args)

+ 4 - 55
src/Controllers/User/DetectController.php

@@ -5,9 +5,7 @@ declare(strict_types=1);
 namespace App\Controllers\User;
 namespace App\Controllers\User;
 
 
 use App\Controllers\BaseController;
 use App\Controllers\BaseController;
-use App\Models\DetectLog;
 use App\Models\DetectRule;
 use App\Models\DetectRule;
-use App\Utils\Tools;
 use Slim\Http\Response;
 use Slim\Http\Response;
 use Slim\Http\ServerRequest;
 use Slim\Http\ServerRequest;
 
 
@@ -16,61 +14,12 @@ final class DetectController extends BaseController
     /**
     /**
      * @param array     $args
      * @param array     $args
      */
      */
-    public function detectIndex(ServerRequest $request, Response $response, array $args)
+    public function index(ServerRequest $request, Response $response, array $args)
     {
     {
-        $pageNum = $request->getQueryParams()['page'] ?? 1;
-        $logs = DetectRule::paginate(15, ['*'], 'page', $pageNum);
+        $rules = DetectRule::get();
 
 
-        if ($request->getParam('json') === 1) {
-            return $response->withJson([
-                'ret' => 1,
-                'logs' => $logs,
-            ]);
-        }
-
-        $render = Tools::paginateRender($logs);
-        return $response->write($this->view()
-            ->assign('rules', $logs)
-            ->assign('render', $render)
-            ->fetch('user/detect_index.tpl'));
-    }
-
-    /**
-     * @param array     $args
-     */
-    public function detectLog(ServerRequest $request, Response $response, array $args)
-    {
-        $pageNum = $request->getQueryParams()['page'] ?? 1;
-        $logs = DetectLog::orderBy('id', 'desc')->where('user_id', $this->user->id)->paginate(15, ['*'], 'page', $pageNum);
-
-        if ($request->getParam('json') === 1) {
-            foreach ($logs as $log) {
-                /** @var DetectLog $log */
-                if ($log->node() === null) {
-                    DetectLog::nodeIsNull($log);
-                    continue;
-                }
-                if ($log->rule() === null) {
-                    DetectLog::ruleIsNull($log);
-                    continue;
-                }
-                $log->node_name = $log->nodeName();
-                $log->detect_rule_name = $log->ruleName();
-                $log->detect_rule_text = $log->ruleText();
-                $log->detect_rule_regex = $log->ruleRegex();
-                $log->detect_rule_type = $log->ruleType();
-                $log->detect_rule_date = $log->datetime();
-            }
-            return $response->withJson([
-                'ret' => 1,
-                'logs' => $logs,
-            ]);
-        }
-
-        $render = Tools::paginateRender($logs);
         return $response->write($this->view()
         return $response->write($this->view()
-            ->assign('logs', $logs)
-            ->assign('render', $render)
-            ->fetch('user/detect_log.tpl'));
+            ->assign('rules', $rules)
+            ->fetch('user/detect/index.tpl'));
     }
     }
 }
 }

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

@@ -0,0 +1,47 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Controllers\User;
+
+use App\Controllers\BaseController;
+use App\Models\DetectLog;
+use App\Models\UserSubscribeLog;
+use App\Utils\Tools;
+use Slim\Http\Response;
+use Slim\Http\ServerRequest;
+
+final class LogController extends BaseController
+{
+    /**
+     * 订阅记录
+     *
+     * @param array    $args
+     */
+    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()
+            ->assign('logs', $logs)
+            ->registerClass('Tools', Tools::class)
+            ->fetch('user/subscribe/log.tpl'));
+    }
+
+    /**
+     * @param array     $args
+     */
+    public function detect(ServerRequest $request, Response $response, array $args)
+    {
+        $logs = DetectLog::orderBy('id', 'desc')->where('user_id', $this->user->id)->get();
+
+        return $response->write($this->view()
+            ->assign('logs', $logs)
+            ->registerClass('Tools', Tools::class)
+            ->fetch('user/detect/log.tpl'));
+    }
+}

+ 2 - 2
src/Controllers/User/TicketController.php

@@ -100,7 +100,7 @@ final class TicketController extends BaseController
         if ($_ENV['useScFtqq'] === true) {
         if ($_ENV['useScFtqq'] === true) {
             $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
             $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
             $postdata = http_build_query([
             $postdata = http_build_query([
-                'text' => $_ENV['appName'] . '-新工单被开启',
+                'title' => $_ENV['appName'] . '-新工单被开启',
                 'desp' => $title,
                 'desp' => $title,
             ]);
             ]);
             $opts = [
             $opts = [
@@ -173,7 +173,7 @@ final class TicketController extends BaseController
         if ($_ENV['useScFtqq'] === true) {
         if ($_ENV['useScFtqq'] === true) {
             $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
             $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
             $postdata = http_build_query([
             $postdata = http_build_query([
-                'text' => $_ENV['appName'] . '-工单被回复',
+                'title' => $_ENV['appName'] . '-工单被回复',
                 'desp' => $ticket->title,
                 'desp' => $ticket->title,
             ]);
             ]);
             $opts = [
             $opts = [

+ 42 - 167
src/Controllers/UserController.php

@@ -16,9 +16,7 @@ use App\Models\Node;
 use App\Models\Payback;
 use App\Models\Payback;
 use App\Models\Setting;
 use App\Models\Setting;
 use App\Models\StreamMedia;
 use App\Models\StreamMedia;
-use App\Models\Token;
 use App\Models\User;
 use App\Models\User;
-use App\Models\UserSubscribeLog;
 use App\Services\Auth;
 use App\Services\Auth;
 use App\Services\Captcha;
 use App\Services\Captcha;
 use App\Services\Config;
 use App\Services\Config;
@@ -32,7 +30,6 @@ use App\Utils\QQWry;
 use App\Utils\ResponseHelper;
 use App\Utils\ResponseHelper;
 use App\Utils\TelegramSessionManager;
 use App\Utils\TelegramSessionManager;
 use App\Utils\Tools;
 use App\Utils\Tools;
-use App\Utils\URL;
 use Ramsey\Uuid\Uuid;
 use Ramsey\Uuid\Uuid;
 use Slim\Http\Response;
 use Slim\Http\Response;
 use Slim\Http\ServerRequest;
 use Slim\Http\ServerRequest;
@@ -54,24 +51,6 @@ final class UserController extends BaseController
             $captcha = Captcha::generate();
             $captcha = Captcha::generate();
         }
         }
 
 
-        if ($_ENV['subscribe_client_url'] !== '') {
-            $getClient = new Token();
-            for ($i = 0; $i < 10; $i++) {
-                $token = $this->user->id . Tools::genRandomChar(16);
-                $Elink = Token::where('token', '=', $token)->first();
-                if ($Elink === null) {
-                    $getClient->token = $token;
-                    break;
-                }
-            }
-            $getClient->user_id = $this->user->id;
-            $getClient->create_time = \time();
-            $getClient->expire_time = \time() + 10 * 60;
-            $getClient->save();
-        } else {
-            $token = '';
-        }
-
         $data = [
         $data = [
             'today_traffic_usage' => (int) $this->user->transfer_enable === 0 ? 0 : ($this->user->u + $this->user->d - $this->user->last_day_t) / $this->user->transfer_enable * 100,
             'today_traffic_usage' => (int) $this->user->transfer_enable === 0 ? 0 : ($this->user->u + $this->user->d - $this->user->last_day_t) / $this->user->transfer_enable * 100,
             'past_traffic_usage' => (int) $this->user->transfer_enable === 0 ? 0 : $this->user->last_day_t / $this->user->transfer_enable * 100,
             'past_traffic_usage' => (int) $this->user->transfer_enable === 0 ? 0 : $this->user->last_day_t / $this->user->transfer_enable * 100,
@@ -80,14 +59,9 @@ final class UserController extends BaseController
 
 
         return $response->write(
         return $response->write(
             $this->view()
             $this->view()
-                ->assign('ssr_sub_token', $this->user->getSublink())
                 ->assign('ann', Ann::orderBy('date', 'desc')->first())
                 ->assign('ann', Ann::orderBy('date', 'desc')->first())
-                ->assign('mergeSub', $_ENV['mergeSub'])
-                ->assign('subUrl', $_ENV['subUrl'] . '/link/')
-                ->registerClass('URL', URL::class)
-                ->assign('subInfo', LinkController::getSubinfo($this->user, 0))
                 ->assign('getUniversalSub', SubController::getUniversalSub($this->user))
                 ->assign('getUniversalSub', SubController::getUniversalSub($this->user))
-                ->assign('getClient', $token)
+                ->assign('getTraditionalSub', LinkController::getTraditionalSub($this->user))
                 ->assign('data', $data)
                 ->assign('data', $data)
                 ->assign('captcha', $captcha)
                 ->assign('captcha', $captcha)
                 ->fetch('user/index.tpl')
                 ->fetch('user/index.tpl')
@@ -179,9 +153,9 @@ final class UserController extends BaseController
 
 
         if ($codeq->type === 10002) {
         if ($codeq->type === 10002) {
             if (\time() > strtotime($user->expire_in)) {
             if (\time() > strtotime($user->expire_in)) {
-                $user->expire_in = date('Y-m-d H:i:s', \time() + $codeq->number * 86400);
+                $user->expire_in = date('Y-m-d H:i:s', \time() + (int) $codeq->number * 86400);
             } else {
             } else {
-                $user->expire_in = date('Y-m-d H:i:s', strtotime($user->expire_in) + $codeq->number * 86400);
+                $user->expire_in = date('Y-m-d H:i:s', strtotime($user->expire_in) + (int) $codeq->number * 86400);
             }
             }
             $user->save();
             $user->save();
         }
         }
@@ -191,7 +165,7 @@ final class UserController extends BaseController
                 $user->class_expire = date('Y-m-d H:i:s', \time());
                 $user->class_expire = date('Y-m-d H:i:s', \time());
                 $user->save();
                 $user->save();
             }
             }
-            $user->class_expire = date('Y-m-d H:i:s', strtotime($user->class_expire) + $codeq->number * 86400);
+            $user->class_expire = date('Y-m-d H:i:s', strtotime($user->class_expire) + (int) $codeq->number * 86400);
             $user->class = $codeq->type;
             $user->class = $codeq->type;
             $user->save();
             $user->save();
         }
         }
@@ -377,7 +351,8 @@ final class UserController extends BaseController
             }
             }
         }
         }
 
 
-        array_multisort(array_column($results, 'node_name'), SORT_ASC, $results);
+        $node_names = array_column($results, 'node_name');
+        array_multisort($node_names, SORT_ASC, $results);
 
 
         return $response->write($this->view()
         return $response->write($this->view()
             ->assign('results', $results)
             ->assign('results', $results)
@@ -394,7 +369,7 @@ final class UserController extends BaseController
         $methods = Config::getSupportParam('method');
         $methods = Config::getSupportParam('method');
         $gaurl = MFA::getGAurl($this->user);
         $gaurl = MFA::getGAurl($this->user);
 
 
-        return $reponse->write($this->view()
+        return $response->write($this->view()
             ->assign('user', $this->user)
             ->assign('user', $this->user)
             ->assign('themes', $themes)
             ->assign('themes', $themes)
             ->assign('bind_token', $bind_token)
             ->assign('bind_token', $bind_token)
@@ -659,98 +634,43 @@ final class UserController extends BaseController
      */
      */
     public function updateContact(ServerRequest $request, Response $response, array $args)
     public function updateContact(ServerRequest $request, Response $response, array $args)
     {
     {
-        $type = $request->getParam('imtype');
-        $contact = trim($request->getParam('contact'));
-
-        $user = $this->user;
-
-        if ($user->telegram_id !== null) {
-            return ResponseHelper::error(
-                $response,
-                '您绑定了 Telegram ,所以此项并不能被修改。'
-            );
-        }
-
-        if ($contact === '' || $type === '') {
-            return ResponseHelper::error($response, '非法输入');
-        }
-
-        $user1 = User::where('im_value', $contact)->where('im_type', $type)->first();
-        if ($user1 !== null) {
-            return ResponseHelper::error($response, '此联络方式已经被注册');
-        }
-
-        $user->im_type = $type;
         $antiXss = new AntiXSS();
         $antiXss = new AntiXSS();
-        $user->im_value = $antiXss->xss_clean($contact);
-        $user->save();
-
-        return ResponseHelper::successfully($response, '修改成功');
-    }
 
 
-    /**
-     * @param array     $args
-     */
-    public function updateSSR(ServerRequest $request, Response $response, array $args)
-    {
-        $protocol = $request->getParam('protocol');
-        $obfs = $request->getParam('obfs');
-        $obfs_param = $request->getParam('obfs_param');
-        $obfs_param = trim($obfs_param);
+        $type = $antiXss->xss_clean($request->getParam('imtype'));
+        $value = $antiXss->xss_clean($request->getParam('imvalue'));
 
 
         $user = $this->user;
         $user = $this->user;
 
 
-        if ($obfs === '' || $protocol === '') {
-            return ResponseHelper::error($response, '非法输入');
-        }
-
-        if (! Tools::isParamValidate('obfs', $obfs)) {
-            return ResponseHelper::error($response, '协议无效');
-        }
-
-        if (! Tools::isParamValidate('protocol', $protocol)) {
-            return ResponseHelper::error($response, '协议无效');
+        if ($user->telegram_id !== null) {
+            return $response->withJson([
+                'ret' => 0,
+                'msg' => '你的账户绑定了 Telegram ,所以此项并不能被修改',
+            ]);
         }
         }
 
 
-        $antiXss = new AntiXSS();
-
-        $user->protocol = $antiXss->xss_clean($protocol);
-        $user->obfs = $antiXss->xss_clean($obfs);
-        $user->obfs_param = $antiXss->xss_clean($obfs_param);
-
-        if (! Tools::checkNoneProtocol($user)) {
-            return ResponseHelper::error(
-                $response,
-                '系统检测到您目前的加密方式为 none ,但您将要设置为的协议并不在以下协议<br>'
-                . implode(',', Config::getSupportParam('allow_none_protocol'))
-                . '<br>之内,请您先修改您的加密方式,再来修改此处设置。'
-            );
+        if ($value === '' || $type === '') {
+            return $response->withJson([
+                'ret' => 0,
+                'msg' => '联络方式不能为空',
+            ]);
         }
         }
 
 
-        if (! URL::SSCanConnect($user) && ! URL::SSRCanConnect($user)) {
-            return ResponseHelper::error(
-                $response,
-                '您这样设置之后,就没有客户端能连接上了,所以系统拒绝了您的设置,请您检查您的设置之后再进行操作。'
-            );
+        $user_exist = User::where('im_value', $value)->where('im_type', $type)->first();
+        if ($user_exist !== null) {
+            return $response->withJson([
+                'ret' => 0,
+                'msg' => '此联络方式已经被注册',
+            ]);
         }
         }
 
 
+        $user->im_type = $type;
+        $user->im_value = $value;
         $user->save();
         $user->save();
 
 
-        if (! URL::SSCanConnect($user)) {
-            return ResponseHelper::error(
-                $response,
-                '设置成功,但您目前的协议,混淆,加密方式设置会导致 Shadowsocks原版客户端无法连接,请您自行更换到 ShadowsocksR 客户端。'
-            );
-        }
-
-        if (! URL::SSRCanConnect($user)) {
-            return ResponseHelper::error(
-                $response,
-                '设置成功,但您目前的协议,混淆,加密方式设置会导致 ShadowsocksR 客户端无法连接,请您自行更换到 Shadowsocks 客户端。'
-            );
-        }
-
-        return ResponseHelper::successfully($response, '设置成功,您可自由选用客户端来连接。');
+        return $response->withJson([
+            'ret' => 1,
+            'msg' => '修改成功',
+        ]);
     }
     }
 
 
     /**
     /**
@@ -758,19 +678,25 @@ final class UserController extends BaseController
      */
      */
     public function updateTheme(ServerRequest $request, Response $response, array $args)
     public function updateTheme(ServerRequest $request, Response $response, array $args)
     {
     {
-        $theme = $request->getParam('theme');
+        $antiXss = new AntiXSS();
+        $theme = $antiXss->xss_clean($request->getParam('theme'));
 
 
         $user = $this->user;
         $user = $this->user;
 
 
         if ($theme === '') {
         if ($theme === '') {
-            return ResponseHelper::error($response, '非法输入');
+            return $response->withJson([
+                'ret' => 0,
+                'msg' => '主题不能为空',
+            ]);
         }
         }
 
 
-        $antiXss = new AntiXSS();
-        $user->theme = $antiXss->xss_clean($theme);
+        $user->theme = $theme;
         $user->save();
         $user->save();
 
 
-        return ResponseHelper::successfully($response, '设置成功');
+        return $response->withJson([
+            'ret' => 1,
+            'msg' => '修改成功',
+        ]);
     }
     }
 
 
     /**
     /**
@@ -1003,57 +929,6 @@ final class UserController extends BaseController
         return $response->withStatus(302)->withHeader('Location', $local);
         return $response->withStatus(302)->withHeader('Location', $local);
     }
     }
 
 
-    /**
-     * @param array     $args
-     */
-    public function getUserAllURL(ServerRequest $request, Response $response, array $args)
-    {
-        $user = $this->user;
-        $type = $request->getQueryParams()['type'];
-        $return = '';
-        switch ($type) {
-            case 'ss':
-                $return .= URL::getNewAllUrl($user, ['type' => 'ss']) . PHP_EOL;
-                break;
-            case 'ssr':
-                $return .= URL::getNewAllUrl($user, ['type' => 'ssr']) . PHP_EOL;
-                break;
-            case 'v2ray':
-                $return .= URL::getNewAllUrl($user, ['type' => 'vmess']) . PHP_EOL;
-                break;
-            default:
-                $return .= '悟空别闹!';
-                break;
-        }
-        $response = $response->withHeader('Content-type', ' application/octet-stream; charset=utf-8')
-            ->withHeader('Cache-Control', 'no-store, no-cache, must-revalidate')
-            ->withHeader('Content-Disposition', ' attachment; filename=node.txt');
-
-        return $response->write($return);
-    }
-
-    /**
-     * 订阅记录
-     *
-     * @param array    $args
-     */
-    public function subscribeLog(ServerRequest $request, Response $response, array $args)
-    {
-        if ($_ENV['subscribeLog_show'] === false) {
-            return $response->withStatus(302)->withHeader('Location', '/user');
-        }
-
-        $pageNum = $request->getQueryParams()['page'] ?? 1;
-        $logs = UserSubscribeLog::orderBy('id', 'desc')->where('user_id', $this->user->id)->paginate(15, ['*'], 'page', $pageNum);
-
-        $render = Tools::paginateRender($logs);
-        return $this->view()
-            ->assign('logs', $logs)
-            ->assign('render', $render)
-            ->registerClass('Tools', Tools::class)
-            ->fetch('user/subscribe_log.tpl');
-    }
-
     /**
     /**
      * @param array     $args
      * @param array     $args
      */
      */

+ 3 - 3
src/Utils/Telegram/Callbacks/Callback.php

@@ -75,7 +75,7 @@ final class Callback
         $this->CallbackData = $Callback->getData();
         $this->CallbackData = $Callback->getData();
         $this->AllowEditMessage = \time() < $Callback->getMessage()->getDate() + 172800;
         $this->AllowEditMessage = \time() < $Callback->getMessage()->getDate() + 172800;
 
 
-        if ($this->ChatID < 0 && $_ENV['telegram_group_quiet'] === true) {
+        if ($this->ChatID < 0 && Setting::obtain('telegram_group_quiet') === true) {
             // 群组中不回应
             // 群组中不回应
             return;
             return;
         }
         }
@@ -172,7 +172,7 @@ final class Callback
             case 'general.pricing':
             case 'general.pricing':
                 // 产品介绍
                 // 产品介绍
                 $sendMessage = [
                 $sendMessage = [
-                    'text' => $_ENV['telegram_general_pricing'],
+                    'text' => Setting::obtain('telegram_general_pricing'),
                     'disable_web_page_preview' => false,
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
                     'reply_to_message_id' => null,
                     'reply_markup' => \json_encode(
                     'reply_markup' => \json_encode(
@@ -185,7 +185,7 @@ final class Callback
             case 'general.terms':
             case 'general.terms':
                 // 服务条款
                 // 服务条款
                 $sendMessage = [
                 $sendMessage = [
-                    'text' => $_ENV['telegram_general_terms'],
+                    'text' => Setting::obtain('telegram_general_terms'),
                     'disable_web_page_preview' => false,
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
                     'reply_to_message_id' => null,
                     'reply_markup' => \json_encode(
                     'reply_markup' => \json_encode(

+ 3 - 2
src/Utils/Telegram/Commands/CheckinCommand.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 
 namespace App\Utils\Telegram\Commands;
 namespace App\Utils\Telegram\Commands;
 
 
+use App\Models\Setting;
 use App\Utils\Telegram\TelegramTools;
 use App\Utils\Telegram\TelegramTools;
 use Telegram\Bot\Actions;
 use Telegram\Bot\Actions;
 use Telegram\Bot\Commands\Command;
 use Telegram\Bot\Commands\Command;
@@ -35,7 +36,7 @@ final class CheckinCommand extends Command
         $ChatID = $Message->getChat()->getId();
         $ChatID = $Message->getChat()->getId();
 
 
         if ($ChatID < 0) {
         if ($ChatID < 0) {
-            if ($_ENV['telegram_group_quiet'] === true) {
+            if (Setting::obtain('telegram_group_quiet') === true) {
                 // 群组中不回应
                 // 群组中不回应
                 return;
                 return;
             }
             }
@@ -59,7 +60,7 @@ final class CheckinCommand extends Command
             // 回送信息
             // 回送信息
             $response = $this->replyWithMessage(
             $response = $this->replyWithMessage(
                 [
                 [
-                    'text' => $_ENV['user_not_bind_reply'],
+                    'text' => Setting::obtain('user_not_bind_reply'),
                     'parse_mode' => 'Markdown',
                     'parse_mode' => 'Markdown',
                     'reply_to_message_id' => $Message->getMessageId(),
                     'reply_to_message_id' => $Message->getMessageId(),
                 ]
                 ]

+ 3 - 2
src/Utils/Telegram/Commands/HelpCommand.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 
 namespace App\Utils\Telegram\Commands;
 namespace App\Utils\Telegram\Commands;
 
 
+use App\Models\Setting;
 use Telegram\Bot\Actions;
 use Telegram\Bot\Actions;
 use Telegram\Bot\Commands\Command;
 use Telegram\Bot\Commands\Command;
 
 
@@ -27,12 +28,12 @@ final class HelpCommand extends Command
         $Update = $this->getUpdate();
         $Update = $this->getUpdate();
         $Message = $Update->getMessage();
         $Message = $Update->getMessage();
         if ($Message->getChat()->getId() < 0) {
         if ($Message->getChat()->getId() < 0) {
-            if ($_ENV['telegram_group_quiet'] === true) {
+            if (Setting::obtain('telegram_group_quiet') === true) {
                 return;
                 return;
             }
             }
         }
         }
         if (! preg_match('/^\/help\s?(@' . $_ENV['telegram_bot'] . ')?.*/i', $Message->getText())) {
         if (! preg_match('/^\/help\s?(@' . $_ENV['telegram_bot'] . ')?.*/i', $Message->getText())) {
-            if ($_ENV['help_any_command'] === false) {
+            if (Setting::obtain('help_any_command') === false) {
                 return;
                 return;
             }
             }
         }
         }

+ 5 - 4
src/Utils/Telegram/Commands/InfoCommand.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 
 namespace App\Utils\Telegram\Commands;
 namespace App\Utils\Telegram\Commands;
 
 
+use App\Models\Setting;
 use App\Models\User;
 use App\Models\User;
 use App\Utils\Telegram\Reply;
 use App\Utils\Telegram\Reply;
 use App\Utils\Telegram\TelegramTools;
 use App\Utils\Telegram\TelegramTools;
@@ -45,14 +46,14 @@ final class InfoCommand extends Command
                 'name' => $Message->getFrom()->getFirstName() . ' ' . $Message->getFrom()->getLastName(),
                 'name' => $Message->getFrom()->getFirstName() . ' ' . $Message->getFrom()->getLastName(),
                 'username' => $Message->getFrom()->getUsername(),
                 'username' => $Message->getFrom()->getUsername(),
             ];
             ];
-            if (! \in_array($SendUser['id'], $_ENV['telegram_admins'])) {
+            if (! \in_array($SendUser['id'], \json_decode(Setting::obtain('telegram_admins')))) {
                 $AdminUser = User::where('is_admin', 1)->where('telegram_id', $SendUser['id'])->first();
                 $AdminUser = User::where('is_admin', 1)->where('telegram_id', $SendUser['id'])->first();
                 if ($AdminUser === null) {
                 if ($AdminUser === null) {
                     // 非管理员回复消息
                     // 非管理员回复消息
-                    if ($_ENV['enable_not_admin_reply'] === true && $_ENV['not_admin_reply_msg'] !== '') {
+                    if (Setting::obtain('enable_not_admin_reply') === true && Setting::obtain('not_admin_reply_msg') !== '') {
                         $this->replyWithMessage(
                         $this->replyWithMessage(
                             [
                             [
-                                'text' => $_ENV['not_admin_reply_msg'],
+                                'text' => Setting::obtain('not_admin_reply_msg'),
                                 'parse_mode' => 'HTML',
                                 'parse_mode' => 'HTML',
                                 'reply_to_message_id' => $MessageID,
                                 'reply_to_message_id' => $MessageID,
                             ]
                             ]
@@ -72,7 +73,7 @@ final class InfoCommand extends Command
                 if ($User === null) {
                 if ($User === null) {
                     $this->replyWithMessage(
                     $this->replyWithMessage(
                         [
                         [
-                            'text' => $_ENV['no_user_found'],
+                            'text' => Setting::obtain('no_user_found'),
                             'reply_to_message_id' => $MessageID,
                             'reply_to_message_id' => $MessageID,
                         ]
                         ]
                     );
                     );

+ 3 - 2
src/Utils/Telegram/Commands/MyCommand.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 
 namespace App\Utils\Telegram\Commands;
 namespace App\Utils\Telegram\Commands;
 
 
+use App\Models\Setting;
 use App\Models\User;
 use App\Models\User;
 use App\Utils\Telegram\Reply;
 use App\Utils\Telegram\Reply;
 use Telegram\Bot\Actions;
 use Telegram\Bot\Actions;
@@ -39,7 +40,7 @@ final class MyCommand extends Command
         $ChatID = $Message->getChat()->getId();
         $ChatID = $Message->getChat()->getId();
 
 
         if ($ChatID < 0) {
         if ($ChatID < 0) {
-            if ($_ENV['telegram_group_quiet'] === true) {
+            if (Setting::obtain('telegram_group_quiet') === true) {
                 // 群组中不回应
                 // 群组中不回应
                 return;
                 return;
             }
             }
@@ -64,7 +65,7 @@ final class MyCommand extends Command
             // 回送信息
             // 回送信息
             $response = $this->replyWithMessage(
             $response = $this->replyWithMessage(
                 [
                 [
-                    'text' => $_ENV['user_not_bind_reply'],
+                    'text' => Setting::obtain('user_not_bind_reply'),
                     'reply_to_message_id' => $MessageID,
                     'reply_to_message_id' => $MessageID,
                     'parse_mode' => 'Markdown',
                     'parse_mode' => 'Markdown',
                 ]
                 ]

+ 2 - 1
src/Utils/Telegram/Commands/PingCommand.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 
 namespace App\Utils\Telegram\Commands;
 namespace App\Utils\Telegram\Commands;
 
 
+use App\Models\Setting;
 use Telegram\Bot\Actions;
 use Telegram\Bot\Actions;
 use Telegram\Bot\Commands\Command;
 use Telegram\Bot\Commands\Command;
 
 
@@ -49,7 +50,7 @@ final class PingCommand extends Command
                 ]
                 ]
             );
             );
         } else {
         } else {
-            if ($_ENV['telegram_group_quiet'] === true) {
+            if (Setting::obtain('telegram_group_quiet') === true) {
                 // 群组中不回应
                 // 群组中不回应
                 return;
                 return;
             }
             }

+ 7 - 6
src/Utils/Telegram/Commands/SetuserCommand.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 
 namespace App\Utils\Telegram\Commands;
 namespace App\Utils\Telegram\Commands;
 
 
+use App\Models\Setting;
 use App\Models\User;
 use App\Models\User;
 use App\Utils\Telegram\Reply;
 use App\Utils\Telegram\Reply;
 use App\Utils\Telegram\TelegramTools;
 use App\Utils\Telegram\TelegramTools;
@@ -46,14 +47,14 @@ final class SetuserCommand extends Command
             'username' => $Message->getFrom()->getUsername(),
             'username' => $Message->getFrom()->getUsername(),
         ];
         ];
 
 
-        if (! \in_array($SendUser['id'], $_ENV['telegram_admins'])) {
+        if (! \in_array($SendUser['id'], \json_decode(Setting::obtain('telegram_admins')))) {
             $AdminUser = User::where('is_admin', 1)->where('telegram_id', $SendUser['id'])->first();
             $AdminUser = User::where('is_admin', 1)->where('telegram_id', $SendUser['id'])->first();
             if ($AdminUser === null) {
             if ($AdminUser === null) {
                 // 非管理员回复消息
                 // 非管理员回复消息
-                if ($_ENV['enable_not_admin_reply'] === true && $_ENV['not_admin_reply_msg'] !== '') {
+                if (Setting::obtain('enable_not_admin_reply') === true && Setting::obtain('not_admin_reply_msg') !== '') {
                     $this->replyWithMessage(
                     $this->replyWithMessage(
                         [
                         [
-                            'text' => $_ENV['not_admin_reply_msg'],
+                            'text' => Setting::obtain('not_admin_reply_msg'),
                             'parse_mode' => 'HTML',
                             'parse_mode' => 'HTML',
                             'reply_to_message_id' => $MessageID,
                             'reply_to_message_id' => $MessageID,
                         ]
                         ]
@@ -86,7 +87,7 @@ final class SetuserCommand extends Command
             if ($User === null) {
             if ($User === null) {
                 $this->replyWithMessage(
                 $this->replyWithMessage(
                     [
                     [
-                        'text' => $_ENV['no_user_found'],
+                        'text' => Setting::obtain('no_user_found'),
                         'parse_mode' => 'HTML',
                         'parse_mode' => 'HTML',
                         'reply_to_message_id' => $MessageID,
                         'reply_to_message_id' => $MessageID,
                     ]
                     ]
@@ -192,7 +193,7 @@ final class SetuserCommand extends Command
             if ($User === null) {
             if ($User === null) {
                 $this->replyWithMessage(
                 $this->replyWithMessage(
                     [
                     [
-                        'text' => $_ENV['no_user_found'],
+                        'text' => Setting::obtain('no_user_found'),
                         'parse_mode' => 'HTML',
                         'parse_mode' => 'HTML',
                         'reply_to_message_id' => $MessageID,
                         'reply_to_message_id' => $MessageID,
                     ]
                     ]
@@ -208,7 +209,7 @@ final class SetuserCommand extends Command
         if ($useOptionMethod === '') {
         if ($useOptionMethod === '') {
             $this->replyWithMessage(
             $this->replyWithMessage(
                 [
                 [
-                    'text' => $_ENV['data_method_not_found'],
+                    'text' => Setting::obtain('data_method_not_found'),
                     'parse_mode' => 'HTML',
                     'parse_mode' => 'HTML',
                     'reply_to_message_id' => $MessageID,
                     'reply_to_message_id' => $MessageID,
                 ]
                 ]

+ 2 - 1
src/Utils/Telegram/Commands/StartCommand.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 
 namespace App\Utils\Telegram\Commands;
 namespace App\Utils\Telegram\Commands;
 
 
+use App\Models\Setting;
 use App\Models\User;
 use App\Models\User;
 use App\Utils\Telegram\TelegramTools;
 use App\Utils\Telegram\TelegramTools;
 use App\Utils\TelegramSessionManager;
 use App\Utils\TelegramSessionManager;
@@ -67,7 +68,7 @@ final class StartCommand extends Command
                 ]
                 ]
             );
             );
         } else {
         } else {
-            if ($_ENV['telegram_group_quiet'] === true) {
+            if (Setting::obtain('telegram_group_quiet') === true) {
                 // 群组中不回应
                 // 群组中不回应
                 return;
                 return;
             }
             }

+ 1 - 1
src/Utils/Telegram/Commands/UnbindCommand.php

@@ -50,7 +50,7 @@ final class UnbindCommand extends Command
                 // 回送信息
                 // 回送信息
                 $this->replyWithMessage(
                 $this->replyWithMessage(
                     [
                     [
-                        'text' => $_ENV['user_not_bind_reply'],
+                        'text' => Setting::obtain('user_not_bind_reply'),
                         'parse_mode' => 'Markdown',
                         'parse_mode' => 'Markdown',
                     ]
                     ]
                 );
                 );

+ 7 - 7
src/Utils/Telegram/Message.php

@@ -142,7 +142,7 @@ final class Message
         ];
         ];
         if ($NewChatMember->getUsername() === $_ENV['telegram_bot']) {
         if ($NewChatMember->getUsername() === $_ENV['telegram_bot']) {
             // 机器人加入新群组
             // 机器人加入新群组
-            if ($_ENV['allow_to_join_new_groups'] !== true && ! \in_array($this->ChatID, $_ENV['group_id_allowed_to_join'])) {
+            if (Setting::obtain('allow_to_join_new_groups') !== true && ! \in_array($this->ChatID, \json_decode(Setting::obtain('group_id_allowed_to_join')))) {
                 // 退群
                 // 退群
                 $this->replyWithMessage(
                 $this->replyWithMessage(
                     [
                     [
@@ -156,8 +156,8 @@ final class Message
                         'user_id' => $Member['id'],
                         'user_id' => $Member['id'],
                     ]
                     ]
                 );
                 );
-                if (count($_ENV['telegram_admins']) >= 1) {
-                    foreach ($_ENV['telegram_admins'] as $id) {
+                if (count(\json_decode(Setting::obtain('telegram_admins'))) >= 1) {
+                    foreach (\json_decode(Setting::obtain('telegram_admins')) as $id) {
                         $this->bot->sendMessage(
                         $this->bot->sendMessage(
                             [
                             [
                                 'text' => '根据您的设定,Bot 退出了一个群组.' . PHP_EOL . PHP_EOL . '群组名称:' . $this->Message->getChat()->getTitle(),
                                 'text' => '根据您的设定,Bot 退出了一个群组.' . PHP_EOL . PHP_EOL . '群组名称:' . $this->Message->getChat()->getTitle(),
@@ -169,7 +169,7 @@ final class Message
             } else {
             } else {
                 $this->replyWithMessage(
                 $this->replyWithMessage(
                     [
                     [
-                        'text' => '同志们好,同志们辛苦了.',
+                        'text' => '雷猴啊。',
                     ]
                     ]
                 );
                 );
             }
             }
@@ -188,7 +188,7 @@ final class Message
             ) {
             ) {
                 $this->replyWithMessage(
                 $this->replyWithMessage(
                     [
                     [
-                        'text' => '由于 ' . $Member['name'] . ' 未绑定账户,将被移除.',
+                        'text' => '由于 ' . $Member['name'] . ' 未绑定账户,将被移除',
                     ]
                     ]
                 );
                 );
                 TelegramTools::sendPost(
                 TelegramTools::sendPost(
@@ -200,8 +200,8 @@ final class Message
                 );
                 );
                 return;
                 return;
             }
             }
-            if ($_ENV['enable_welcome_message'] === true) {
-                $text = ($NewUser->class >= 1 ? '欢迎 VIP' . $NewUser->class . ' 用户 ' . $Member['name'] . '回到组织.' : '欢迎 ' . $Member['name']);
+            if (Setting::obtain('enable_welcome_message') === true) {
+                $text = ($NewUser->class >= 1 ? '欢迎 VIP' . $NewUser->class . ' 用户 ' . $Member['name'] . '加入群组。' : '欢迎 ' . $Member['name']);
                 $this->replyWithMessage(
                 $this->replyWithMessage(
                     [
                     [
                         'text' => $text,
                         'text' => $text,

+ 2 - 1
src/Utils/Telegram/TelegramTools.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 
 namespace App\Utils\Telegram;
 namespace App\Utils\Telegram;
 
 
+use App\Models\Setting;
 use App\Models\User;
 use App\Models\User;
 use App\Utils\Tools;
 use App\Utils\Tools;
 
 
@@ -309,7 +310,7 @@ final class TelegramTools
      */
      */
     public static function getUserEmail(string $email, int $ChatID): string
     public static function getUserEmail(string $email, int $ChatID): string
     {
     {
-        if ($_ENV['enable_user_email_group_show'] === true || $ChatID > 0) {
+        if (Setting::obtain('enable_user_email_group_show') === true || $ChatID > 0) {
             return $email;
             return $email;
         }
         }
         $a = strpos($email, '@');
         $a = strpos($email, '@');