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

<?php
namespace App\Console\Commands;
use App\Services\SchoolmateEnrollmentService;
use Illuminate\Console\Command;
class AutoSchoolmate extends Command
{
protected $signature = 'auto_schoolmate';
protected $description = '已审核学员自动进入校友库(含历史遗漏及开课后审核通过人员)';
public function handle(SchoolmateEnrollmentService $service)
{
$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;
}
}