mirror of
https://github.com/v2board/v2board.git
synced 2025-01-11 00:29:09 +08:00
update reset traffic method
This commit is contained in:
parent
47d8dfd7c8
commit
bb49fb15d1
@ -3,8 +3,6 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use App\Models\Plan;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
class ResetTraffic extends Command
|
class ResetTraffic extends Command
|
||||||
@ -40,12 +38,25 @@ class ResetTraffic extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
// get plans of cycle type
|
$user = User::where('expired_at', '!=', NULL);
|
||||||
$plans = Plan::where('type', 0)->get();
|
$resetTrafficMethod = config('v2board.reset_traffic_method', 0);
|
||||||
$users = User::whereIn('plan_id', $plans);
|
switch ($resetTrafficMethod) {
|
||||||
$users->update([
|
// 1 a month
|
||||||
|
case 0:
|
||||||
|
$user->update([
|
||||||
|
'u' => 0,
|
||||||
|
'd' => 0
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
// expire day
|
||||||
|
case 1:
|
||||||
|
$startAt = strtotime(date('Y-m-d', time()));
|
||||||
|
$user->where('expired_at', '>=', $startAt)
|
||||||
|
->where('expired_at', '<', $startAt + 24 * 3600)
|
||||||
|
->update([
|
||||||
'u' => 0,
|
'u' => 0,
|
||||||
'd' => 0
|
'd' => 0
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -30,7 +30,7 @@ class Kernel extends ConsoleKernel
|
|||||||
$schedule->command('check:order')->everyMinute();
|
$schedule->command('check:order')->everyMinute();
|
||||||
$schedule->command('check:commission')->everyMinute();
|
$schedule->command('check:commission')->everyMinute();
|
||||||
// reset
|
// reset
|
||||||
$schedule->command('reset:traffic')->monthly();
|
$schedule->command('reset:traffic')->daily();
|
||||||
$schedule->command('reset:serverLog')->monthly();
|
$schedule->command('reset:serverLog')->monthly();
|
||||||
// send
|
// send
|
||||||
$schedule->command('send:remindMail')->dailyAt('11:30');
|
$schedule->command('send:remindMail')->dailyAt('11:30');
|
||||||
|
@ -34,7 +34,8 @@ class ConfigController extends Controller
|
|||||||
'email_whitelist_suffix' => config('v2board.email_whitelist_suffix', Dict::EMAIL_WHITELIST_SUFFIX_DEFAULT)
|
'email_whitelist_suffix' => config('v2board.email_whitelist_suffix', Dict::EMAIL_WHITELIST_SUFFIX_DEFAULT)
|
||||||
],
|
],
|
||||||
'subscribe' => [
|
'subscribe' => [
|
||||||
'plan_change_enable' => (int)config('v2board.plan_change_enable', 1)
|
'plan_change_enable' => (int)config('v2board.plan_change_enable', 1),
|
||||||
|
'reset_traffic_method' => (int)config('v2board.reset_traffic_method', 0)
|
||||||
],
|
],
|
||||||
'pay' => [
|
'pay' => [
|
||||||
// alipay
|
// alipay
|
||||||
|
@ -25,6 +25,7 @@ class ConfigSave extends FormRequest
|
|||||||
'email_whitelist_suffix' => '',
|
'email_whitelist_suffix' => '',
|
||||||
// subscribe
|
// subscribe
|
||||||
'plan_change_enable' => 'in:0,1',
|
'plan_change_enable' => 'in:0,1',
|
||||||
|
'reset_traffic_method' => 'in:0,1',
|
||||||
// server
|
// server
|
||||||
'server_token' => 'nullable|min:16',
|
'server_token' => 'nullable|min:16',
|
||||||
'server_license' => 'nullable',
|
'server_license' => 'nullable',
|
||||||
|
@ -178,3 +178,6 @@ ADD `onetime_price` int(11) NULL AFTER `year_price`;
|
|||||||
|
|
||||||
ALTER TABLE `v2_user`
|
ALTER TABLE `v2_user`
|
||||||
DROP `banned`;
|
DROP `banned`;
|
||||||
|
|
||||||
|
ALTER TABLE `v2_user`
|
||||||
|
CHANGE `expired_at` `expired_at` bigint(20) NULL DEFAULT '0' AFTER `token`;
|
||||||
|
Loading…
Reference in New Issue
Block a user