feat(publish): 增加等级与特殊皮肤价格修正
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -57,4 +57,55 @@ describe('mergeListingPublishOptions', () => {
|
||||
|
||||
expect(options.price_config.premium_zone_tooltip).toBe('自定义极品专区说明')
|
||||
})
|
||||
|
||||
it('旧皮肤分组缺少特殊价格字段时补默认特殊刀皮', () => {
|
||||
const options = mergeListingPublishOptions({
|
||||
skin_groups: [
|
||||
{
|
||||
key: 'melee',
|
||||
title: '近战皮肤',
|
||||
options: ['北极星', '龙牙', '赤霄'],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
expect(options.skin_groups[0].special_price_options).toEqual(['龙牙', '赤霄'])
|
||||
expect(options.skin_groups[0].special_ratio_adjustment).toBe(-1)
|
||||
})
|
||||
|
||||
it('后台显式清空特殊皮肤时不重新补默认值', () => {
|
||||
const options = mergeListingPublishOptions({
|
||||
skin_groups: [
|
||||
{
|
||||
key: 'melee',
|
||||
title: '近战皮肤',
|
||||
options: ['北极星'],
|
||||
special_price_options: [],
|
||||
special_ratio_adjustment: 0,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
expect(options.skin_groups[0].special_price_options).toEqual([])
|
||||
expect(options.skin_groups[0].special_ratio_adjustment).toBe(0)
|
||||
})
|
||||
|
||||
it('旧配置缺少等级比例规则时补默认 7/6 级规则', () => {
|
||||
const options = mergeListingPublishOptions({
|
||||
ratio_config: {
|
||||
quality_owner_ratio_discount: 1,
|
||||
premium_review_ratio_markup: 0,
|
||||
insurance_base_ratios: [],
|
||||
config_items: [],
|
||||
coin_corrections: [],
|
||||
},
|
||||
})
|
||||
|
||||
expect(options.ratio_config.level_ratio_rules).toEqual([
|
||||
{ key: 'stamina7', field: 'stamina', level: '7级', ratio_adjustment: -1 },
|
||||
{ key: 'stamina6', field: 'stamina', level: '6级', ratio_adjustment: -0.5 },
|
||||
{ key: 'load7', field: 'load', level: '7级', ratio_adjustment: -1 },
|
||||
{ key: 'load6', field: 'load', level: '6级', ratio_adjustment: -0.5 },
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -13,6 +13,8 @@ export interface PublishOptionGroup {
|
||||
key: SkinCategoryKey | string
|
||||
title: string
|
||||
options: string[]
|
||||
special_price_options: string[]
|
||||
special_ratio_adjustment: number
|
||||
}
|
||||
|
||||
export interface PublishQuantityItem {
|
||||
@@ -63,6 +65,13 @@ export interface PublishRatioConfigItem {
|
||||
missing_penalty: number
|
||||
}
|
||||
|
||||
export interface PublishLevelRatioRule {
|
||||
key: string
|
||||
field: 'stamina' | 'load' | string
|
||||
level: string
|
||||
ratio_adjustment: number
|
||||
}
|
||||
|
||||
export interface PublishCoinCorrection {
|
||||
threshold_m: number
|
||||
correction: number
|
||||
@@ -84,6 +93,7 @@ export interface PublishRatioConfig {
|
||||
quality_owner_ratio_discount: number
|
||||
premium_review_ratio_markup: number
|
||||
insurance_base_ratios: PublishInsuranceBaseRatio[]
|
||||
level_ratio_rules: PublishLevelRatioRule[]
|
||||
config_items: PublishRatioConfigItem[]
|
||||
coin_corrections: PublishCoinCorrection[]
|
||||
}
|
||||
@@ -132,22 +142,22 @@ const defaultDepositTooltip = `1. 系统推荐押金(基础覆盖)
|
||||
|
||||
2. 系统推荐押金未覆盖项目(需自行评估)
|
||||
|
||||
请注意,系统推荐押金暂不包含以下资产类型,您需要根据实际情况额外评估其价值:
|
||||
请注意,系统推荐押金只包含了皮肤评估的价值!暂不包含以下资产类型,您需要根据实际情况额外评估其价值:
|
||||
|
||||
- 收藏室内的稀有物品
|
||||
- 其他具有个人纪念意义或情怀价值的虚拟资产(如限定称号、绝版道具等)
|
||||
|
||||
3. 未出租价值折算规则(重点)
|
||||
|
||||
请在「收藏室及不出租部分哈弗币价值」中填写收藏室等不出租资产折合的哈弗币。系统按 1元=50万 计算参考值,并自动更新推荐押金:低于参考值时覆盖为参考值,否则追加参考值的 50%。
|
||||
请在「收藏室及不出租部分哈弗币价值,如150m纯币只出50m纯币」中填写收藏室等不出租资产折合的哈弗币。系统按 1元=50万 计算参考值,并自动更新推荐押金:低于参考值时覆盖为参考值,否则追加参考值的 50%。
|
||||
|
||||
示例:基础推荐押金 200 元、收藏室价值 200M → 参考值 400 元,200<400,推荐押金更新为 400 元。
|
||||
|
||||
目的:该举能够有效覆盖租客可能出现的洗号、违规操作导致账号封禁等风险带来的损失,为您提供充分的风险缓冲。
|
||||
目的:该举能够有效覆盖租客可能出现的洗号、违规操作导致账号封禁等风险带来的损失,为您提供充分的风险缓冲。也不用担心押金高账号出不去,只要其账号配置是符合押金的,一样的可以正常租出。
|
||||
|
||||
4. 额外保障选项
|
||||
|
||||
若您在设置足额押金后仍感不放心,可选择购买平台提供的《全额包赔服务》。一旦发生封号损失,将获得账号市场价值的全额赔付,让您的出租过程后顾无忧。`
|
||||
若您在设置足额押金后仍感不放心,可选择购买平台提供的《无忧租号保险》。一旦发生封号损失,将获得账号市场价值的全额赔付,让您的出租过程后顾无忧。但选择《无忧租号保险》,在结算是会产生额外保险服务费,具体可阅读《无忧租号保险》条例。`
|
||||
|
||||
const defaultPremiumZoneTooltip = `极品专区是面向优质号主和高价值账号的专属展示区。
|
||||
|
||||
@@ -157,9 +167,20 @@ const defaultPremiumZoneTooltip = `极品专区是面向优质号主和高价值
|
||||
4. 保险服务:可选择无忧租号保险,服务费率按优质号主及极品专区的当前配置执行,并按实际纯币结算金额计算,额外物品不计入保险基数。
|
||||
5. 责任说明:开启专区不会免除商品审核、资料真实性及发布协议中的责任,请如实填写账号资产与出租条件。`
|
||||
|
||||
const defaultLevelRatioRules: PublishLevelRatioRule[] = [
|
||||
{ key: 'stamina7', field: 'stamina', level: '7级', ratio_adjustment: -1 },
|
||||
{ key: 'stamina6', field: 'stamina', level: '6级', ratio_adjustment: -0.5 },
|
||||
{ key: 'load7', field: 'load', level: '7级', ratio_adjustment: -1 },
|
||||
{ key: 'load6', field: 'load', level: '6级', ratio_adjustment: -0.5 },
|
||||
]
|
||||
|
||||
const defaultSpecialPriceOptionsByGroup: Record<string, string[]> = {
|
||||
melee: ['龙牙', '赤霄'],
|
||||
}
|
||||
|
||||
export const emptyListingPublishOptions: ListingPublishOptions = {
|
||||
schema_version: 2,
|
||||
unlock_demulan_enabled: false,
|
||||
schema_version: 3,
|
||||
unlock_demulan_enabled: true,
|
||||
next_season_pass_enabled: false,
|
||||
server_options: [],
|
||||
face_options: [],
|
||||
@@ -175,27 +196,35 @@ export const emptyListingPublishOptions: ListingPublishOptions = {
|
||||
ban_evidence_options: [],
|
||||
fire_level_min: 38,
|
||||
price_config: {
|
||||
deposit_placeholder: '',
|
||||
deposit_placeholder:
|
||||
'温馨提示:本押金用于保障账号安全。若买家在租用期间,使用非纯币类道具/资源(如消耗品、材料等)或导致账号被封禁,相关损失将直接从押金中扣除进行赔付。押金过高会延长出租等待时间(请自行衡量)感谢理解。',
|
||||
deposit_hint: '租客缴纳,封号必赔付',
|
||||
deposit_tooltip: defaultDepositTooltip,
|
||||
premium_zone_tooltip: defaultPremiumZoneTooltip,
|
||||
compensation_note:
|
||||
'普通赔付方案如下:账号在租期内或祖期外出现封禁,追回、洗号等情况,最高可获赔全款相金+押金\n\n无忧保险赔付方案:按账号市场价值进行赔付(可参照螃蟹,盼之等主流交易平台)。无忧保险服务费按实际纯币结算金额计算,额外物品不计入计费基数;具体费率以当前配置为准。押金须达到推荐押金方可购买。',
|
||||
price_placeholder: '',
|
||||
ratio_description: '',
|
||||
'普通赔付方案如下:账号在租期内或祖期外出现封禁30天和十年等情况,最高可获赔全款相金+押金\n\n无忧保险赔付方案:按账号市场价值进行赔付(可参照螃蟹,盼之等主流交易平台)。无忧保险服务费按实际纯币结算金额计算,额外物品不计入计费基数;具体费率以当前配置为准。押金须达到推荐押金以上方可购买。',
|
||||
price_placeholder: '填写币数、保险、体力和负重后自动计算;发布总价=纯币基础价+额外消耗品',
|
||||
ratio_description: '1:xx 表示 1 元人民币(RMB)等价兑换 xx 万哈夫币',
|
||||
},
|
||||
deposit_recommend_config: {
|
||||
base_amount: 50,
|
||||
base_amount: 200,
|
||||
skin_group_rules: [
|
||||
{ group_key: 'melee', label: '刀皮', amount_per_item: 5 },
|
||||
{ group_key: 'operatorGold', label: '干员金皮', amount_per_item: 10 },
|
||||
{ group_key: 'operatorRed', label: '干员红皮', amount_per_item: 30 },
|
||||
{ group_key: 'melee', label: '刀皮', amount_per_item: 150 },
|
||||
{ group_key: 'operatorGold', label: '干员金皮', amount_per_item: 0 },
|
||||
{ group_key: 'operatorRed', label: '干员红皮', amount_per_item: 150 },
|
||||
{ group_key: 'weapon', label: '武器皮肤', amount_per_item: 200 },
|
||||
],
|
||||
},
|
||||
ratio_config: {
|
||||
quality_owner_ratio_discount: 1,
|
||||
premium_review_ratio_markup: 1,
|
||||
insurance_base_ratios: [],
|
||||
premium_review_ratio_markup: 0,
|
||||
insurance_base_ratios: [
|
||||
{ insurance: '3*3', ratio: 45 },
|
||||
{ insurance: '2*3', ratio: 47 },
|
||||
{ insurance: '2*2', ratio: 51 },
|
||||
{ insurance: '2*1', ratio: 51 },
|
||||
],
|
||||
level_ratio_rules: defaultLevelRatioRules,
|
||||
config_items: [],
|
||||
coin_corrections: [],
|
||||
},
|
||||
@@ -255,7 +284,7 @@ export function mergeListingPublishOptions(
|
||||
options?: Partial<ListingPublishOptions>
|
||||
): ListingPublishOptions {
|
||||
return {
|
||||
schema_version: readPositiveInteger(options?.schema_version, 2),
|
||||
schema_version: readPositiveInteger(options?.schema_version, 3),
|
||||
unlock_demulan_enabled: options?.unlock_demulan_enabled === true,
|
||||
next_season_pass_enabled: options?.next_season_pass_enabled === true,
|
||||
server_options: normalizeStringList(options?.server_options),
|
||||
@@ -318,10 +347,20 @@ function normalizeOptionGroups(values?: unknown[]): PublishOptionGroup[] {
|
||||
return values
|
||||
.map(item => {
|
||||
const group = isRecord(item) ? item : {}
|
||||
const key = typeof group.key === 'string' ? group.key.trim() : ''
|
||||
const rawSpecialOptions = group.special_price_options
|
||||
const hasSpecialOptions = Array.isArray(rawSpecialOptions)
|
||||
const specialPriceOptions = hasSpecialOptions
|
||||
? normalizeStringList(rawSpecialOptions)
|
||||
: [...(defaultSpecialPriceOptionsByGroup[key] || [])]
|
||||
return {
|
||||
key: typeof group.key === 'string' ? group.key.trim() : '',
|
||||
key,
|
||||
title: typeof group.title === 'string' ? group.title.trim() : '',
|
||||
options: normalizeStringList(Array.isArray(group.options) ? group.options : []),
|
||||
special_price_options: specialPriceOptions,
|
||||
special_ratio_adjustment: readSignedRatioAdjustment(
|
||||
hasSpecialOptions ? group.special_ratio_adjustment : -1
|
||||
),
|
||||
}
|
||||
})
|
||||
.filter(item => item.key && item.title)
|
||||
@@ -431,6 +470,9 @@ function normalizeRatioConfig(value?: unknown): PublishRatioConfig {
|
||||
insurance_base_ratios: normalizeInsuranceBaseRatios(
|
||||
Array.isArray(row.insurance_base_ratios) ? row.insurance_base_ratios : []
|
||||
),
|
||||
level_ratio_rules: Array.isArray(row.level_ratio_rules)
|
||||
? normalizeLevelRatioRules(row.level_ratio_rules)
|
||||
: defaultLevelRatioRules.map(item => ({ ...item })),
|
||||
config_items: normalizeRatioConfigItems(
|
||||
Array.isArray(row.config_items) ? row.config_items : []
|
||||
),
|
||||
@@ -440,6 +482,20 @@ function normalizeRatioConfig(value?: unknown): PublishRatioConfig {
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeLevelRatioRules(values: unknown[]): PublishLevelRatioRule[] {
|
||||
return values
|
||||
.map(item => {
|
||||
const row = isRecord(item) ? item : {}
|
||||
return {
|
||||
key: typeof row.key === 'string' ? row.key.trim() : '',
|
||||
field: typeof row.field === 'string' ? row.field.trim() : '',
|
||||
level: typeof row.level === 'string' ? row.level.trim() : '',
|
||||
ratio_adjustment: readSignedRatioAdjustment(row.ratio_adjustment),
|
||||
}
|
||||
})
|
||||
.filter(item => item.key && item.field && item.level)
|
||||
}
|
||||
|
||||
function normalizeSalePriceConfig(value?: unknown): PublishSalePriceConfig {
|
||||
const row = isRecord(value) ? value : {}
|
||||
const config = {
|
||||
@@ -456,6 +512,10 @@ function normalizeSalePriceConfig(value?: unknown): PublishSalePriceConfig {
|
||||
return config
|
||||
}
|
||||
|
||||
function readSignedRatioAdjustment(value: unknown) {
|
||||
return Math.min(10, Math.max(-10, readNumber(value)))
|
||||
}
|
||||
|
||||
function normalizeInsuranceBaseRatios(values: unknown[]): PublishInsuranceBaseRatio[] {
|
||||
return values
|
||||
.map(item => {
|
||||
|
||||
Reference in New Issue
Block a user