ソースを参照

tidy up the config.php file and delete the relevant code

iamsaltedfish 3 年 前
コミット
6274d8e652

+ 193 - 370
config/.config.example.php

@@ -1,377 +1,208 @@
 <?php
 
-//注释里请勿使用英文方括号、分号、单引号,否则迁移Config时会出错
-
-//config迁移附注(由开发者填写本次config迁移后需要注意的地方,站长勿动)
-//如需换行,直接换行即可,无需换行符
-//【新增/删除】config无需写入迁移附注
-$_ENV['config_migrate_notice'] =
-    '新增 enable_change_email 配置項
-新增 smtp_bbc 配置項
-';
-$_ENV['version'] = 2;    //仅当涉及【需要修改config以外的文件】时才需要+1,站长勿动
-
-
-//基本设置--------------------------------------------------------------------------------------------
-$_ENV['key']        = '1145141919810';                //!!! 瞎 jb 修改此key为随机字符串确保网站安全 !!!
-$_ENV['debug']      = false;                          //正式环境请确保为 false
-$_ENV['appName']    = 'SSPanel-UIM';                      //站点名称
-$_ENV['baseUrl']    = 'https://sspanel.host';               //站点地址
-$_ENV['muKey']      = 'NimaQu';                       //用于校验魔改后端请求,可以随意修改,但请保持前后端一致,否则节点不能工作!
-
-$_ENV['enableAdminApi'] = false;                      // 是否启用 Admin API, 如果不知道此项用途请保持为 false
-$_ENV['adminApiToken']  = 'ChangeMeToSafeKey';        // Admin API 的 Token, 请生成为高强度的 Token
-
-//数据库设置--------------------------------------------------------------------------------------------
-// db_host|db_socket 二选一,若设置 db_socket 则 db_host 会被忽略,不用请留空。若数据库在本机上推荐用 db_socket。
-// db_host 例: localhost(可解析的主机名), 127.0.0.1(IP 地址), 10.0.0.2:4406(含端口)
-// db_socket 例:/var/run/mysqld/mysqld.sock(需使用绝对地址)
-$_ENV['db_driver']    = 'mysql';
-$_ENV['db_host']      = '';
-$_ENV['db_socket']    = '';
-$_ENV['db_database']  = 'sspanel';           //数据库名
-$_ENV['db_username']  = 'root';              //数据库用户名
-$_ENV['db_password']  = 'sspanel';           //用户名对应的密码
-#高级
-$_ENV['db_charset']   = 'utf8mb4';
+/*
+    网站设置
+*/
+
+$_ENV['debug'] = false; // 生产环境需设为false
+$_ENV['appName'] = 'sspanel-uim'; // 站点名称
+$_ENV['key'] = '32150285b345c48aa3492f9212f61ca2'; // 修改为随机字符串
+$_ENV['baseUrl'] = 'https://domain.com';// 站点地址
+
+/*
+    数据库设置
+*/
+
+// db_host|db_socket 二选一,若设置 db_socket 则 db_host 会被忽略,不用请留空。若数据库在本机上推荐用 db_socket
+// db_host 例: localhost(可解析的主机名), 127.0.0.1(IP 地址), 10.0.0.2:4406(含端口)
+// db_socket 例:/var/run/mysqld/mysqld.sock(需使用绝对地址)
+
+$_ENV['db_host'] = 'localhost';
+$_ENV['db_database'] = '';
+$_ENV['db_username'] = '';
+$_ENV['db_password'] = '';
+
+$_ENV['db_socket'] = '';
+$_ENV['db_prefix'] = '';
+$_ENV['db_driver'] = 'mysql';
+$_ENV['db_charset'] = 'utf8mb4';
 $_ENV['db_collation'] = 'utf8mb4_unicode_ci';
-$_ENV['db_prefix']    = '';
 
-//流媒体解锁 如下设置将使397,297号节点复用4号节点的检测结果 使用时去掉注释符 //
-$_ENV['streaming_media_unlock_multiplexing'] = [
-    //'397' => '4',
-    //'297' => '4',
-];
+/*
+    支付设置
+*/
 
-//邮件设置--------------------------------------------------------------------------------------------
-$_ENV['sendPageLimit']      = 50;           //发信分页 解决大站发公告超时问题
-$_ENV['email_queue']        = true;         //如题,自动计划任务邮件使用队列 需要每分钟执行 php xcat Job SendMail
-$_ENV['mail_filter']        = 0;            //0: 关闭; 1: 白名单模式; 2; 黑名单模式;
-$_ENV['mail_filter_list']   = array("qq.com", "vip.qq.com", "foxmail.com");
-
-
-//备份设置--------------------------------------------------------------------------------------------
-$_ENV['auto_backup_email']  = '';                               //接收备份的邮箱
-$_ENV['auto_backup_password'] = '';                               //备份的压缩密码
-$_ENV['backup_notify']      = false;                            //备份通知到TG群中
-
-
-//用户注册设置-----------------------------------------------------------------------------------------
-$_ENV['free_user_reset_day']            = 0;                         //免费用戶的流量重置日,0为不重置
-$_ENV['free_user_reset_bandwidth']      = 0;                         //需要重置的免费流量,0为不重置
-$_ENV['random_group']              = '0';                       //注册时随机分组,注册时随机分配到的分组,多个分组请用英文半角逗号分隔
-
-$_ENV['enable_reg_im']             = false;                      //注册时是否要求用户输入IM联系方式
-
-$_ENV['reg_forbidden_ip']          = '127.0.0.0/8,::1/128';     //注册时默认禁止访问IP列表,半角英文逗号分割
-$_ENV['min_port']                  = 10000;                     //用户端口池最小值,如果该数值为0则用户在注册的时候不会被分配多用户端口,适合纯V2Ray/Trojan机场
-$_ENV['max_port']                  = 65535;                     //用户端口池最大值,如果该数值为0则用户在注册的时候不会被分配多用户端口,适合纯V2Ray/Trojan机场
-$_ENV['reg_forbidden_port']        = '';                        //注册时默认禁止访问端口列表,半角英文逗号分割,支持端口段
-
-$_ENV['mu_suffix']                 = 'microsoft.com';           //单端口多用户混淆参数后缀,可以随意修改,但请保持前后端一致
-$_ENV['mu_regex']                  = '%5m%id.%suffix';          //单端口多用户混淆参数表达式,%5m代表取用户特征 md5 的前五位,%id 代表用户id, %suffix 代表上面这个后缀。
-
-//已注册用户设置---------------------------------------------------------------------------------------
-#基础
-$_ENV['enable_checkin']             = true;         //是否啓用簽到功能
-$_ENV['checkinMin']                 = 1;            //用户签到最少流量 单位MB
-$_ENV['checkinMax']                 = 50;           //用户签到最多流量
-
-$_ENV['auto_clean_uncheck_days']    = -1;           //自动清理多少天没签到的0级用户,小于等于0时关闭
-$_ENV['auto_clean_unused_days']     = -1;           //自动清理多少天没使用的0级用户,小于等于0时关闭
-$_ENV['auto_clean_min_money']       = 1;            //余额低于多少的0级用户可以被清理
-
-$_ENV['enable_bought_reset']        = true;         //购买时是否重置流量
-$_ENV['enable_bought_extend']       = true;         //购买时是否延长等级期限(同等级配套)
-
-$_ENV['disconnect_time']        = 60;            //在用戶超过套餐连接IP数后多久才会拒绝新连接
-
-#高级
-$_ENV['class_expire_reset_traffic'] = 0;            //等级到期时重置为的流量值,单位GB,小于0时不重置
-$_ENV['account_expire_delete_days'] = -1;           //账户到期几天之后会删除账户,小于0时不删除
-
-$_ENV['enable_kill']                = true;         //是否允许用户注销账户
-$_ENV['enable_change_email']        = true;         //是否允许用户更改賬戶郵箱
-
-#用户流量余量不足邮件提醒
-$_ENV['notify_limit_mode']          = true;         //false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
-$_ENV['notify_limit_value']         = 20;           //当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
-
-//订阅设置---------------------------------------------------------------------------------------
-$_ENV['Subscribe']                  = true;                         //本站是否提供订阅功能
-$_ENV['subUrl']                     = $_ENV['baseUrl'] . '/link/';  //订阅地址,如需和站点名称相同,请不要修改
-$_ENV['mergeSub']                   = true;                         //合并订阅设置 可选项 false / true
-$_ENV['enable_sub_extend']          = true;                         //是否开启订阅中默认显示流量剩余以及账户到期时间以及 sub_message 中的信息
-$_ENV['enable_forced_replacement']  = true;                         //用户修改账户登录密码时,是否强制更换订阅地址
-
-// 订阅中的营销信息
-// 使用数组形式,将会添加在订阅列表的顶端
-// 可用于为用户推送最新地址等信息,尽可能简短且数量不宜太多
-$_ENV['sub_message']                = [];
-$_ENV['disable_sub_mu_port']        = false;                        // 将订阅中单端口的信息去除
-$_ENV['subscribeLog']               = true;                        //是否记录用户订阅日志
-$_ENV['subscribeLog_show']          = true;                         //是否允许用户查看订阅记录
-$_ENV['subscribeLog_keep_days']     = 7;                            //订阅记录保留天数
-$_ENV['mu_port_migration']          = false;                        //为后端直接下发偏移后的端口
-$_ENV['add_emoji_to_node_name']     = false;                        //为部分订阅中默认添加 emoji
-$_ENV['add_appName_to_ss_uri']      = true;                         //为 SS 节点名称中添加站点名
-$_ENV['subscribe_client']           = true;                         //下载协议客户端时附带节点和订阅信息
-$_ENV['subscribe_client_url']       = '';                           //使用独立的服务器提供附带节点和订阅信息的协议客户端下载,为空表示不使用
-$_ENV['Clash_DefaultProfiles']      = 'default';                    //Clash 默认配置方案
-$_ENV['Surge_DefaultProfiles']      = 'default';                    //Surge 默认配置方案
-$_ENV['Surge2_DefaultProfiles']     = 'default';                    //Surge2 默认配置方案
-$_ENV['Surfboard_DefaultProfiles']  = 'default';                    //Surfboard 默认配置方案
-
-
-//审计自动封禁设置--------------------------------------------------------------------------------------------
-$_ENV['enable_auto_detect_ban']      = false;       // 审计自动封禁开关
-$_ENV['auto_detect_ban_numProcess']  = 300;         // 单次计划任务中审计记录的处理数量
-$_ENV['auto_detect_ban_allow_admin'] = true;        // 管理员不受审计限制
-$_ENV['auto_detect_ban_allow_users'] = [];          // 审计封禁的例外用户 ID
-
-// 审计封禁判断类型:
-//   - 1 = 仁慈模式,每触碰多少次封禁一次
-//   - 2 = 疯狂模式,累计触碰次数按阶梯进行不同时长的封禁
-$_ENV['auto_detect_ban_type']        = 1;
-$_ENV['auto_detect_ban_number']      = 30;             // 仁慈模式每次执行封禁所需的触发次数
-$_ENV['auto_detect_ban_time']        = 60;             // 仁慈模式每次封禁的时长 (分钟)
-
-// 疯狂模式阶梯
-// key 为触发次数
-//   - type:可选 time 按时间 或 kill 删号
-//   - time:时间,单位分钟
-$_ENV['auto_detect_ban'] = [
-    100 => [
-        'type' => 'time',
-        'time' => 120
-    ],
-    300 => [
-        'type' => 'time',
-        'time' => 720
+$_ENV['active_payments'] = [
+    'alipay_f2f' => [
+        'name' => '支付宝',
+        'min' => '10',
+        'max' => '1000',
+        'enable' => true,
     ],
-    600 => [
-        'type' => 'time',
-        'time' => 4320
+    'universal' => [
+        'name' => '',
+        'min' => '10',
+        'max' => '1000',
+        'gateway' => '',
+        'sign_key' => '',
+        'enable' => true,
     ],
-    1000 => [
-        'type' => 'kill',
-        'time' => 0
-    ]
 ];
 
+/*
+    与 Web Api 有关的设置
+*/
 
-//Bot 设置--------------------------------------------------------------------------------------------
-# Telegram bot
-$_ENV['enable_telegram']                    = false;        //是否开启 Telegram bot
-$_ENV['use_new_telegram_bot']               = true;         //是否使用新的 Telegram bot
-$_ENV['telegram_token']                     = '';           //Telegram bot,bot 的 token ,跟 father bot 申请
-$_ENV['telegram_chatid']                    = '';           //Telegram bot,群组会话 ID,把机器人拉进群里之后跟他 /ping 一下即可得到
-$_ENV['telegram_bot']                       = '_bot';       //Telegram 机器人账号
-$_ENV['telegram_group_quiet']               = false;        //Telegram 机器人在群组中不回应
-$_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_port']            = ['端口'];                     //用户搜索字段 port 的别名,可多个,格式为 PHP 数组
-
-$_ENV['remark_user_option_is_admin']        = ['管理员'];                   //用户搜索字段 is_admin 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_enable']          = ['用户启用'];                  //用户搜索字段 enable 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_money']           = ['金钱', '余额'];             //用户搜索字段 money 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_port']            = ['端口'];                     //用户搜索字段 port 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_transfer_enable'] = ['流量'];                     //用户搜索字段 transfer_enable 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_passwd']          = ['连接密码'];                 //用户搜索字段 passwd 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_method']          = ['加密'];                     //用户搜索字段 method 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_protocol']        = ['协议'];                     //用户搜索字段 protocol 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_protocol_param']  = ['协参', '协议参数'];         //用户搜索字段 protocol_param 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_obfs']            = ['混淆'];                     //用户搜索字段 obfs 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_obfs_param']      = ['混参', '混淆参数'];         //用户搜索字段 obfs_param 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_invite_num']      = ['邀请数量'];                 //用户搜索字段 invite_num 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_node_group']      = ['用户组', '用户分组'];       //用户搜索字段 node_group 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_class']           = ['等级'];                     //用户搜索字段 class 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_class_expire']    = ['等级过期时间'];             //用户搜索字段 class_expire 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_expire_in']       = ['账号过期时间'];             //用户搜索字段 expire_in 的别名,可多个,格式为 PHP 数组
-$_ENV['remark_user_option_node_speedlimit'] = ['限速'];                    //用户搜索字段 node_speedlimit 的别名,可多个,格式为 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
-$_ENV['enable_telegram_login']              = false;   //开启这个设置前请先配置 Telegram bot 否则不会生效
-
-
-#工单系统设置
-$_ENV['enable_ticket']        = true;        //是否开启工单系统
-$_ENV['mail_ticket']          = true;        //是否开启工单邮件提醒
-
-# Server酱 用户提交新工单或者回复工单时用微信提醒机场主 https://sct.ftqq.com/
-$_ENV['useScFtqq']            = false;        //是否开启工单Server酱提醒
-$_ENV['ScFtqq_SCKEY']         = '';           //请填写您在Server酱获取的SCKEY  请仔细检查勿粘贴错
-
-
-#后台商品列表 销量统计
-$_ENV['sales_period']         = 30;             //统计指定周期内的销量,值为【expire/任意大于0的整数】
-
-#国旗
-$_ENV['enable_flag']          = true;            //启用该项之前务必先仔细阅读教程
-$_ENV['flag_regex']           = '/.*?(?=\s)/';   //从站点全名中匹配【国家/地区】的正则表达式(php版)
-
-#iOS账户显示
-$_ENV['display_ios_class']    = -1;        //至少等级为多少的用户可以看见,小于0时关闭此功能
-$_ENV['display_ios_topup']    = 0;         //满足等级要求后,累计充值高于多少的用户可以看见
-$_ENV['ios_account']          = '';        //iOS账户
-$_ENV['ios_password']         = '';        //iOS密码
-
-#用户中心首页添加其他客户端的支持,可配合 subconverter 等 Api
-$_ENV['userCenterClient']     = [
-    'iOS'     => [
-        [
-            'name'           => 'Loon',
-            'support'        => 'SS/SSR/VMess',
-            'download_urls'  => [
-                [
-                    'name' => '本站下载',
-                    'url'  => 'https://google.com',
-                ],
-                [
-                    'name' => '官方下载',
-                    'url'  => 'https://baidu.com',
-                ]
-            ],
-            'tutorial_url'   => '/doc/#/iOS/Loon',
-            'description'    => '其他说明.',
-            'subscribe_urls' => [
-                [
-                    'name' => 'SS 订阅',
-                    'type' => 'href',
-                    'url'  => '%userUrl%?sub=2',
-                ],
-                [
-                    'name' => 'SSR 订阅',
-                    'type' => 'href',
-                    'url'  => '%userUrl%?sub=1',
-                ],
-                [
-                    'name' => 'V2Ray 订阅',
-                    'type' => 'copy',
-                    'url'  => '%userUrl%?sub=3',
-                ]
-            ]
-        ]
-    ],
-    'macOS'   => [],
-    'Linux'   => [],
-    'Router'  => [],
-    'Android' => [],
-    'Windows' => [
-        [
-            'name'           => 'Netch',
-            'support'        => 'SS/SSR/VMess',
-            'download_urls'  => [
-                [
-                    'name' => '官方下载',
-                    'url'  => 'https://github.com/NetchX/Netch/releases',
-                ]
-            ],
-            'tutorial_url'   => '/doc/#/Windows/Netch',
-            'description'    => '其他说明.',
-            'subscribe_urls' => [
-                [
-                    'name' => 'SS 订阅',
-                    'type' => 'href',
-                    'url'  => '%userUrl%?sub=2',
-                ],
-                [
-                    'name' => 'SSR 订阅',
-                    'type' => 'href',
-                    'url'  => '%userUrl%?sub=1',
-                ],
-                [
-                    'name' => 'V2Ray 订阅',
-                    'type' => 'copy',
-                    'url'  => '%userUrl%?sub=3',
-                ]
-            ]
-        ]
-    ]
+$_ENV['WebAPI'] = true;
+$_ENV['muKey'] = '3a7caa4b32ffb47e7bb2d0ec7d097110'; // 通信密钥
+$_ENV['muKeyList'] = []; // 多key列表
+$_ENV['checkNodeIp'] = true; // 是否验证节点ip
+
+$_ENV['enableAdminApi'] = false; // 是否启用 Admin API, 如果不知道此项用途请保持为 false
+$_ENV['adminApiToken']  = '7cb4ddeaea0a1a7a42f351f71a28124a'; // Admin API 的 Token, 请生成为高强度的 Token
+
+// 如下设置将使397,297号节点复用4号节点的流媒体解锁
+$_ENV['streaming_media_unlock_multiplexing'] = [
+    //'397' => '4',
+    //'297' => '4',
 ];
 
-//节点检测-----------------------------------------------------------------------------------------------
-#GFW检测,请通过crontab进行【开启/关闭】
-$_ENV['detect_gfw_interval']             = 3600;                                                               //检测间隔,单位:秒,低于推荐值会爆炸
-$_ENV['detect_gfw_port']                 = 22;                                                                 //所有节点服务器都打开的TCP端口,常用的为22(SSH端口)
-$_ENV['detect_gfw_url']                  = 'http://cn-sh-tcping.sspanel.org:8080/tcping?ip={ip}&port={port}'; //检测节点是否被gfw墙了的API的URL
-$_ENV['detect_gfw_judge']                = '$json_tcping[\'status\']=="true"';                                 //判断是否被墙的依据,json_tcping为上方URL返回的json数组
-$_ENV['detect_gfw_count']                = '3';                                                                //尝试次数
-
-#离线检测
-$_ENV['enable_detect_offline']           = true;
-#离线检测是否推送到Server酱 请配置好上文的Server配置
-$_ENV['enable_detect_offline_useScFtqq'] = false;
-
-//V2Ray相关设置------------------------------------------------------------------------------------------
-$_ENV['v2ray_port']     = 443;                  //V2Ray端口
-$_ENV['v2ray_protocol'] = 'HTTP/2 + TLS';       //V2Ray协议
-$_ENV['v2ray_alter_id'] = 32;
-$_ENV['v2ray_level']    = 0;
-
-//以下所有均为高级设置(一般用不上,不用改---------------------------------------------------------------------
-
-// 主站是否提供 WebAPI
-// - 为了安全性,推荐使用 WebAPI 模式对接节点并关闭公网数据库连接。
-// - 如果您全部节点使用数据库连接或者拥有独立的 WebAPI 站点或 Seed,则可设为 false。
-$_ENV['WebAPI']     = true;
-
-#杂项
-$_ENV['authDriver']             = 'cookie';            //不能更改此项
-$_ENV['pwdMethod']              = 'md5';               //密码加密 可选 md5, sha256, bcrypt, argon2i, argon2id(argon2i需要至少php7.2)
-$_ENV['salt']                   = '';                  //推荐配合 md5/sha256, bcrypt/argon2i/argon2id 会忽略此项
-$_ENV['sessionDriver']          = 'cookie';            //可选: cookie
-$_ENV['cacheDriver']            = 'cookie';            //可选: cookie
-$_ENV['tokenDriver']            = 'db';                //可选: db
-
-$_ENV['enable_login_bind_ip']   = false;        //是否将登陆线程和IP绑定
-$_ENV['rememberMeDuration']     = 7;           //登录时记住账号时长天数
-
-$_ENV['timeZone']               = 'PRC';                 //PRC 天朝时间  UTC 格林时间
-$_ENV['theme']                  = 'material';            //默认主题
-$_ENV['jump_delay']             = 1200;                  //跳转延时,单位ms,不建议太长
-
-$_ENV['checkNodeIp']            = true;                 //是否webapi验证节点ip
-$_ENV['muKeyList']              = [];                   //多 key 列表
-$_ENV['keep_connect']           = false;               // 流量耗尽用户限速至 1Mbps
-$_ENV['money_from_admin']       = false;            //是否开启管理员修改用户余额时创建充值记录
-
-#Cloudflare
-$_ENV['cloudflare_enable']      = false;         //是否开启 Cloudflare 解析
-$_ENV['cloudflare_email']       = '';            //Cloudflare 邮箱地址
-$_ENV['cloudflare_key']         = '';            //Cloudflare API Key
-$_ENV['cloudflare_name']        = '';            //域名
-
-#是否夹带统计代码,自己在 resources/views/{主题名} 下创建一个 analytics.tpl ,如果有必要就用 literal 界定符
-$_ENV['enable_analytics_code']  = false;
-
-#在套了CDN之后获取用户真实ip,如果您不知道这是什么,请不要乱动
+/*
+    注册用户行为限制
+*/
+
+$_ENV['enable_kill'] = false; // 是否允许用户主动删除账户
+$_ENV['enable_change_email'] = false;  // 是否允许用户主动更改账户邮箱
+$_ENV['enable_checkin'] = true; // 是否允许用户签到
+$_ENV['checkinMin'] = 100; // 签到可获得的最低流量(MB)
+$_ENV['checkinMax'] = 300; // 签到可获得的最多流量(MB)
+$_ENV['enable_ticket'] = true; // 是否开启工单系统
+
+/*
+    与邮件相关设置
+*/
+
+$_ENV['sendPageLimit'] = 50; // 发信分页数
+$_ENV['email_queue'] = true; // 邮件队列开关
+$_ENV['mail_filter'] = 0; // 0关闭; 1白名单模式; 2黑名单模式
+$_ENV['mail_filter_list'] = ['qq.com', 'vip.qq.com', 'foxmail.com'];
+$_ENV['mail_ticket'] = true; // 是否开启工单邮件提醒
+$_ENV['notify_limit_mode'] = true; // false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
+$_ENV['notify_limit_value'] = 20; // 当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
+
+/*
+    后端设置
+*/
+
+$_ENV['keep_connect'] = false; // 流量耗尽则限速1Mbps
+$_ENV['disconnect_time'] = 60; // 在用户超过套餐连接IP数后多久才会拒绝新连接
+
+$_ENV['min_port'] = 10000; // 0为不分配; 其他值时为分配起始端口
+$_ENV['max_port'] = 60000; // 0为不分配; 其他值时为分配终止端口
+
+$_ENV['v2ray_port'] = 443;
+$_ENV['v2ray_level'] = 0;
+$_ENV['v2ray_alter_id'] = 2;
+$_ENV['v2ray_protocol'] = 'HTTP/2 + TLS';
+
+/*
+    Telegram bot
+*/
+
+// 变更这些参数均需要执行 php xcat Tool setTelegram
+$_ENV['telegram_bot'] = ''; // 机器人用户名
+$_ENV['telegram_token'] = ''; // 机器人token
+$_ENV['telegram_chatid'] = ''; // 群组会话id
+$_ENV['enable_telegram'] = false; // 机器人开关
+$_ENV['use_new_telegram_bot'] = true; // 新版机器人开关
+$_ENV['telegram_group_quiet'] = false; // 是否在群组中回应
+$_ENV['telegram_request_token'] = '51d38e0819930dbdb808a5c3e65d08a9'; // 修改为随机字符串
+
+// 功能设置
+$_ENV['finance_public'] = false; // 财务报告是否向群公开
+$_ENV['enable_welcome_message'] = true; // 机器人发送欢迎消息
+$_ENV['enable_telegram_login'] = false; // 需配置并启用新版机器人开关
+$_ENV['allow_to_join_new_groups'] = true; // 允许 Bot 加入下方配置之外的群组
+$_ENV['group_id_allowed_to_join'] = []; // 允许加入的群组 ID
+$_ENV['telegram_admins'] = []; // 额外的 Telegram 管理员 ID
+$_ENV['delete_message_time'] = 180; // 0为关闭; 其他数值为在此时间后删除用户触发的 bot 回复
+$_ENV['delete_admin_message_time'] = 86400; // 0为关闭; 其他数值为在此时间后删除管理命令触发的 bot 回复
+$_ENV['enable_delete_user_cmd'] = false; // 删除用户触发的 bot 回复功能开关
+$_ENV['help_any_command'] = false; // 其他未知命令触发 /help 回复
+$_ENV['enable_user_email_group_show'] = false; // false时隐藏用户完整邮箱
+
+/*
+    订阅设置
+*/
+
+$_ENV['Subscribe'] = true; // 本站是否提供订阅功能
+$_ENV['subUrl'] = $_ENV['baseUrl'] . '/link/'; // 订阅地址,如需和站点名称相同,请不要修改
+$_ENV['mergeSub'] = true; // 合并订阅设置 可选项 false / true
+$_ENV['enable_sub_extend'] = true; // 是否开启订阅中默认显示流量剩余以及账户到期时间以及 sub_message 中的信息
+$_ENV['enable_forced_replacement'] = true; // 用户修改账户登录密码时,是否强制更换订阅地址
+$_ENV['sub_message'] = []; // 订阅中的营销信息,使用数组形式,将会添加在订阅列表的顶端,可用于为用户推送最新地址等信息,尽可能简短且数量不宜太多
+$_ENV['disable_sub_mu_port'] = false; // 将订阅中单端口的信息去除
+$_ENV['subscribeLog'] = true; // 是否记录用户订阅日志
+$_ENV['subscribeLog_show'] = true; // 是否允许用户查看订阅记录
+$_ENV['subscribeLog_keep_days'] = 7; // 订阅记录保留天数
+$_ENV['mu_port_migration'] = false; // 为后端直接下发偏移后的端口
+$_ENV['add_emoji_to_node_name'] = false; // 为部分订阅中默认添加 emoji
+$_ENV['add_appName_to_ss_uri'] = true; // 为 SS 节点名称中添加站点名
+$_ENV['subscribe_client'] = true; // 下载协议客户端时附带节点和订阅信息
+$_ENV['subscribe_client_url'] = ''; // 使用独立的服务器提供附带节点和订阅信息的协议客户端下载,为空表示不使用
+$_ENV['Clash_DefaultProfiles'] = 'default'; // Clash 默认配置方案
+$_ENV['Surge_DefaultProfiles'] = 'default'; // Surge 默认配置方案
+$_ENV['Surge2_DefaultProfiles'] = 'default'; // Surge2 默认配置方案
+$_ENV['Surfboard_DefaultProfiles']  = 'default'; // Surfboard 默认配置方案
+
+/*
+    注册设置
+*/
+
+$_ENV['random_group'] = '0'; // 注册时随机分配到的分组,英文半角逗号分隔
+$_ENV['enable_reg_im'] = false; // 注册时是否要求用户输入IM联系方式
+$_ENV['reg_forbidden_ip'] = '127.0.0.0/8,::1/128'; // 注册时默认禁止访问IP列表,英文半角逗号分隔
+$_ENV['reg_forbidden_port'] = ''; // 注册时默认禁止访问端口列表,英文半角逗号分隔,支持端口段
+$_ENV['mu_suffix'] = 'microsoft.com'; // 单端口多用户混淆参数后缀,可以随意修改,但请保持前后端一致
+$_ENV['mu_regex'] = '%5m%id.%suffix'; // 单端口多用户混淆参数表达式,%5m代表取用户特征 md5 的前五位,%id 代表用户id, %suffix 代表上面这个后缀
+
+/*
+    第三方服务
+*/
+
+// cloudflare.com
+$_ENV['cloudflare_enable'] = false; // 是否开启 Cloudflare 解析
+$_ENV['cloudflare_email'] = ''; // Cloudflare 邮箱地址
+$_ENV['cloudflare_key'] = ''; // Cloudflare API Key
+$_ENV['cloudflare_name'] = ''; // 域名
+
+// sentry.io
+$_ENV['sentry_dsn'] = '';
+
+// github.com
+$_ENV['github_access_token'] = '';
+
+/*
+    杂项
+*/
+
+$_ENV['authDriver'] = 'cookie'; // 不能更改
+$_ENV['pwdMethod'] = 'md5'; // md5,sha256,bcrypt,argon2i,argon2id
+$_ENV['salt'] = ''; // 加盐仅支持 md5,sha256
+$_ENV['tokenDriver'] = 'db';
+$_ENV['cacheDriver'] = 'cookie';
+$_ENV['sessionDriver'] = 'cookie';
+$_ENV['theme'] = 'material'; // 默认主题
+$_ENV['timeZone'] = 'PRC'; // PRC / UTC
+$_ENV['jump_delay'] = 1200;
+$_ENV['enable_login_bind_ip'] = true; // 是否将登陆线程和IP绑定
+$_ENV['cookie_expiration_time'] = 1; // cookie 过期时间
+$_ENV['php_user_group'] = 'www:www';
+
+/*
+    获取客户端地址
+*/
+
 $_ENV['cdn_forwarded_ip'] = array('HTTP_X_FORWARDED_FOR', 'HTTP_ALI_CDN_REAL_IP', 'X-Real-IP', 'True-Client-Ip');
 foreach ($_ENV['cdn_forwarded_ip'] as $cdn_forwarded_ip) {
     if (isset($_SERVER[$cdn_forwarded_ip])) {
@@ -380,11 +211,3 @@ foreach ($_ENV['cdn_forwarded_ip'] as $cdn_forwarded_ip) {
         break;
     }
 }
-
-// https://sentry.io for production debugging
-$_ENV['sentry_dsn'] = '';
-
-// ClientDownload 命令解决 API 访问频率高而被限制使用的 Github access token
-$_ENV['github_access_token'] = '';
-
-$_ENV['php_user_group'] = 'www:www';

+ 0 - 1
resources/views/material/admin/footer.tpl

@@ -1,7 +1,6 @@
 <footer class="ui-footer">
     <div class="container">
         &copy;{date("Y")} {$config['appName']} | Powered by <a href="/staff">SSPANEL</a>
-        {if $config['enable_analytics_code'] === true}{include file='analytics.tpl'}{/if}
     </div>
 </footer>
 

+ 0 - 1
resources/views/material/footer.tpl

@@ -1,7 +1,6 @@
 <footer class="ui-footer">
     <div class="container">
         &copy;{date("Y")} {$config['appName']} | Powered by <a href="/staff">SSPANEL</a>
-        {if $config['enable_analytics_code'] === true}{include file='analytics.tpl'}{/if}
     </div>
 </footer>
 

+ 0 - 1
resources/views/material/user/footer.tpl

@@ -1,7 +1,6 @@
 <footer class="ui-footer">
     <div class="container">
         &copy;{date("Y")} {$config['appName']} | Powered by <a href="/staff">SSPANEL</a>
-        {if $config['enable_analytics_code'] === true}{include file='analytics.tpl'}{/if}
     </div>
 </footer>
 

+ 0 - 48
resources/views/material/user/index.tpl

@@ -488,11 +488,6 @@
                                                         .
                                                         <a id="win_qv2ray" class="copy-config btn-dl" onclick=Copyconfig("/user/getUserAllURL?type=v2ray","#win_qv2ray","")><i class="material-icons icon-sm">send</i> 拷贝全部节点 URL</a>
                                                     </p>
-                                            {if array_key_exists('Windows',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['Windows']) != 0}
-                                                    {printClient items=$config['userCenterClient']['Windows']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_mac">
                                                 <p><span class="icon icon-lg text-white">filter_1</span> Surge - [ SS/VMess ]:</p>
@@ -568,31 +563,8 @@
                                                         .
                                                         <a id="mac_qv2ray" class="copy-config btn-dl" onclick=Copyconfig("/user/getUserAllURL?type=v2ray","#mac_qv2ray","")><i class="material-icons icon-sm">send</i> 拷贝全部节点 URL</a>
                                                     </p>
-                                            {if array_key_exists('macOS',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['macOS']) != 0}
-                                                    {printClient items=$config['userCenterClient']['macOS']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_ios">
-                                            {if $display_ios_class>=0}
-                                                {if $user->class>=$display_ios_class && $user->get_top_up()>=$display_ios_topup}
-                                                <div><span class="icon icon-lg text-white">account_box</span> 本站iOS账户:</div>
-                                                <div class="float-clear">
-                                                    <input type="text" class="input form-control form-control-monospace cust-link col-xx-12 col-sm-8 col-lg-7" name="input1" readonly value="{$ios_account}" readonly="true">
-                                                    <button class="copy-text btn btn-subscription col-xx-12 col-sm-3 col-lg-2" type="button" data-clipboard-text="{$ios_account}">点击复制</button>
-                                                    <br>
-                                                </div>
-                                                <div><span class="icon icon-lg text-white">lock</span> 本站iOS密码:</div>
-                                                <div class="float-clear">
-                                                    <input type="text" class="input form-control form-control-monospace cust-link col-xx-12 col-sm-8 col-lg-7" name="input1" readonly value="{$ios_password}" readonly="true">
-                                                    <button class="copy-text btn btn-subscription col-xx-12 col-sm-3 col-lg-2" type="button" data-clipboard-text="{$ios_password}">点击复制</button>
-                                                    <br>
-                                                </div>
-                                                <p><span class="icon icon-lg text-white">error</span><strong>禁止将账户分享给他人!</strong></p>
-                                                <hr/>
-                                                {/if}
-                                            {/if}
                                                 <p><span class="icon icon-lg text-white">filter_1</span> Surge - [ SS/VMess ]:</p>
                                                     <p>
                                                         应用下载:
@@ -694,11 +666,6 @@
                                                     .
                                                     <a class="btn-dl" href="{$subInfo['clash']}"><i class="material-icons icon-sm">send</i> 配置文件下载</a>
                                                 </p>
-                                            {if array_key_exists('iOS',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['iOS']) != 0}
-                                                    {printClient items=$config['userCenterClient']['iOS']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_android">
                                                 <p><span class="icon icon-lg text-white">filter_1</span> SS - [ SS ]:</p>
@@ -790,11 +757,6 @@
                                                         .
                                                         <a class="btn-dl" href="clash://install-config?url={urlencode($subInfo['clash'])}"><i class="material-icons icon-sm">send</i> 配置一键导入</a>
                                                     </p>
-                                            {if array_key_exists('Android',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['Android']) != 0}
-                                                    {printClient items=$config['userCenterClient']['Android']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_linux">
                                                 <p><span class="icon icon-lg text-white">filter_1</span> Electron SSR - [ SS/SSR ]:</p>
@@ -822,11 +784,6 @@
                                                         .
                                                         <a id="linux_qv2ray" class="copy-config btn-dl" onclick=Copyconfig("/user/getUserAllURL?type=v2ray","#linux_qv2ray","")><i class="material-icons icon-sm">send</i> 拷贝全部节点 URL</a>
                                                     </p>
-                                            {if array_key_exists('Linux',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['Linux']) != 0}
-                                                    {printClient items=$config['userCenterClient']['Linux']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_router">
                                                 <p><span class="icon icon-lg text-white">filter_1</span> Koolshare 固件路由器/软路由:</p>
@@ -842,11 +799,6 @@
                                                         .
                                                         <a class="copy-text btn-dl" data-clipboard-text="{$subInfo['v2ray']}"><i class="material-icons icon-sm">send</i> 拷贝 V2Ray 订阅链接</a>
                                                     </p>
-                                            {if array_key_exists('Router',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['Router']) != 0}
-                                                    {printClient items=$config['userCenterClient']['Router']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                         </div>
                                     </div>

+ 0 - 8
resources/views/material/user/node/index.tpl

@@ -53,11 +53,6 @@
                                 <div class="node-card node-flex" cardindex="{$index}">
                                     <div class="nodemain">
                                         <div class="nodehead node-flex" title="节点名称">
-{*                                        *}{if $config['enable_flag'] === true}
-                                            <div class="flag">
-                                                <img src="/images/prefix/{$node['flag']}">
-                                            </div>
-{*                                        *}{/if}
                                             <div class="nodename">{$node['name']}</div>
                                         </div>
                                         <!-- 在线人数 -->
@@ -151,9 +146,6 @@
                                                 <div class="tile-inner">
                                                     <div class="text-overflow node-textcolor">
                                                         <span class="enable-flag" title="节点名称">
-{*                                                        *}{if $config['enable_flag'] === true}
-                                                            <img src="/images/prefix/{$node['flag']}" height="22"/>
-{*                                                        *}{/if}
                                                             {$node['name']}
                                                         </span>
                                                         |

+ 0 - 80
src/Command/Backup.php

@@ -1,80 +0,0 @@
-<?php
-
-namespace App\Command;
-
-use App\Services\Mail;
-use App\Utils\Telegram;
-use App\Models\Setting;
-use Exception;
-use RuntimeException;
-
-class Backup extends Command
-{
-    public $description = ''
-        . '├─=: php xcat Backup [选项]' . PHP_EOL
-        . '│ ├─ full                    - 整体数据备份' . PHP_EOL
-        . '│ ├─ simple                  - 只备份核心数据' . PHP_EOL;
-
-    public function boot()
-    {
-        if (count($this->argv) === 2) {
-            echo $this->description;
-        } else {
-            $methodName = $this->argv[2];
-            if ($methodName == 'full') {
-                $this->backup(true);
-            } else {
-                $this->backup(false);
-            }
-        }
-    }
-
-    public function backup($full = false)
-    {
-        $configs = Setting::getClass('backup');
-        
-        ini_set('memory_limit', '-1');
-        $to = $configs['auto_backup_email'];
-        if ($to == null) {
-            return false;
-        }
-        if (!mkdir('/tmp/ssmodbackup/') && !is_dir('/tmp/ssmodbackup/')) {
-            throw new RuntimeException(sprintf('Directory "%s" was not created', '/tmp/ssmodbackup/'));
-        }
-        $db_address_array = explode(':', $_ENV['db_host']);
-        if ($full) {
-            system('mysqldump --user=' . $_ENV['db_username'] . ' --password=' . $_ENV['db_password'] . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' ' . $_ENV['db_database'] . ' > /tmp/ssmodbackup/mod.sql');
-        } else {
-            system(
-                'mysqldump --user=' . $_ENV['db_username'] . ' --password=' . $_ENV['db_password'] . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' ' . $_ENV['db_database'] . ' announcement blockip bought code coupon link login_ip payback shop user_invite_code node user_password_reset ticket unblockip user user_token email_verify detect_list paylist > /tmp/ssmodbackup/mod.sql',
-                $ret
-            );
-            system(
-                'mysqldump --opt --user=' . $_ENV['db_username'] . ' --password=' . $_ENV['db_password'] . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' -d ' . $_ENV['db_database'] . ' alive_ip node_info node_online_log detect_log telegram_session >> /tmp/ssmodbackup/mod.sql',
-                $ret
-            );
-        }
-
-        system('cp ' . BASE_PATH . '/config/.config.php /tmp/ssmodbackup/configbak.php', $ret);
-        echo $ret;
-        $backup_passwd = $configs["auto_backup_password"] == "" ? "" : " -P " . $configs["auto_backup_password"];
-        system('zip -r /tmp/ssmodbackup.zip /tmp/ssmodbackup/* ' . $backup_passwd, $ret);
-        $subject = $_ENV['appName'] . '-备份成功';
-        $text = '您好,系统已经为您自动备份,请查看附件,用您设定的密码解压。';
-        try {
-            Mail::send($to, $subject, 'news/backup.tpl', [
-                'text' => $text
-            ], [
-                '/tmp/ssmodbackup.zip'
-            ]);
-        } catch (Exception $e) {
-            echo $e->getMessage();
-        }
-        system('rm -rf /tmp/ssmodbackup', $ret);
-        system('rm /tmp/ssmodbackup.zip', $ret);
-
-        if ($configs['auto_backup_notify'] == true) {
-            Telegram::Send('备份工作已经完成');
-        }
-    }
-}

+ 0 - 114
src/Command/DetectBan.php

@@ -1,114 +0,0 @@
-<?php
-
-namespace App\Command;
-
-use App\Models\{
-    User,
-    DetectLog,
-    DetectBanLog
-};
-
-class DetectBan extends Command
-{
-    public $description = '├─=: php xcat DetectBan      - 审计封禁定时任务' . PHP_EOL;
-
-    /**
-     * 审计封禁任务
-     */
-    public function boot()
-    {
-        if ($_ENV['enable_auto_detect_ban'] === false) {
-            return;
-        }
-        echo '审计封禁检查开始.' . PHP_EOL;
-        $new_logs = DetectLog::where('status', '=', 0)->orderBy('id', 'asc')->take($_ENV['auto_detect_ban_numProcess'])->get();
-        if (count($new_logs) != 0) {
-
-            $user_logs = [];
-            foreach ($new_logs as $log) {
-                // 分类各个用户的记录数量
-                if (!in_array($log->user_id, array_keys($user_logs))) {
-                    $user_logs[$log->user_id] = 0;
-                }
-                $user_logs[$log->user_id]++;
-                $log->status = 1;
-                $log->save();
-            }
-
-            foreach ($user_logs as $userid => $value) {
-                // 执行封禁
-                $user = User::find($userid);
-                if ($user == null) {
-                    continue;
-                }
-                $user->all_detect_number += $value;
-                $user->save();
-
-                if ($user->enable == 0 || ($user->is_admin && $_ENV['auto_detect_ban_allow_admin'] === true) || in_array($user->id, $_ENV['auto_detect_ban_allow_users'])) {
-                    // 如果用户已被封禁
-                    // 如果用户是管理员
-                    // 如果属于钦定用户
-                    // 则跳过
-                    continue;
-                }
-
-                if ($_ENV['auto_detect_ban_type'] == 1) {
-                    $last_DetectBanLog      = DetectBanLog::where('user_id', $userid)->orderBy('id', 'desc')->first();
-                    $last_all_detect_number = ($last_DetectBanLog == null ? 0 : (int) $last_DetectBanLog->all_detect_number);
-                    $detect_number          = ($user->all_detect_number - $last_all_detect_number);
-                    if ($detect_number >= $_ENV['auto_detect_ban_number']) {
-                        $last_detect_ban_time               = $user->last_detect_ban_time;
-                        $end_time                           = date('Y-m-d H:i:s');
-                        $user->enable                       = 0;
-                        $user->last_detect_ban_time         = $end_time;
-                        $user->save();
-                        $DetectBanLog                       = new DetectBanLog();
-                        $DetectBanLog->user_name            = $user->user_name;
-                        $DetectBanLog->user_id              = $user->id;
-                        $DetectBanLog->email                = $user->email;
-                        $DetectBanLog->detect_number        = $detect_number;
-                        $DetectBanLog->ban_time             = $_ENV['auto_detect_ban_time'];
-                        $DetectBanLog->start_time           = strtotime($last_detect_ban_time);
-                        $DetectBanLog->end_time             = strtotime($end_time);
-                        $DetectBanLog->all_detect_number    = $user->all_detect_number;
-                        $DetectBanLog->save();
-                    }
-                } else {
-                    $number = $user->all_detect_number;
-                    $tmp = 0;
-                    foreach ($_ENV['auto_detect_ban'] as $key => $value) {
-                        if ($number >= $key) {
-                            if ($key >= $tmp) {
-                                $tmp = $key;
-                            }
-                        }
-                    }
-                    if ($tmp != 0) {
-                        if ($_ENV['auto_detect_ban'][$tmp]['type'] == 'kill') {
-                            $user->kill_user();
-                        } else {
-                            $last_detect_ban_time               = $user->last_detect_ban_time;
-                            $end_time                           = date('Y-m-d H:i:s');
-                            $user->enable                       = 0;
-                            $user->last_detect_ban_time         = $end_time;
-                            $user->save();
-                            $DetectBanLog                       = new DetectBanLog();
-                            $DetectBanLog->user_name            = $user->user_name;
-                            $DetectBanLog->user_id              = $user->id;
-                            $DetectBanLog->email                = $user->email;
-                            $DetectBanLog->detect_number        = $number;
-                            $DetectBanLog->ban_time             = $_ENV['auto_detect_ban'][$tmp]['time'];
-                            $DetectBanLog->start_time           = strtotime('1989-06-04 00:05:00');
-                            $DetectBanLog->end_time             = strtotime($end_time);
-                            $DetectBanLog->all_detect_number    = $number;
-                            $DetectBanLog->save();
-                        }
-                    }
-                }
-            }
-        } else {
-            echo '- 暂无新记录.' . PHP_EOL;
-        }
-        echo '审计封禁检查结束.' . PHP_EOL;
-    }
-}

+ 0 - 115
src/Command/DetectGFW.php

@@ -1,115 +0,0 @@
-<?php
-
-namespace App\Command;
-
-use App\Models\{
-    Node,
-    User
-};
-use App\Services\Config;
-use App\Utils\Telegram;
-
-class DetectGFW extends Command
-{
-    public $description = '├─=: php xcat DetectGFW      - 节点被墙检测定时任务' . PHP_EOL;
-
-    public function boot()
-    {
-        //节点被墙检测
-        $last_time = file_get_contents(BASE_PATH . '/storage/last_detect_gfw_time');
-        for ($count = 1; $count <= 12; $count++) {
-            if (time() - $last_time >= $_ENV['detect_gfw_interval']) {
-                $file_interval = fopen(BASE_PATH . '/storage/last_detect_gfw_time', 'wb');
-                fwrite($file_interval, time());
-                fclose($file_interval);
-                $nodes = Node::all();
-                $adminUser = User::where('is_admin', '=', '1')->get();
-                foreach ($nodes as $node) {
-                    if (
-                        $node->node_ip == '' ||
-                        $node->node_ip == null ||
-                        $node->online == false
-                    ) {
-                        continue;
-                    }
-                    $api_url = $_ENV['detect_gfw_url'];
-                    $api_url = str_replace(
-                        array('{ip}', '{port}'),
-                        array($node->node_ip, $_ENV['detect_gfw_port']),
-                        $api_url
-                    );
-                    //因为考虑到有v2ray之类的节点,所以不得不使用ip作为参数
-                    $result_tcping = false;
-                    $detect_time = $_ENV['detect_gfw_count'];
-                    for ($i = 1; $i <= $detect_time; $i++) {
-                        $json_tcping = json_decode(file_get_contents($api_url), true);
-                        if (eval('return ' . $_ENV['detect_gfw_judge'] . ';')) {
-                            $result_tcping = true;
-                            break;
-                        }
-                    }
-                    if ($result_tcping == false) {
-                        //被墙了
-                        echo ($node->id . ':false' . PHP_EOL);
-                        //判断有没有发送过邮件
-                        if ($node->gfw_block == true) {
-                            continue;
-                        }
-                        foreach ($adminUser as $user) {
-                            echo 'Send gfw mail to user: ' . $user->id . '-';
-                            $user->sendMail(
-                                $_ENV['appName'] . '-系统警告',
-                                'news/warn.tpl',
-                                [
-                                    'text' => '管理员您好,系统发现节点 ' . $node->name . ' 被墙了,请您及时处理。'
-                                ],
-                                []
-                            );
-                            $notice_text = str_replace(
-                                '%node_name%',
-                                $node->name,
-                                Config::getconfig('Telegram.string.NodeGFW')
-                            );
-                        }
-                        if (Config::getconfig('Telegram.bool.NodeGFW')) {
-                            Telegram::Send($notice_text);
-                        }
-                        $node->gfw_block = true;
-                        $node->save();
-                    } else {
-                        //没有被墙
-                        echo ($node->id . ':true' . PHP_EOL);
-                        if ($node->gfw_block == false) {
-                            continue;
-                        }
-                        foreach ($adminUser as $user) {
-                            echo 'Send gfw mail to user: ' . $user->id . '-';
-                            $user->sendMail(
-                                $_ENV['appName'] . '-系统提示',
-                                'news/warn.tpl',
-                                [
-                                    'text' => '管理员您好,系统发现节点 ' . $node->name . ' 溜出墙了。'
-                                ],
-                                []
-                            );
-                            $notice_text = str_replace(
-                                '%node_name%',
-                                $node->name,
-                                Config::getconfig('Telegram.string.NodeGFW_recover')
-                            );
-                        }
-                        if (Config::getconfig('Telegram.bool.NodeGFW_recover')) {
-                            Telegram::Send($notice_text);
-                        }
-                        $node->gfw_block = false;
-                        $node->save();
-                    }
-                }
-                break;
-            }
-
-            echo ($node->id . 'interval skip' . PHP_EOL);
-            sleep(3);
-        }
-    }
-}

+ 0 - 109
src/Command/Job.php

@@ -202,27 +202,6 @@ class Job extends Command
             $nodes = Node::all();
             foreach ($nodes as $node) {
                 if ($node->isNodeOnline() === false && $node->online == true) {
-                    if ($_ENV['useScFtqq'] == true && $_ENV['enable_detect_offline_useScFtqq'] == true) {
-                        $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
-                        $text = '管理员您好,系统发现节点 ' . $node->name . ' 掉线了,请您及时处理。';
-                        $postdata = http_build_query(
-                            array(
-                                'text' => $_ENV['appName'] . '-节点掉线了',
-                                'desp' => $text
-                            )
-                        );
-                        $opts = array(
-                            'http' =>
-                            array(
-                                'method' => 'POST',
-                                'header' => 'Content-type: application/x-www-form-urlencoded',
-                                'content' => $postdata
-                            )
-                        );
-                        $context = stream_context_create($opts);
-                        file_get_contents('https://sctapi.ftqq.com/' . $ScFtqq_SCKEY . '.send', false, $context);
-                    }
-
                     foreach ($adminUser as $user) {
                         echo 'Send offline mail to user: ' . $user->id . PHP_EOL;
                         $user->sendMail(
@@ -248,27 +227,6 @@ class Job extends Command
                     $node->online = false;
                     $node->save();
                 } elseif ($node->isNodeOnline() === true && $node->online == false) {
-                    if ($_ENV['useScFtqq'] == true && $_ENV['enable_detect_offline_useScFtqq'] == true) {
-                        $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
-                        $text = '管理员您好,系统发现节点 ' . $node->name . ' 恢复上线了。';
-                        $postdata = http_build_query(
-                            array(
-                                'text' => $_ENV['appName'] . '-节点恢复上线了',
-                                'desp' => $text
-                            )
-                        );
-
-                        $opts = array(
-                            'http' =>
-                            array(
-                                'method' => 'POST',
-                                'header' => 'Content-type: application/x-www-form-urlencoded',
-                                'content' => $postdata
-                            )
-                        );
-                        $context = stream_context_create($opts);
-                        file_get_contents('https://sctapi.ftqq.com/' . $ScFtqq_SCKEY . '.send', false, $context);
-                    }
                     foreach ($adminUser as $user) {
                         echo 'Send offline mail to user: ' . $user->id . PHP_EOL;
                         $user->sendMail(
@@ -380,79 +338,12 @@ class Job extends Command
                 }
             }
 
-            if (
-                $_ENV['account_expire_delete_days'] >= 0 &&
-                strtotime($user->expire_in) + $_ENV['account_expire_delete_days'] * 86400 < time() &&
-                $user->money <= $_ENV['auto_clean_min_money']
-            ) {
-                $user->sendMail(
-                    $_ENV['appName'] . '-您的用户账户已经被删除了',
-                    'news/warn.tpl',
-                    [
-                        'text' => '您好,系统发现您的账户已经过期 ' . $_ENV['account_expire_delete_days'] . ' 天了,帐号已经被删除。'
-                    ],
-                    [],
-                    $_ENV['email_queue']
-                );
-                $user->kill_user();
-                continue;
-            }
-
-            if (
-                $_ENV['auto_clean_uncheck_days'] > 0 &&
-                max(
-                    $user->last_check_in_time,
-                    strtotime($user->reg_date)
-                ) + ($_ENV['auto_clean_uncheck_days'] * 86400) < time() &&
-                $user->class == 0 &&
-                $user->money <= $_ENV['auto_clean_min_money']
-            ) {
-                $user->sendMail(
-                    $_ENV['appName'] . '-您的用户账户已经被删除了',
-                    'news/warn.tpl',
-                    [
-                        'text' => '您好,系统发现您的账号已经 ' . $_ENV['auto_clean_uncheck_days'] . ' 天没签到了,帐号已经被删除。'
-                    ],
-                    [],
-                    $_ENV['email_queue']
-                );
-                $user->kill_user();
-                continue;
-            }
-
-            if (
-                $_ENV['auto_clean_unused_days'] > 0 &&
-                max($user->t, strtotime($user->reg_date)) + ($_ENV['auto_clean_unused_days'] * 86400) < time() &&
-                $user->class == 0 &&
-                $user->money <= $_ENV['auto_clean_min_money']
-            ) {
-                $user->sendMail(
-                    $_ENV['appName'] . '-您的用户账户已经被删除了',
-                    'news/warn.tpl',
-                    [
-                        'text' => '您好,系统发现您的账号已经 ' . $_ENV['auto_clean_unused_days'] . ' 天没使用了,帐号已经被删除。'
-                    ],
-                    [],
-                    $_ENV['email_queue']
-                );
-                $user->kill_user();
-                continue;
-            }
-
             if (
                 $user->class != 0 &&
                 strtotime($user->class_expire) < time() &&
                 strtotime($user->class_expire) > 1420041600
             ) {
                 $text = '您好,系统发现您的账号等级已经过期了。';
-                $reset_traffic = $_ENV['class_expire_reset_traffic'];
-                if ($reset_traffic >= 0) {
-                    $user->transfer_enable = Tools::toGB($reset_traffic);
-                    $user->u = 0;
-                    $user->d = 0;
-                    $user->last_day_t = 0;
-                    $text .= '流量已经被重置为' . $reset_traffic . 'GB';
-                }
                 $user->sendMail(
                     $_ENV['appName'] . '-您的账户等级已经过期了',
                     'news/warn.tpl',

+ 0 - 234
src/Command/PortAutoChange.php

@@ -1,234 +0,0 @@
-<?php
-
-/**
- * [实验性] 检测到端口被墙则自动更换端口
- *
- * // 实验性,可能会有惊喜,请确保拥有承受能力
- * // 请通过 Crontab 启动,间隔建议 60 分钟以上
- */
-
-namespace App\Command;
-
-use App\Models\{
-    User,
-    Node
-};
-use App\Utils\URL;
-
-class PortAutoChange extends Command
-{
-    public $description = '├─=: php xcat PortAutoChange - 端口被墙则自动更换端口' . PHP_EOL;
-
-    /**
-     *  配置
-     */
-    private $Config = [
-        // 取端口范围最小值,新的端口将是之间的随机数
-        'port_min' => 23333,
-
-        // 取端口范围最大值,新的端口将是之间的随机数
-        'port_max' => 65535,
-
-        // 当某个使用的端口的被墙节点数量超过该端口使用总数量的百分比
-        // 超过该百分比时,直接更换单端口多用户节点(sort=9)和承载用户的端口
-        // 未超过时,对已被墙该端口的节点进行端口偏移
-        'mu_node_port_change_percent' => 60,
-
-        // 例外的节点,填写节点 ID,英文逗号分隔
-        // 此处提供的节点将不会进行端口更换
-        // 即使当原先的承载端口被更换时,也会将例外节点的端口偏移回去
-        'exception_node_id' => array(),
-    ];
-
-    public function boot()
-    {
-        $gfw_port_nodes = [];
-        $nodes = Node::where(
-            static function ($query) {
-                $query->where('sort', 0)
-                    ->orwhere('sort', 10);
-            }
-        )
-            ->where('mu_only', '>=', '0')
-            ->where('type', '1')
-            ->get();
-        foreach ($nodes as $node) {
-            $mu_nodes = Node::where('sort', 9)->where('type', '1')
-                ->where(
-                    static function ($query) use ($node) {
-                        $query->Where('node_group', '=', $node->node_group)
-                            ->orWhere('node_group', '=', 0);
-                    }
-                )
-                ->where('node_class', '<=', $node->node_class)
-                ->get();
-            foreach ($mu_nodes as $mu_node) {
-                $mu_user = User::where('enable', 1)->where('is_multi_user', '<>', 0)->where('port', '=', $mu_node->server)->first();
-                if ($mu_user == null) continue;
-                $port = $this->OutPort($node->server, $mu_node->server);
-                $api_url = $_ENV['detect_gfw_url'];
-                $api_url = str_replace(
-                    array('{ip}', '{port}'),
-                    array($node->node_ip, $port),
-                    $api_url
-                );
-                $result_tcping = $this->DetectPort($api_url);
-                if ($result_tcping) continue;
-                $gfw_port_nodes[$mu_node->server][] = $node->id;
-                echo ('#' . $node->id . ' --- ' . $node->name . ' --- ' . $port . ' 端口不通' . PHP_EOL);
-            }
-        }
-        foreach ($gfw_port_nodes as $port => $array) {
-            $mu_node = Node::where('sort', 9)->where('server', '=', $port)->where('type', '1')->first();
-            $mu_user = User::where('enable', 1)->where('is_multi_user', '<>', 0)->where('port', '=', $port)->first();
-            if ($mu_node == null || $mu_user == null) continue;
-            $mu_port_nodes = Node::where(
-                static function ($query) {
-                    $query->where('sort', 0)
-                        ->orwhere('sort', 10);
-                }
-            )
-                ->where(
-                    static function ($query) use ($mu_node) {
-                        if ($mu_node->node_group == 0) {
-                            $query->where('node_group', '>=', 0);
-                        } else {
-                            $query->where('node_group', '=', $mu_node->node_group);
-                        }
-                    }
-                )
-                ->where('node_class', '>=', $mu_node->node_class)
-                ->where('mu_only', '>=', '0')
-                ->where('type', '1')
-                ->get();
-            for ($i = 0; $i <= 10; $i++) {
-                $new_port = rand((int) $this->Config['port_min'], (int) $this->Config['port_max']);
-                if (Node::where('sort', 9)->where('server', '=', $new_port)->first() == null && User::where('port', '=', $new_port)->first() == null) {
-                    break;
-                }
-            }
-            $number = (count($array) / count($mu_port_nodes)) * 100;
-            if ($number >= $this->Config['mu_node_port_change_percent']) {
-                echo ('超过百分比:' . $number . '%' . PHP_EOL);
-                echo ('#' . $mu_node->id . ' - 单端口承载节点 - ' . $mu_node->name . ' - 更换了新的端口 ' . $new_port . PHP_EOL);
-                $mu_node->server = $new_port;
-                $mu_node->save();
-                echo ('#' . $mu_user->id . ' - 单端口承载用户 - ' . $mu_user->user_name . ' - 更换了新的端口 ' . $new_port . PHP_EOL);
-                $mu_user->port = $new_port;
-                $mu_user->save();
-                foreach ($mu_port_nodes as $mu_port_node) {
-                    $node_port = $this->OutPort($mu_port_node->server, $port);
-                    if (in_array($mu_port_node->id, $array) && !in_array($mu_port_node->id, $this->Config['exception_node_id'])) {
-                        if ($node_port != $port) {
-                            if ($node_port == $new_port) {
-                                if (strpos($mu_port_node->server, ($port . '#')) !== false) {
-                                    for ($i = 0; $i <= 10; $i++) {
-                                        $new_mu_node_port = rand((int) $this->Config['port_min'], (int) $this->Config['port_max']);
-                                        if ($new_mu_node_port != $new_port && Node::where('port', '=', $new_mu_node_port)->first() == null && User::where('port', '=', $new_mu_node_port)->first() == null) {
-                                            break;
-                                        }
-                                    }
-                                    $mu_port_node->server = str_replace(($port . '#' . $node_port), ($new_port . '#' . $new_mu_node_port), $mu_port_node->server);
-                                    echo ('#' . $mu_port_node->id . ' - 节点 - ' . $mu_port_node->name . ' - 端口从 ' . $node_port . ' 偏移到了新的端口 ' . $new_mu_node_port . PHP_EOL);
-                                }
-                            } else {
-                                if (strpos($mu_port_node->server, ($port . '#')) !== false) {
-                                    $mu_port_node->server = str_replace(('+' . $port . '#' . $node_port), '', $mu_port_node->server);
-                                    $mu_port_node->server = str_replace(($port . '#' . $node_port . '+'), '', $mu_port_node->server);
-                                    $mu_port_node->server = str_replace(($port . '#' . $node_port), '', $mu_port_node->server);
-                                    echo ('#' . $mu_port_node->id . ' - 节点 - ' . $mu_port_node->name . ' - 端口从 ' . $node_port . ' 偏移到了新的端口 ' . $new_port . PHP_EOL);
-                                }
-                            }
-                        }
-                    } else {
-                        if ($node_port == $port) {
-                            if (strpos($mu_port_node->server, ';') !== false) {
-                                if (strpos($mu_port_node->server, 'port=') !== false) {
-                                    $mu_port_node->server = str_replace('port=', ('port=' . $new_port . '#' . $port . '+'), $mu_port_node->server);
-                                } else {
-                                    $mu_port_node->server = ($mu_port_node->server . ';port=' . $new_port . '#' . $port);
-                                }
-                            } else {
-                                $mu_port_node->server = ($mu_port_node->server . ';port=' . $new_port . '#' . $port);
-                            }
-                        } else {
-                            if (strpos($mu_port_node->server, ($port . '#')) !== false) {
-                                $mu_port_node->server = str_replace(($port . '#'), ($new_port . '#'), $mu_port_node->server);
-                            }
-                        }
-                        echo ('#' . $mu_port_node->id . ' - 节点 - ' . $mu_port_node->name . ' - 由于端口未被墙或例外设置,已将端口偏移回原端口 ' . $node_port . PHP_EOL);
-                    }
-                    $mu_port_node->save();
-                }
-            } else {
-                foreach ($array as $node_id) {
-                    if (in_array($node_id, $this->Config['exception_node_id'])) continue;
-                    $node = Node::find($node_id);
-                    $node_port = $this->OutPort($node->server, $port);
-                    if ($node_port != $port) {
-                        if (strpos($node->server, ('#' . $node_port)) !== false) {
-                            echo ('#' . $node->id . ' - 节点 - ' . $node->name . ' - 端口从' . $node_port . '偏移到了新的端口 ' . $new_port . PHP_EOL);
-                            $node->server = str_replace(('#' . $node_port), ('#' . $new_port), $node->server);
-                        }
-                    } else {
-                        if (strpos($node->server, ';') !== false) {
-                            if (strpos($node->server, 'port=') !== false) {
-                                $node->server = str_replace('port=', ('port=' . $port . '#' . $new_port . '+'), $node->server);
-                            } else {
-                                $node->server = ($node->server . ';port=' . $port . '#' . $new_port);
-                            }
-                        } else {
-                            $node->server = ($node->server . ';port=' . $port . '#' . $new_port);
-                        }
-                        echo ('#' . $node->id . ' - 节点 - ' . $node->name . ' - 端口从' . $node_port . '偏移到了新的端口 ' . $new_port . PHP_EOL);
-                    }
-                    $node->save();
-                }
-            }
-        }
-    }
-
-    public function OutPort($server, $mu_port)
-    {
-        $node_port = $mu_port;
-        if (strpos($server, ';') !== false) {
-            $node_server = explode(';', $server);
-            if (strpos($node_server[1], 'port') !== false) {
-                $item = URL::parse_args($node_server[1]);
-                if (strpos($item['port'], '#') !== false) {
-                    if (strpos($item['port'], '+') !== false) {
-                        $args_explode = explode('+', $item['port']);
-                        foreach ($args_explode as $arg) {
-                            if ((int) substr($arg, 0, strpos($arg, '#')) == $mu_port) {
-                                $node_port = (int) substr($arg, strpos($arg, '#') + 1);
-                            }
-                        }
-                    } else {
-                        if ((int) substr($item['port'], 0, strpos($item['port'], '#')) == $mu_port) {
-                            $node_port = (int) substr($item['port'], strpos($item['port'], '#') + 1);
-                        }
-                    }
-                } else {
-                    $node_port = ($mu_port + (int) $item['port']);
-                }
-            }
-        }
-
-        return $node_port;
-    }
-
-    public function DetectPort($api_url)
-    {
-        $result_tcping = false;
-        $detect_time = $_ENV['detect_gfw_count'];
-        for ($i = 1; $i <= $detect_time; $i++) {
-            $json_tcping = json_decode(file_get_contents($api_url), true);
-            if (eval('return ' . $_ENV['detect_gfw_judge'] . ';')) {
-                $result_tcping = true;
-                break;
-            }
-        }
-
-        return $result_tcping;
-    }
-}

+ 0 - 275
src/Command/Update.php

@@ -1,275 +0,0 @@
-<?php
-
-namespace App\Command;
-
-use App\Services\DefaultConfig;
-use App\Utils\DatatablesHelper;
-use Illuminate\Database\Capsule\Manager as Capsule;
-use Illuminate\Database\Schema\Blueprint;
-
-class Update extends Command
-{
-    public $description = '├─=: php xcat Update         - 更新并迁移配置' . PHP_EOL;
-
-    public function boot()
-    {
-        global $_ENV;
-        $copy_result = copy(BASE_PATH . '/config/.config.php', BASE_PATH . '/config/.config.php.bak');
-        if ($copy_result == true) {
-            echo ('备份成功' . PHP_EOL);
-        } else {
-            echo ('备份失败,迁移终止' . PHP_EOL);
-            return false;
-        }
-
-        echo (PHP_EOL);
-
-        // 检查并创建新增的配置项
-        echo DefaultConfig::detectConfigs();
-
-        echo ('开始升级 QQWry...' . PHP_EOL);
-        (new Tool($this->argv))->initQQWry();
-        echo ('升级 QQWry结束' . PHP_EOL);
-
-        echo (PHP_EOL);
-
-        $config_old = file_get_contents(BASE_PATH . '/config/.config.php');
-        $config_new = file_get_contents(BASE_PATH . '/config/.config.example.php');
-
-        //执行版本升级
-        $version_old = $_ENV['version'] ?? 0;
-        $this->old_to_new($version_old);
-        $this->addColumns('user', 'uuid', 'TEXT', TRUE, 'NULL', 'uuid', 'passwd');
-
-        //将旧config迁移到新config上
-        $migrated = array();
-        foreach ($_ENV as $key => $value_reserve) {
-            if ($key == 'config_migrate_notice' || $key == 'version') {
-                continue;
-            }
-
-            $regex = '/_ENV\[\'' . $key . '\'\].*?;/s';
-            $matches_new = array();
-            preg_match($regex, $config_new, $matches_new);
-            if (isset($matches_new[0]) == false) {
-                echo ('未找到配置项:' . $key . ' 未能在新config文件中找到,可能已被更名或废弃' . PHP_EOL);
-                continue;
-            }
-
-            $matches_old = array();
-            preg_match($regex, $config_old, $matches_old);
-
-            $config_new = str_replace($matches_new[0], $matches_old[0], $config_new);
-            $migrated[] = '_ENV[\'' . $key . '\']';
-        }
-        echo (PHP_EOL);
-
-        //检查新增了哪些config
-        $regex_new = '/_ENV\[\'.*?\'\]/s';
-        $matches_new_all = array();
-        preg_match_all($regex_new, $config_new, $matches_new_all);
-        $differences = array_diff($matches_new_all[0], $migrated);
-        foreach ($differences as $difference) {
-            if (
-                $difference == '_ENV[\'config_migrate_notice\']' ||
-                $difference == '_ENV[\'version\']'
-            ) {
-                continue;
-            }
-            //匹配注释
-            $regex_comment = '/' . $difference . '.*?;.*?(?=\n)/s';
-            $regex_comment = str_replace(array('[', ']'), array('\[', '\]'), $regex_comment);
-            $matches_comment = array();
-            preg_match($regex_comment, $config_new, $matches_comment);
-            $comment = '';
-            if (isset($matches_comment[0])) {
-                $comment = $matches_comment[0];
-                $comment = substr(
-                    $comment,
-                    strpos(
-                        $comment,
-                        '//',
-                        strpos($comment, ';') //查找';'之后的第一个'//',然后substr其后面的comment
-                    ) + 2
-                );
-            }
-            //裁去首尾
-            $difference = substr($difference, 15);
-            $difference = substr($difference, 0, -2);
-
-            echo ('新增配置项:' . $difference . ':' . $comment . PHP_EOL);
-        }
-        echo ('新增配置项通常带有默认值,因此通常即使不作任何改动网站也可以正常运行' . PHP_EOL);
-
-        //输出notice
-        $regex_notice = '/_ENV\[\'config_migrate_notice\'\].*?(?=\';)/s';
-        $matches_notice = array();
-        preg_match($regex_notice, $config_new, $matches_notice);
-        $notice_new = $matches_notice[0];
-        $notice_new = substr(
-            $notice_new,
-            strpos(
-                $notice_new,
-                '\'',
-                strpos($notice_new, '=') //查找'='之后的第一个'\'',然后substr其后面的notice
-            ) + 1
-        );
-        echo ('以下是迁移附注:');
-        if (isset($_ENV['config_migrate_notice'])) {
-            if ($_ENV['config_migrate_notice'] != $notice_new) {
-                echo ($notice_new);
-            }
-        } else {
-            echo ($notice_new);
-        }
-        echo (PHP_EOL);
-
-        file_put_contents(BASE_PATH . '/config/.config.php', $config_new);
-        echo (PHP_EOL . '迁移完成' . PHP_EOL);
-
-        echo (PHP_EOL);
-
-        echo ('开始升级composer依赖...' . PHP_EOL);
-        system('php ' . BASE_PATH . '/composer.phar selfupdate');
-        system('php ' . BASE_PATH . '/composer.phar install -d ' . BASE_PATH);
-        echo ('升级composer依赖结束,请自行根据上方输出确认是否升级成功' . PHP_EOL);
-        system('rm -rf ' . BASE_PATH . '/storage/framework/smarty/compile/*');
-        system('chown -R ' . $_ENV['php_user_group'] . ' ' . BASE_PATH . '/storage');
-    }
-
-    public function addColumns($table, $columu, $type, $isnull, $default, $comment, $after)
-    {
-        $datatables = new DatatablesHelper();
-        $exists = $datatables->query("SELECT COUNT(*) as cc FROM information_schema.columns WHERE `table_schema` = '" . $_ENV['db_database'] . "' AND `table_name` = '" . $table . "' AND `column_name` = '" . $columu . "'");
-        if ($exists[0]['cc'] >0) {
-            return;
-        }
-        $isnull = $isnull ? " NULL " : " NOT NULL ";
-        $datatables->query("ALTER TABLE `" . $table . "` ADD COLUMN `" . $columu . "` " . $type . $isnull . "DEFAULT " . $default . " COMMENT '" . $comment . "' AFTER `" . $after . "`");
-    }
-
-    public function old_to_new($version_old)
-    {
-        if ($version_old < 2) {
-            // 版本 2 开始
-            if (!is_file(BASE_PATH . '/config/appprofile.php')) {
-                echo ('创建 appprofile 文件.' . PHP_EOL);
-                system('cp ' . BASE_PATH . '/config/appprofile.example.php ' . BASE_PATH . '/config/appprofile.php', $ret);
-                echo $ret;
-            }
-            if (!Capsule::schema()->hasTable('gconfig')) {
-                echo ('创建 gconfig 表.' . PHP_EOL);
-                Capsule::schema()->create(
-                    'gconfig',
-                    function (Blueprint $table) {
-                        $table->engine    = 'InnoDB';
-                        $table->charset   = 'utf8mb4';
-                        $table->collation = 'utf8mb4_unicode_ci';
-                        $table->integer('id', true, true);
-                        $table->string('key', 128)->comment('配置键名');
-                        $table->string('type', 32)->comment('值类型');
-                        $table->text('value')->comment('配置值');
-                        $table->text('oldvalue')->comment('之前的配置值');
-                        $table->string('name', 128)->comment('配置名称');
-                        $table->text('comment')->comment('配置描述');
-                        $table->integer('operator_id', false, true)->comment('操作员 ID');
-                        $table->string('operator_name', 128)->comment('操作员名称');
-                        $table->string('operator_email', 32)->comment('操作员邮箱');
-                        $table->bigInteger('last_update')->comment('修改时间');
-                    }
-                );
-            }
-            if (!Capsule::schema()->hasTable('user_subscribe_log')) {
-                echo ('创建 user_subscribe_log 表.' . PHP_EOL);
-                Capsule::schema()->create(
-                    'user_subscribe_log',
-                    function (Blueprint $table) {
-                        $table->engine    = 'InnoDB';
-                        $table->charset   = 'utf8mb4';
-                        $table->collation = 'utf8mb4_unicode_ci';
-                        $table->integer('id', true, true);
-                        $table->string('user_name', 128)->comment('用户名');
-                        $table->integer('user_id', false, true)->comment('用户 ID');
-                        $table->string('email', 32)->comment('用户邮箱');
-                        $table->string('subscribe_type', 20)->default(null)->comment('获取的订阅类型');
-                        $table->string('request_ip', 128)->default(null)->comment('请求 IP');
-                        $table->dateTime('request_time')->default(null)->comment('请求时间');
-                        $table->text('request_user_agent')->comment('请求 UA 信息');
-                    }
-                );
-            }
-            if (!Capsule::schema()->hasTable('detect_ban_log')) {
-                echo ('创建 detect_ban_log 表.' . PHP_EOL);
-                Capsule::schema()->create(
-                    'detect_ban_log',
-                    function (Blueprint $table) {
-                        $table->engine    = 'InnoDB';
-                        $table->charset   = 'utf8mb4';
-                        $table->collation = 'utf8mb4_unicode_ci';
-                        $table->integer('id', true, true);
-                        $table->string('user_name', 128)->comment('用户名');
-                        $table->integer('user_id')->comment('用户 ID');
-                        $table->string('email', 32)->comment('用户邮箱');
-                        $table->integer('detect_number')->comment('本次违规次数');
-                        $table->integer('ban_time')->comment('本次封禁时长');
-                        $table->bigInteger('start_time')->comment('统计开始时间');
-                        $table->bigInteger('end_time')->comment('统计结束时间');
-                        $table->integer('all_detect_number')->comment('累计违规次数');
-                    }
-                );
-            }
-            // hasColumn 方法在 MySQL 8.0 存在永远返回 false,故不使用
-            // if (!Capsule::schema()->hasColumn('user', 'last_detect_ban_time')) {
-            //     Capsule::schema()->table(
-            //         'user',
-            //         function (Blueprint $table) {
-            //             $table->dateTime('last_detect_ban_time')->default('1989-06-04 00:05:00')->after('enable');
-            //         }
-            //     );
-            // }
-            $UserAttributes = array_keys((new \App\Models\User())->first()->getAttributes());
-            if (!in_array('last_detect_ban_time', $UserAttributes)) {
-                echo ('添加 last_detect_ban_time 到 user 表.' . PHP_EOL);
-                Capsule::schema()->table(
-                    'user',
-                    function (Blueprint $table) {
-                        $table->dateTime('last_detect_ban_time')->default('1989-06-04 00:05:00')->after('enable');
-                    }
-                );
-            }
-            if (!in_array('all_detect_number', $UserAttributes)) {
-                echo ('添加 all_detect_number 到 user 表.' . PHP_EOL);
-                Capsule::schema()->table(
-                    'user',
-                    function (Blueprint $table) {
-                        $table->integer('all_detect_number')->default(0)->after('last_detect_ban_time');
-                    }
-                );
-            }
-            /*
-             * 避免表中无记录而导致导致添加失败
-             */
-            $DetectLog = new \App\Models\DetectLog();
-            $DetectLog->user_id = 0;
-            $DetectLog->list_id = 0;
-            $DetectLog->node_id = 0;
-            $DetectLog->datetime = 0;
-            $DetectLog->save();
-            $DetectlogAttributes = array_keys((new \App\Models\DetectLog())->first()->getAttributes());
-            if (!in_array('status', $DetectlogAttributes)) {
-                echo ('添加 status 到 detect_log 表.' . PHP_EOL);
-                Capsule::schema()->table(
-                    'detect_log',
-                    function (Blueprint $table) {
-                        $table->integer('status')->default(0)->after('node_id');
-                    }
-                );
-            }
-            /*
-             * 删除该记录
-             */
-            $DetectLog->delete();
-            // 版本 2 结束
-        }
-    }
-}

+ 1 - 1
src/Controllers/Admin/ShopController.php

@@ -338,7 +338,7 @@ class ShopController extends AdminController
             $tempdata['auto_renew']           = $value->auto_renew();
             $tempdata['auto_reset_bandwidth'] = $value->auto_reset_bandwidth();
             $tempdata['status']               = $value->status();
-            $tempdata['period_sales']         = $value->getSales();
+            $tempdata['period_sales']         = '0';
 
             $data[] = $tempdata;
         }

+ 2 - 5
src/Controllers/Admin/UserController.php

@@ -133,8 +133,8 @@ class UserController extends AdminController
         $user->im_value             = $email;
         $user->transfer_enable      = Tools::toGB($configs['sign_up_for_free_traffic']);
         $user->invite_num           = $configs['sign_up_for_invitation_codes'];
-        $user->auto_reset_day       = $_ENV['free_user_reset_day'];
-        $user->auto_reset_bandwidth = $_ENV['free_user_reset_bandwidth'];
+        $user->auto_reset_day       = '0';
+        $user->auto_reset_bandwidth = '0';
         $user->money                = ($money != -1 ? $money : 0);
         $user->class_expire         = date('Y-m-d H:i:s', time() + $configs['sign_up_for_class_time'] * 86400);
         $user->class                = $configs['sign_up_for_class'];
@@ -174,7 +174,6 @@ class UserController extends AdminController
                     $res['msg'] .= '<br/>但是套餐添加失败了,原因是套餐不存在';
                 }
             }
-            $user->addMoneyLog($user->money);
             $subject            = $_ENV['appName'] . '-新用户注册通知';
             $to                 = $user->email;
             $text               = '您好,管理员已经为您生成账户,用户名: ' . $email . ',登录密码为:' . $pass . ',感谢您的支持。 ';
@@ -236,8 +235,6 @@ class UserController extends AdminController
         $origin_port = $user->port;
         $user->port = $request->getParam('port');
 
-        $user->addMoneyLog($request->getParam('money') - $user->money);
-
         $user->passwd           = $request->getParam('passwd');
         $user->protocol         = $request->getParam('protocol');
         $user->protocol_param   = $request->getParam('protocol_param');

+ 3 - 3
src/Controllers/AuthController.php

@@ -137,7 +137,7 @@ class AuthController extends BaseController
 
         $time = 3600 * 24;
         if ($rememberMe) {
-            $time = 3600 * 24 * ($_ENV['rememberMeDuration'] ?: 7);
+            $time = 3600 * 24 * ($_ENV['cookie_expiration_time'] ?: 7);
         }
 
         Auth::login($user->id, $time);
@@ -370,8 +370,8 @@ class AuthController extends BaseController
 
         $user->transfer_enable      = Tools::toGB($configs['sign_up_for_free_traffic']);
         $user->invite_num           = $configs['sign_up_for_invitation_codes'];
-        $user->auto_reset_day       = $_ENV['free_user_reset_day'];
-        $user->auto_reset_bandwidth = $_ENV['free_user_reset_bandwidth'];
+        $user->auto_reset_day       = '0';
+        $user->auto_reset_bandwidth = '0';
         $user->money                = 0;
         $user->sendDailyMail        = $configs['sign_up_for_daily_report'];
 

+ 1 - 1
src/Controllers/User/NodeController.php

@@ -46,7 +46,7 @@ class NodeController extends UserController
             $array_node['name']           = $node->name;
             $array_node['class']          = $node->node_class;
             $array_node['info']           = $node->info;
-            $array_node['flag']           = $node->get_node_flag();
+            $array_node['flag']           = 'unknown.png';
             $array_node['online_user']    = $node->get_node_online_user_count();
             $array_node['online']         = $node->get_node_online_status();
             $array_node['latest_load']    = $node->get_node_latest_load_text();

+ 0 - 48
src/Controllers/User/TicketController.php

@@ -108,22 +108,6 @@ class TicketController extends UserController
                 );
             }
         }
-        if ($_ENV['useScFtqq'] == true && $markdown != '') {
-            $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
-            $postdata = http_build_query([
-                'text' => $_ENV['appName'] . '-新工单被开启',
-                'desp' => $markdown
-            ]);
-            $opts = [
-                'http' => [
-                    'method' => 'POST',
-                    'header' => 'Content-type: application/x-www-form-urlencoded',
-                    'content' => $postdata
-                ]
-            ];
-            $context = stream_context_create($opts);
-            file_get_contents('https://sctapi.ftqq.com/' . $ScFtqq_SCKEY . '.send', false, $context);
-        }
 
         return $response->withJson([
             'ret' => 1,
@@ -172,22 +156,6 @@ class TicketController extends UserController
                     );
                 }
             }
-            if ($_ENV['useScFtqq'] == true && $markdown != '') {
-                $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
-                $postdata = http_build_query([
-                    'text' => $_ENV['appName'] . '-工单被重新开启',
-                    'desp' => $markdown
-                ]);
-                $opts = [
-                    'http' => [
-                        'method' => 'POST',
-                        'header' => 'Content-type: application/x-www-form-urlencoded',
-                        'content' => $postdata
-                    ]
-                ];
-                $context = stream_context_create($opts);
-                file_get_contents('https://sctapi.ftqq.com/' . $ScFtqq_SCKEY . '.send', false, $context);
-            }
         } else {
             if ($_ENV['mail_ticket'] == true && $markdown != '') {
                 $adminUser = User::where('is_admin', 1)->get();
@@ -202,22 +170,6 @@ class TicketController extends UserController
                     );
                 }
             }
-            if ($_ENV['useScFtqq'] == true && $markdown != '') {
-                $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
-                $postdata = http_build_query([
-                    'text' => $_ENV['appName'] . '-工单被回复',
-                    'desp' => $markdown
-                ]);
-                $opts = [
-                    'http' => [
-                        'method' => 'POST',
-                        'header' => 'Content-type: application/x-www-form-urlencoded',
-                        'content' => $postdata
-                    ]
-                ];
-                $context = stream_context_create($opts);
-                file_get_contents('https://sctapi.ftqq.com/' . $ScFtqq_SCKEY . '.send', false, $context);
-            }
         }
 
         $antiXss              = new AntiXSS();

+ 0 - 4
src/Controllers/UserController.php

@@ -981,10 +981,6 @@ class UserController extends BaseController
         return $response->write(
             $this->view()
                 ->assign('ssr_sub_token', $this->user->getSublink())
-                ->assign('display_ios_class', $_ENV['display_ios_class'])
-                ->assign('display_ios_topup', $_ENV['display_ios_topup'])
-                ->assign('ios_account', $_ENV['ios_account'])
-                ->assign('ios_password', $_ENV['ios_password'])
                 ->assign('ann', Ann::orderBy('date', 'desc')->first())
                 ->assign('geetest_html', $geetest_html)
                 ->assign('mergeSub', $_ENV['mergeSub'])

+ 0 - 13
src/Models/Node.php

@@ -94,19 +94,6 @@ class Node extends Model
         return $mu_only;
     }
 
-    /**
-     * 节点对应的国旗
-     *
-     * @return string [国家].png OR unknown.png
-     */
-    public function get_node_flag(): string
-    {
-        $regex   = $_ENV['flag_regex'];
-        $matches = [];
-        preg_match($regex, $this->name, $matches);
-        return isset($matches[0]) ? $matches[0] . '.png' : 'unknown.png';
-    }
-
     /**
      * 节点最后活跃时间
      */

+ 4 - 32
src/Models/Shop.php

@@ -142,14 +142,7 @@ class Shop extends Model
             switch ($key) {
                 case 'bandwidth':
                     if ($is_renew == 0) {
-                        if ($_ENV['enable_bought_reset'] == true) {
-                            $user->transfer_enable = $value * 1024 * 1024 * 1024;
-                            $user->u = 0;
-                            $user->d = 0;
-                            $user->last_day_t = 0;
-                        } else {
-                            $user->transfer_enable += $value * 1024 * 1024 * 1024;
-                        }
+                        $user->transfer_enable += $value * 1024 * 1024 * 1024;
                     } elseif ($this->auto_reset_bandwidth == 1) {
                         $user->transfer_enable = $value * 1024 * 1024 * 1024;
                         $user->u = 0;
@@ -167,18 +160,9 @@ class Shop extends Model
                     }
                     break;
                 case 'class':
-                    if ($_ENV['enable_bought_extend'] == true) {
-                        if ($user->class == $value) {
-                            $user->class_expire = date('Y-m-d H:i:s', strtotime($user->class_expire) + $this->content['class_expire'] * 86400);
-                        } else {
-                            $user->class_expire = date('Y-m-d H:i:s', time() + $this->content['class_expire'] * 86400);
-                        }
-                        $user->class = $value;
-                    } else {
-                        $user->class = $value;
-                        $user->class_expire = date('Y-m-d H:i:s', time() + $this->content['class_expire'] * 86400);
-                        break;
-                    }
+                    $user->class = $value;
+                    $user->class_expire = date('Y-m-d H:i:s', time() + $this->content['class_expire'] * 86400);
+                    break;
                 case 'speedlimit':
                     $user->node_speedlimit = $value;
                     break;
@@ -200,18 +184,6 @@ class Shop extends Model
         return ($this->reset() != 0 && $this->reset_value() != 0 && $this->reset_exp() != 0);
     }
 
-    /*
-     * 获取周期商品销量
-     */
-    public function getSales(): int
-    {
-        $period = $_ENV['sales_period'];
-        if ($period == 'expire') {
-            $period = $this->content['class_expire'];
-        }
-        return Bought::where('shopid', $this->id)->where('datetime', '>', time() - $period * 86400)->count();
-    }
-
     /*
      * 自动续费时间
      */

+ 0 - 19
src/Models/User.php

@@ -771,25 +771,6 @@ class User extends Model
         return '多个有效套餐无法显示.';
     }
 
-    /**
-     * 手动修改用户余额时增加充值记录,受限于 Config
-     *
-     * @param mixed $total 金额
-     */
-    public function addMoneyLog($total): void
-    {
-        if ($_ENV['money_from_admin'] && $total != 0) {
-            $codeq              = new Code();
-            $codeq->code        = ($total > 0 ? '管理员赏赐' : '管理员惩戒');
-            $codeq->isused      = 1;
-            $codeq->type        = -1;
-            $codeq->number      = $total;
-            $codeq->usedatetime = date('Y-m-d H:i:s');
-            $codeq->userid      = $this->id;
-            $codeq->save();
-        }
-    }
-
     /**
      * 发送邮件
      *

+ 0 - 10
src/Services/Config.php

@@ -69,10 +69,8 @@ class Config
             'checkinMin'              => $_ENV['checkinMin'],
             'checkinMax'              => $_ENV['checkinMax'],
             'jump_delay'              => $_ENV['jump_delay'],
-            'enable_analytics_code'   => $_ENV['enable_analytics_code'],
             'enable_ticket'           => $_ENV['enable_ticket'],
             'enable_reg_im'           => $_ENV['enable_reg_im'],
-            'enable_flag'             => $_ENV['enable_flag'],
             'enable_kill'             => $_ENV['enable_kill'],
             'enable_change_email'     => $_ENV['enable_change_email'],
 
@@ -89,14 +87,6 @@ class Config
             'subscribeLog_show'       => $_ENV['subscribeLog_show'],
             'subscribeLog_keep_days'  => $_ENV['subscribeLog_keep_days'],
 
-            'enable_auto_detect_ban'  => $_ENV['enable_auto_detect_ban'],
-            'auto_detect_ban_type'    => $_ENV['auto_detect_ban_type'],
-            'auto_detect_ban_number'  => $_ENV['auto_detect_ban_number'],
-            'auto_detect_ban_time'    => $_ENV['auto_detect_ban_time'],
-            'auto_detect_ban'         => $_ENV['auto_detect_ban'],
-
-            'userCenterClient'        => $_ENV['userCenterClient'],
-
             'sentry_dsn'              => !empty($_ENV['sentry_dsn']) ? $_ENV['sentry_dsn'] : null,
         ];
     }

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

@@ -189,7 +189,7 @@ class Callback
             case 'general.pricing':
                 // 产品介绍
                 $sendMessage = [
-                    'text'                      => $_ENV['telegram_general_pricing'],
+                    'text'                      => '请访问用户中心获取',
                     'disable_web_page_preview'  => false,
                     'reply_to_message_id'       => null,
                     'reply_markup'              => json_encode(
@@ -202,7 +202,7 @@ class Callback
             case 'general.terms':
                 // 服务条款
                 $sendMessage = [
-                    'text'                      => $_ENV['telegram_general_terms'],
+                    'text'                      => '请访问用户中心获取',
                     'disable_web_page_preview'  => false,
                     'reply_to_message_id'       => null,
                     'reply_markup'              => json_encode(

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

@@ -59,7 +59,7 @@ class CheckinCommand extends Command
             // 回送信息
             $response = $this->replyWithMessage(
                 [
-                    'text'       => $_ENV['user_not_bind_reply'],
+                    'text'       => '需要先在用户中心绑定你的账户',
                     'parse_mode' => 'Markdown',
                 ]
             );

+ 8 - 11
src/Utils/Telegram/Commands/InfoCommand.php

@@ -49,16 +49,13 @@ class InfoCommand extends Command
             if (!in_array($SendUser['id'], $_ENV['telegram_admins'])) {
                 $AdminUser = User::where('is_admin', 1)->where('telegram_id', $SendUser['id'])->first();
                 if ($AdminUser == null) {
-                    // 非管理员回复消息
-                    if ($_ENV['enable_not_admin_reply'] === true && $_ENV['not_admin_reply_msg'] != '') {
-                        $response = $this->replyWithMessage(
-                            [
-                                'text'                  => $_ENV['not_admin_reply_msg'],
-                                'parse_mode'            => 'HTML',
-                                'reply_to_message_id'   => $MessageID,
-                            ]
-                        );
-                    }
+                    $response = $this->replyWithMessage(
+                        [
+                            'text'                  => '您无权限',
+                            'parse_mode'            => 'HTML',
+                            'reply_to_message_id'   => $MessageID,
+                        ]
+                    );
                     return;
                 }
             }
@@ -73,7 +70,7 @@ class InfoCommand extends Command
                 if ($User == null) {
                     $response = $this->replyWithMessage(
                         [
-                            'text'                  => $_ENV['no_user_found'],
+                            'text'                  => '无此用户',
                             'reply_to_message_id'   => $MessageID,
                         ]
                     );

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

@@ -64,7 +64,7 @@ class MyCommand extends Command
             // 回送信息
             $response = $this->replyWithMessage(
                 [
-                    'text'                  => $_ENV['user_not_bind_reply'],
+                    'text'                  => '需要先在用户中心绑定你的账户',
                     'reply_to_message_id'   => $MessageID,
                     'parse_mode'            => 'Markdown',
                 ]

+ 10 - 13
src/Utils/Telegram/Commands/SetuserCommand.php

@@ -47,16 +47,13 @@ class SetuserCommand extends Command
         if (!in_array($SendUser['id'], $_ENV['telegram_admins'])) {
             $AdminUser = User::where('is_admin', 1)->where('telegram_id', $SendUser['id'])->first();
             if ($AdminUser == null) {
-                // 非管理员回复消息
-                if ($_ENV['enable_not_admin_reply'] === true && $_ENV['not_admin_reply_msg'] != '') {
-                    $response = $this->replyWithMessage(
-                        [
-                            'text'                  => $_ENV['not_admin_reply_msg'],
-                            'parse_mode'            => 'HTML',
-                            'reply_to_message_id'   => $MessageID,
-                        ]
-                    );
-                }
+                $response = $this->replyWithMessage(
+                    [
+                        'text'                  => '您无权限',
+                        'parse_mode'            => 'HTML',
+                        'reply_to_message_id'   => $MessageID,
+                    ]
+                );
                 return;
             }
         }
@@ -84,7 +81,7 @@ class SetuserCommand extends Command
             if ($User == null) {
                 $response = $this->replyWithMessage(
                     [
-                        'text'                  => $_ENV['no_user_found'],
+                        'text'                  => '无此用户',
                         'parse_mode'            => 'HTML',
                         'reply_to_message_id'   => $MessageID,
                     ]
@@ -191,7 +188,7 @@ class SetuserCommand extends Command
 
                 $response = $this->replyWithMessage(
                     [
-                        'text'                  => $_ENV['no_user_found'],
+                        'text'                  => '无此用户',
                         'parse_mode'            => 'HTML',
                         'reply_to_message_id'   => $MessageID,
                     ]
@@ -207,7 +204,7 @@ class SetuserCommand extends Command
         if ($useOptionMethod == '') {
             $response = $this->replyWithMessage(
                 [
-                    'text'                  => $_ENV['data_method_not_found'],
+                    'text'                  => '无此字段',
                     'parse_mode'            => 'HTML',
                     'reply_to_message_id'   => $MessageID,
                 ]

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

@@ -56,7 +56,7 @@ class UnbindCommand extends Command
                 // 回送信息
                 $this->replyWithMessage(
                     [
-                        'text'       => $_ENV['user_not_bind_reply'],
+                        'text'       => '需要先在用户中心绑定你的账户',
                         'parse_mode' => 'Markdown',
                     ]
                 );

+ 20 - 23
src/Utils/Telegram/TelegramTools.php

@@ -51,8 +51,8 @@ class TelegramTools
     {
         return [
             'id'    => [],
-            'email' => $_ENV['remark_user_search_email'],
-            'port'  => $_ENV['remark_user_search_port'],
+            'email' => ['邮箱'],
+            'port'  => ['端口'],
         ];
     }
 
@@ -64,24 +64,24 @@ class TelegramTools
     public static function getUserActionOption()
     {
         return [
-            'is_admin'          => $_ENV['remark_user_option_is_admin'],
-            'enable'            => $_ENV['remark_user_option_enable'],
-            'money'             => $_ENV['remark_user_option_money'],
-            'port'              => $_ENV['remark_user_option_port'],
-            'transfer_enable'   => $_ENV['remark_user_option_transfer_enable'],
-            'passwd'            => $_ENV['remark_user_option_passwd'],
-            'method'            => $_ENV['remark_user_option_method'],
-            'protocol'          => $_ENV['remark_user_option_protocol'],
-            'protocol_param'    => $_ENV['remark_user_option_protocol_param'],
-            'obfs'              => $_ENV['remark_user_option_obfs'],
-            'obfs_param'        => $_ENV['remark_user_option_obfs_param'],
-            'invite_num'        => $_ENV['remark_user_option_invite_num'],
-            'node_group'        => $_ENV['remark_user_option_node_group'],
-            'class'             => $_ENV['remark_user_option_class'],
-            'class_expire'      => $_ENV['remark_user_option_class_expire'],
-            'expire_in'         => $_ENV['remark_user_option_expire_in'],
-            'node_speedlimit'   => $_ENV['remark_user_option_node_speedlimit'],
-            'node_connector'    => $_ENV['remark_user_option_node_connector'],
+            'is_admin'          => ['管理员'],
+            'enable'            => ['用户启用'],
+            'money'             => ['金钱', '余额'],
+            'port'              => ['端口'],
+            'transfer_enable'   => ['流量'],
+            'passwd'            => ['连接密码'],
+            'method'            => ['加密'],
+            'protocol'          => ['协议'],
+            'protocol_param'    => ['协参', '协议参数'],
+            'obfs'              => ['混淆'],
+            'obfs_param'        => ['混参', '混淆参数'],
+            'invite_num'        => ['邀请数量'],
+            'node_group'        => ['用户组', '用户分组'],
+            'class'             => ['等级'],
+            'class_expire'      => ['等级过期时间'],
+            'expire_in'         => ['账号过期时间'],
+            'node_speedlimit'   => ['限速'],
+            'node_connector'    => ['连接数', '客户端'],
         ];
     }
 
@@ -329,9 +329,6 @@ class TelegramTools
                 break;
         }
         if ($User->save()) {
-            if ($useOptionMethod == 'money') {
-                $User->addMoneyLog($new - $old);
-            }
             $strArray = [
                 '目标用户:' . $Email,
                 '被修改项:' . $useOptionMethodName . '[' . $useOptionMethod . ']',