diff --git a/app/Console/Commands/UpdateUserTalentTags.php b/app/Console/Commands/UpdateUserTalentTags.php index 4619763..6fcaeab 100644 --- a/app/Console/Commands/UpdateUserTalentTags.php +++ b/app/Console/Commands/UpdateUserTalentTags.php @@ -118,6 +118,10 @@ class UpdateUserTalentTags extends Command $user = $courseSign->user; + // 保存旧值用于显示 + $oldTalentTags = $user->talent_tags ?? ''; + $oldTalentTagsDisplay = empty($oldTalentTags) ? '(空)' : $oldTalentTags; + // 处理人才标签,避免重复 $existingTags = $user->talent_tags; $existingTagsArray = []; @@ -129,7 +133,8 @@ class UpdateUserTalentTags extends Command // 检查新标签是否已存在 if (in_array($talentTag, $existingTagsArray)) { - $this->info("第 {$rowNum} 行: 用户 '{$userName}' 已存在标签 '{$talentTag}',跳过"); + $this->info("第 {$rowNum} 行: 用户 '{$userName}' (ID: {$user->id}) 已存在标签 '{$talentTag}',跳过"); + $this->info(" 当前人才标签: {$oldTalentTagsDisplay}"); $skippedCount++; continue; } @@ -144,7 +149,9 @@ class UpdateUserTalentTags extends Command $user->talent_tags = $newTalentTags; $user->save(); - $this->info("第 {$rowNum} 行: 成功更新用户 '{$userName}' (ID: {$user->id}) 的人才标签: {$newTalentTags}"); + $this->info("第 {$rowNum} 行: 成功更新用户 '{$userName}' (ID: {$user->id}) 的人才标签"); + $this->info(" 从: {$oldTalentTagsDisplay}"); + $this->info(" 到: {$newTalentTags}"); $successCount++; } catch (\Exception $e) { $this->error("第 {$rowNum} 行: 更新用户 '{$userName}' 失败: " . $e->getMessage());