feat(listing): 优化优质号主发布与极品专区体验

This commit is contained in:
yml2213
2026-11-04 15:59:53 +08:00
parent 98174c0e33
commit e9102026ae
22 changed files with 812 additions and 88 deletions
@@ -333,6 +333,10 @@ func normalizePublishOptionsValue(value string) (string, error) {
if err := json.Unmarshal([]byte(value), &fields); err != nil {
return "", err
}
if !hasNestedJSONField(fields, "ratio_config", "quality_owner_ratio_discount") {
options.RatioConfig.QualityOwnerRatioDiscount =
DefaultPublishOptions().RatioConfig.QualityOwnerRatioDiscount
}
originalVersion := options.SchemaVersion
if options.SchemaVersion < publishOptionsSchemaVersion {
if hasLegacyPublishQuantityItem(options.QuantityItems) {
@@ -360,6 +364,19 @@ func normalizePublishOptionsValue(value string) (string, error) {
return string(raw), nil
}
func hasNestedJSONField(fields map[string]json.RawMessage, parent, child string) bool {
raw, ok := fields[parent]
if !ok {
return false
}
var nested map[string]json.RawMessage
if err := json.Unmarshal(raw, &nested); err != nil {
return false
}
_, ok = nested[child]
return ok
}
func hasLegacyPublishQuantityItem(items []PublishQuantityItem) bool {
for _, item := range items {
if item.Key == "kit5" {