master
cody 2 months ago
parent 6947674fcc
commit 3c2bb53202

@ -58,6 +58,7 @@ class UpdateUserTalentTags extends Command
$notFoundCount = 0;
$errorCount = 0;
$skippedCount = 0;
$notFoundUsers = []; // 收集所有未匹配上的用户信息
DB::beginTransaction();
@ -146,6 +147,12 @@ class UpdateUserTalentTags extends Command
if (!$user) {
$this->warn("第 {$rowNum} 行: 在用户表中也未找到用户 '{$userName}'(原始课程值: '{$courseNameRaw}'),跳过");
$notFoundCount++;
// 记录未匹配的用户信息
$notFoundUsers[] = [
'row' => $rowNum,
'name' => $userName,
'course' => $courseNameRaw,
];
continue;
}
@ -210,6 +217,20 @@ class UpdateUserTalentTags extends Command
$this->info("更新失败: {$errorCount} 条");
$this->info('========================================');
// 输出所有未匹配上的用户列表
if (!empty($notFoundUsers)) {
$this->info('');
$this->info('========================================');
$this->info('未匹配上的用户列表:');
$this->info('========================================');
foreach ($notFoundUsers as $notFoundUser) {
$this->warn("第 {$notFoundUser['row']} 行: 姓名: {$notFoundUser['name']}, 课程: {$notFoundUser['course']}");
}
$this->info('========================================');
$this->info("共 {$notFoundCount} 个用户未匹配上");
$this->info('========================================');
}
return 0;
} catch (\Exception $e) {
DB::rollBack();

Loading…
Cancel
Save