Skip to content

Commit 11ced40

Browse files
author
Administrator
committed
解决端口不能正常自动释放问题
1 parent f8a9e1e commit 11ced40

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

app/Console/Commands/AutoReleasePortJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public function handle()
2525
$userList = User::query()->where('status', '<', 0)->get();
2626
if (!$userList->isEmpty()) {
2727
foreach ($userList as $user) {
28-
User::query()->where('id', $user->id)->update(['port' => 0]);
28+
if ($user->port) {
29+
User::query()->where('id', $user->id)->update(['port' => 0]);
30+
}
2931
}
3032
}
3133
}

app/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected function schedule(Schedule $schedule)
5050
$schedule->command('command:autoDisableUserJob')->everyMinute();
5151
$schedule->command('command:autoExpireCouponJob')->everyThirtyMinutes();
5252
$schedule->command('command:autoExpireInviteJob')->everyThirtyMinutes();
53-
$schedule->command('command:autoReleasePortJob')->daily();
53+
$schedule->command('command:autoReleasePortJob')->everyMinute();
5454
$schedule->command('command:autoReopenUserJob')->everyMinute();
5555
$schedule->command('command:autoResetUserTrafficJob')->everyFiveMinutes();
5656
$schedule->command('command:autoStatisticsNodeDailyTrafficJob')->dailyAt('04:30');

sql/update/20180305.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- 去掉user表的唯一索引,解决无法自动释放端口的问题
2+
ALTER TABLE `user` DROP INDEX `port`;

0 commit comments

Comments
 (0)