feat: 实现 AI 规格候选匹配与审计 (#201)

This commit is contained in:
chengma
2026-08-14 10:08:32 +08:00
parent 2f51126e1d
commit aac289a4d3
15 changed files with 1200 additions and 25 deletions
+4 -2
View File
@@ -128,11 +128,13 @@ func SaveSybMapping(db *sql.DB, sybID, optionKey, operator string, expectedVersi
if utf8.RuneCountInString(choice.Key) > 191 || utf8.RuneCountInString(match.SuggestedOptionKey) > 191 || utf8.RuneCountInString(SpecMatchRulesVersion) > 32 {
return fmt.Errorf("规格选项键或规则版本超过数据库列宽,未保存")
}
mappedAt := model.NowISO()
if err := repository.UpsertSpecMapping(tx, model.SpecMapping{
ShopeeGoodsID: context.Order.ShopeeGoodsID, SpecKey: key,
SpecRaw: context.Order.ProductSpec, PddGoodsID: context.PddGoodsID,
PddOptionKey: choice.Key, PddOptions: choice.OptionsJSON,
MappedAt: model.NowISO(), MappedBy: strings.TrimSpace(operator),
MappedAt: mappedAt, MappedBy: strings.TrimSpace(operator), Source: "manual",
ContextVersion: expectedContextVersion,
}); err != nil {
return err
}
@@ -140,7 +142,7 @@ func SaveSybMapping(db *sql.DB, sybID, optionKey, operator string, expectedVersi
ShopeeGoodsID: context.Order.ShopeeGoodsID, SpecKey: key, PddGoodsID: context.PddGoodsID,
RulesVersion: SpecMatchRulesVersion, SuggestedOptionKey: match.SuggestedOptionKey,
ChosenOptionKey: choice.Key, Accepted: match.SuggestedOptionKey != "" && match.SuggestedOptionKey == choice.Key,
DecidedBy: strings.TrimSpace(operator), DecidedAt: model.NowISO(),
DecidedBy: strings.TrimSpace(operator), DecidedAt: mappedAt,
}); err != nil {
return err
}