优化筛选
This commit is contained in:
+26
@@ -45,10 +45,18 @@ export interface PublicListingQuery {
|
||||
keyword?: string;
|
||||
sort?: string;
|
||||
zone?: string;
|
||||
login_method?: string;
|
||||
rank?: string;
|
||||
insurance?: string;
|
||||
stamina?: string;
|
||||
load?: string;
|
||||
skin_name?: string;
|
||||
min_coin?: number;
|
||||
max_coin?: number;
|
||||
min_price?: number;
|
||||
max_price?: number;
|
||||
min_secret_kd?: number;
|
||||
max_secret_kd?: number;
|
||||
}
|
||||
|
||||
export interface HomeBannerSlide {
|
||||
@@ -66,6 +74,11 @@ export interface ListingPublishOptions {
|
||||
rank_options: string[];
|
||||
insurance_options: string[];
|
||||
level_options: string[];
|
||||
skin_groups: Array<{
|
||||
key: string;
|
||||
title: string;
|
||||
options: string[];
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface MobileHomeConfig {
|
||||
@@ -121,9 +134,22 @@ function normalizeOptions(value: unknown): ListingPublishOptions {
|
||||
rank_options: normalizeStringArray(options.rank_options),
|
||||
insurance_options: normalizeStringArray(options.insurance_options),
|
||||
level_options: normalizeStringArray(options.level_options),
|
||||
skin_groups: normalizeSkinGroups(options.skin_groups),
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeSkinGroups(value: unknown) {
|
||||
if (!Array.isArray(value)) return [];
|
||||
return value
|
||||
.filter((item): item is Record<string, unknown> => typeof item === "object" && item !== null)
|
||||
.map((item) => ({
|
||||
key: typeof item.key === "string" ? item.key : "",
|
||||
title: typeof item.title === "string" ? item.title : "",
|
||||
options: normalizeStringArray(item.options),
|
||||
}))
|
||||
.filter((item) => item.key && item.title);
|
||||
}
|
||||
|
||||
async function request<T>(path: string, query: Record<string, unknown> = {}) {
|
||||
const url = new URL(`${apiBase}${path}`, window.location.origin);
|
||||
Object.entries(query).forEach(([key, value]) => {
|
||||
|
||||
Reference in New Issue
Block a user