This commit is contained in:
兔姬桑
2020-10-19 06:20:23 +08:00
parent 0eb6c8e629
commit 6f6a9bcef1
2 changed files with 45 additions and 3 deletions

View File

@@ -43,9 +43,9 @@ class UserHourlyDataFlow extends Model
->groupBy('user_id')
->selectRaw('user_id, sum(total) as totalTraffic')->pluck('totalTraffic', 'user_id')
->toArray(); // 只统计50M以上的记录加快速度
foreach ($userTotalTrafficList as $user) {
if ($user->totalTraffic > sysConfig('traffic_ban_value') * GB) {
$result[] = $user->user_id;
foreach ($userTotalTrafficList as $user => $traffic) {
if ($traffic > sysConfig('traffic_ban_value') * GB) {
$result[] = $user;
}
}

42
sql/2.5.0.sql Normal file
View File

@@ -0,0 +1,42 @@
-- 2.4.0版本以前 或 数据库以下字段为bit的 需要运行本文件来矫正数据库
alter table `goods`
change `is_hot` `is_hot` TINYINT(1) not null default 0 comment '是否热销0-否、1-是',
change `status` `status` TINYINT(1) not null default 1 comment '状态0-下架、1-上架';
alter table `node_rule`
change `is_black` `is_black` TINYINT(1) not null default 1 comment '是否黑名单模式0-不是、1-是';
alter table `order`
change `is_expire` `is_expire` TINYINT(1) not null default 0 comment '是否已过期0-未过期、1-已过期';
alter table `payment_callback`
change `status` `status` TINYINT(1) not null comment '交易状态0-失败、1-成功';
alter table `products_pool`
change `status` `status` TINYINT(1) not null default 1 comment '状态0-未启用、1-已启用';
alter table `rule_group`
change `type` `type` TINYINT(1) not null default 1 comment '模式1-阻断、0-放行';
alter table `ss_config`
change `is_default` `is_default` TINYINT(1) not null default 0 comment '是否默认0-不是、1-是';
alter table `ss_node`
change `is_subscribe` `is_subscribe` TINYINT(1) not null default 1 comment '是否允许用户订阅该节点0-否、1-是',
change `is_ddns` `is_ddns` TINYINT(1) not null default 0 comment '是否使用DDNS0-否、1-是',
change `is_relay` `is_relay` TINYINT(1) not null default 0 comment '是否中转节点0-否、1-是',
change `is_udp` `is_udp` TINYINT(1) not null default 1 comment '是否启用UDP0-不启用、1-启用',
change `compatible` `compatible` TINYINT(1) not null default 0 comment '兼容SS',
change `single` `single` TINYINT(1) not null default 0 comment '启用单端口功能0-否、1-是',
change `status` `status` TINYINT(1) not null default 1 comment '状态0-维护、1-正常',
change `v2_tls` `v2_tls` TINYINT(1) not null default 0 comment 'V2Ray连接TLS0-未开启、1-开启';
alter table `user`
change `is_admin` `is_admin` TINYINT(1) not null default 0 comment '是否管理员0-否、1-是';
alter table `user_baned_log`
change `status` `status` TINYINT(1) not null default 0 comment '状态0-未处理、1-已处理';
alter table `user_subscribe`
change `status` `status` TINYINT(1) not null default 1 comment '状态0-禁用、1-启用';