You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { addFlockCheckoutFillJob } from "@/workers/rpa/queue";
import type {
FlockCheckoutTier,
FlockFlexibilityKey,
} from "@/lib/flock/flock-checkout-selection";
import type { FlockQuoteInput } from "@/workers/rpa/flock/types";
import type { FlockCheckoutDetails } from "@/modules/flock/checkout-validation";
export type FlockCheckoutFillJobData = {
quoteId: string;
requestId: string;
customerId: string;
preferredTier: FlockCheckoutTier;
preferredFlexibility?: FlockFlexibilityKey | null;
preferredCarrier?: string | null;
reference?: string | null;
input: FlockQuoteInput;
flockDetails?: FlockCheckoutDetails;
/** 首价保活 session;有则优先接管驻留页 */
quoteSessionId?: string | null;
};
export async function enqueueFlockCheckoutFillJob(
data: FlockCheckoutFillJobData,
): Promise<void> {
if (process.env.RPA_QUEUE_ENABLED === "false") {
console.log(
`[rpa-queue] 队列已禁用 flock-checkout quote_id=${data.quoteId}`,
);
return;
}
await addFlockCheckoutFillJob(data);
console.log(
`[rpa-queue] 已入队 flock-checkout-fill quote_id=${data.quoteId} tier=${data.preferredTier}`,
);
}