fix(order): 开放普通等级租用极品专区

This commit is contained in:
yml
2026-11-28 17:50:51 +08:00
parent 06dbf52f08
commit a614ed1395
8 changed files with 102 additions and 25 deletions
@@ -1,6 +1,9 @@
package qualityowner
import "testing"
import (
"strings"
"testing"
)
func TestParseConfigValueDefaultsAndValidation(t *testing.T) {
rules, err := ParseConfigValue(`{"insurance_fee_bps":800,"premium_insurance_fee_bps":400}`)
@@ -39,3 +42,28 @@ func TestDefaultConfigValueCanBeParsed(t *testing.T) {
t.Fatalf("unexpected default agreement: %+v", rules)
}
}
func TestParseConfigValueMigratesLegacyPremiumRentalCopy(t *testing.T) {
rules := DefaultRules()
rules.AgreementContent = `| 《极品专区》 | 优质号主可选择发布的专属渠道,仅限大锤商行至尊SVIP用户租用;优质号主在该渠道发布账号可享有专项收益比例及专属标识 |
| 大锤商行至尊SVIP | 平台最高等级VIP用户,须同时满足租客免押资格方可租用《极品专区》渠道账号 |
| 租用资格 | 仅限大锤商行至尊SVIP,且须具备租客免押资格 | 全平台注册用户 |
| 租客筛选标准 | 累计消费≥1万元 + 无纠纷记录 + 无封禁记录 | 无特殊限制 |
5.2.2 非大锤商行至尊SVIP用户,或虽为大锤商行至尊SVIP但无租客免押资格的,不可查看及租用该渠道账号。
5.2.3 该渠道租客均为平台严选的优质租客,号主可享受“基本绝对安全”的出租体验。`
raw, err := MarshalConfig(rules)
if err != nil {
t.Fatal(err)
}
parsed, err := ParseConfigValue(raw)
if err != nil {
t.Fatal(err)
}
if strings.Contains(parsed.AgreementContent, "至尊SVIP") ||
strings.Contains(parsed.AgreementContent, "不可查看及租用") {
t.Fatalf("legacy premium rental copy was not migrated: %s", parsed.AgreementContent)
}
if !strings.Contains(parsed.AgreementContent, "不设成长等级门槛") {
t.Fatalf("new premium rental copy missing: %s", parsed.AgreementContent)
}
}