fix(api): 模型计价 - 兼容图片分辨率字段拼写并校验能力

This commit is contained in:
ddcat666 committed 2026-10-11 22:36:48 +08:00
1 parent a8edb6f27f
commit 435bc487cf
2 files changed
+18 -1

No files matched your search

@@ -219,7 +219,17 @@ func TestRepriceTierFieldValidation(t *testing.T) {
}
}
func TestBatchRepricingRollsBackOnConcurrentChange(t *testing.T) {
func TestNormalizeChannelModelTierSelectorAcceptsResolutionTypo(t *testing.T) {
selector, resolution, videoSeconds, err := normalizeChannelModelTierSelector("image", ChannelModelPriceTierRequest{
Selector: map[string]string{"resoluton": "2K"},
})
if err != nil {
t.Fatal(err)
}
if selector["resolution"] != "2k" || selector["resoluton"] != "" || resolution != "*" || videoSeconds != 0 {
t.Fatalf("selector=%v resolution=%q videoSeconds=%d", selector, resolution, videoSeconds)
}
}
for _, target := range []string{"model", "tier"} {
t.Run(target, func(t *testing.T) {
svc, db, _ := seedRepricingModels(t)