You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
845 B

1 year ago
<?php
namespace App\Console\Commands;
11 hours ago
use App\Services\SchoolmateEnrollmentService;
1 year ago
use Illuminate\Console\Command;
class AutoSchoolmate extends Command
{
protected $signature = 'auto_schoolmate';
11 hours ago
protected $description = '已审核学员自动进入校友库(含历史遗漏及开课后审核通过人员)';
1 year ago
11 hours ago
public function handle(SchoolmateEnrollmentService $service)
1 year ago
{
11 hours ago
$updated = 0;
$service->pendingUsers($service->automaticCourses())
->chunkById(200, function ($users) use ($service, &$updated) {
foreach ($users as $user) {
$updated += $service->promote($user->id, $user->source_start_date);
}
}, 'users.id', 'id');
$this->info("自动入库完成,共补齐 {$updated} 位学员。");
return 0;
1 year ago
}
}