feat: prepare Zhinian desktop client for pilot release
This commit is contained in:
28
packages/skills-hotel-core/src/index.ts
Normal file
28
packages/skills-hotel-core/src/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
export interface PriceAnomalyRuleInput {
|
||||
roomType: string;
|
||||
date: string;
|
||||
price: number;
|
||||
priceFloor?: number;
|
||||
}
|
||||
|
||||
export type PriceAnomalyKind = 'below_floor' | 'large_gap' | 'unavailable' | 'missing_room' | 'parse_suspect';
|
||||
|
||||
export interface PriceAnomaly {
|
||||
kind: PriceAnomalyKind;
|
||||
roomType: string;
|
||||
date: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export function detectPriceFloorAnomaly(input: PriceAnomalyRuleInput): PriceAnomaly | null {
|
||||
if (typeof input.priceFloor !== 'number') return null;
|
||||
if (input.price >= input.priceFloor) return null;
|
||||
|
||||
return {
|
||||
kind: 'below_floor',
|
||||
roomType: input.roomType,
|
||||
date: input.date,
|
||||
message: `价格 ${input.price} 低于底价 ${input.priceFloor}`,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user