diff --git a/app/Controllers/LinkController.php b/app/Controllers/LinkController.php index b1397ba9..b99ae470 100644 --- a/app/Controllers/LinkController.php +++ b/app/Controllers/LinkController.php @@ -205,7 +205,9 @@ class LinkController extends BaseController } // 记录订阅日志 - self::Subscribe_log($user, $subscribe_type, $request->getHeaderLine('User-Agent')); + if (Config::get('subscribeLog') == 'true') { + self::Subscribe_log($user, $subscribe_type, $request->getHeaderLine('User-Agent')); + } return $getBody; } diff --git a/app/Services/Config.php b/app/Services/Config.php index d1b37428..3ae4c5c3 100755 --- a/app/Services/Config.php +++ b/app/Services/Config.php @@ -53,7 +53,8 @@ class Config 'captcha_provider' => self::get('captcha_provider'), 'enable_email_verify' => self::get('enable_email_verify'), 'protocol_specify' => self::get('protocol_specify'), - 'clash_Profiles' => self::get('clash_Profiles') + 'clash_Profiles' => self::get('clash_Profiles'), + 'subscribeLog' => self::get('subscribeLog') ]; } diff --git a/config/.config.example.php b/config/.config.example.php index da1bb517..6d130805 100644 --- a/config/.config.example.php +++ b/config/.config.example.php @@ -124,6 +124,8 @@ $System_Config['user_agreement_scheme'] = [ ['id'=>3,'name'=>'SS/SSR 兼容配置','method'=>'chacha20-ietf','protocol'=>'auth_aes128_sha1_compatible','obfs'=>'plain'] ]; +$System_Config['subscribeLog'] = 'false'; //是否记录用户订阅日志 + //Bot 设置-------------------------------------------------------------------------------------------- #通用 $System_Config['qrcode']='zxing_local'; //二维码解码方式,online,phpzbar,zxing_online,zxing_local diff --git a/resources/views/material/admin/main.tpl b/resources/views/material/admin/main.tpl index 9baed924..bbe04a5a 100644 --- a/resources/views/material/admin/main.tpl +++ b/resources/views/material/admin/main.tpl @@ -112,7 +112,9 @@
  • supervisor_account 用户列表
  • compare_arrows 中转规则
  • loyalty 邀请与返利
  • + {if $config['subscribeLog']=='true'}
  • dialer_sip 订阅记录
  • + {/if}
  • text_fields 登录记录
  • important_devices 在线IP
  • diff --git a/resources/views/material/user/main.tpl b/resources/views/material/user/main.tpl index 398f95aa..986cac58 100644 --- a/resources/views/material/user/main.tpl +++ b/resources/views/material/user/main.tpl @@ -85,9 +85,11 @@ hourglass_empty 流量记录 + {if $config['subscribeLog']=='true'}
  • important_devices 订阅记录
  • + {/if} {if $config['enable_ticket']=='true'}
  • diff --git a/sql/glzjin_all.sql b/sql/glzjin_all.sql index 08cc083b..267c6e6c 100644 --- a/sql/glzjin_all.sql +++ b/sql/glzjin_all.sql @@ -697,4 +697,20 @@ ALTER TABLE `paylist` ALTER TABLE `paylist` MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;ALTER TABLE `user_traffic_log` CHANGE `u` `u` BIGINT(20) NOT NULL, CHANGE `d` `d` BIGINT(20) NOT NULL; -ALTER TABLE `user` ADD `discord` BIGINT NULL AFTER `telegram_id`; \ No newline at end of file +ALTER TABLE `user` ADD `discord` BIGINT NULL AFTER `telegram_id`; + + +-- +-- 用户订阅日志 +-- +CREATE TABLE IF NOT EXISTS `user_subscribe_log` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `user_name` varchar(128) NOT NULL COMMENT '用户名', + `user_id` int(11) NOT NULL COMMENT '用户 ID', + `email` varchar(32) NOT NULL COMMENT '用户邮箱', + `subscribe_type` varchar(20) DEFAULT NULL COMMENT '获取的订阅类型', + `request_ip` varchar(20) DEFAULT NULL COMMENT '请求 IP', + `request_time` datetime DEFAULT NULL COMMENT '请求时间', + `request_user_agent` text COMMENT '请求 UA 信息', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户订阅日志';