fix: 建行前按同标题兜底,防止季节码漂移造出重复图集

男装季节码由 FWyy 改为 SSyy 后,仍按旧规则算码的实例(如本机残留的旧后端)
会把同一场秀当成新场次再建一行,今天已产生 7 组重复(Acne/Celine/AMBUSH 等)。

- 新增 IngestRepository.RunwayTitleExists(品牌 + 英文标题)
- processRunway 在「实体键未命中、准备新建」时再查一次同标题:
  命中则跳过并记 outcome=skipped_existing,note 写明「季节码漂移保护」
- 宁可跳过也不产生重复;标题含年份,正常不会误伤不同场次
This commit is contained in:
toom1996
2026-10-25 18:37:20 +08:00
parent d6ed96624a
commit db3e3efab9
3 changed files with 37 additions and 0 deletions

View File

@ -349,6 +349,17 @@ func (s *IngestService) processRunway(ctx context.Context, job model.IngestJob,
}
}
action := decideIngestAction(exist, existStatus)
// 季节码漂移保护:实体键按 season_code 去重,但规则改过(Spring 男装由 FWyy 改为 SSyy)。
// 若还有实例按旧规则算码,就会把同一场秀当成新场次再建一行。
// 这里在建行前用「同品牌同标题」再兜一次底,宁可跳过也不产生重复。
if !exist && action != ingestSkip {
if dupID, found, terr := s.repo.RunwayTitleExists(ctx, brandID, p.TitleEn); terr == nil && found {
log.Printf("[ingest] job=%d runway 已存在同标题图集 id=%d(季节码可能漂移),跳过", job.ID, dupID)
_ = s.repo.MarkDone(ctx, job.ID, model.IngestOutcomeSkippedExisting,
fmt.Sprintf("已存在同标题图集(id=%d),跳过(季节码漂移保护)", dupID))
return
}
}
if action == ingestSkip {
log.Printf("[ingest] job=%d runway 实体已存在(status=%s),跳过(回填 published_at)", job.ID, existStatus)
// 临时回填:仅更新发布时间与缺失年份,不重下图片(图片已在库)。