123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Console\Commands;
- use App\Models\Ticket;
- use App\Models\User;
- use Illuminate\Console\Command;
- class ClearUser extends Command
- {
-
- protected $signature = 'clear:user';
-
- protected $description = '清理用户';
-
- public function __construct()
- {
- parent::__construct();
- }
-
- public function handle()
- {
- $builder = User::where('plan_id', NULL)
- ->where('transfer_enable', 0)
- ->where('expired_at', 0)
- ->where('last_login_at', NULL);
- $count = $builder->count();
- if ($builder->delete()) {
- $this->info("已删除${count}位没有任何数据的用户");
- }
- }
- }
|