/** * 滑块验证码处理模块 * * 山东电力交易中心的 API 滑块验证码处理 * 使用 Python no-puzzle-captcha 库进行识别(基于 OpenCV 模板匹配) */ import { HttpClient } from './client.js'; /** * getPic API 响应 */ export interface CaptchaResponse { capcode: string; slidingImage: string; backImage: string; yHeight: number; } /** * checkcapcode API 响应 */ export interface CaptchaVerifyResponse { success?: boolean; code?: number; var?: string; val?: string; message?: string; } /** * 验证码识别结果 */ export interface CaptchaResult { success: boolean; xpos?: number; capcode?: string; varValue?: string; message: string; attempts: number; } /** * 验证码求解器 */ export declare class CaptchaSolver { private client; private maxRetries; constructor(client: HttpClient, maxRetries?: number); /** * 获取验证码 */ getCaptcha(jytype?: string): Promise; /** * 验证验证码 * @returns 验证响应,包含 val/var 值(用于下单接口) */ verifyCaptcha(xpos: number, capcode: string, unitid: string): Promise; /** * 使用 Python OpenCV 识别缺口位置 * 调用 no-puzzle-captcha 库进行模板匹配 * * @param backImageBase64 背景图 base64 * @param slidingImageBase64 滑块图 base64 * @returns 缺口 X 坐标 */ findGapPosition(backImageBase64: string, slidingImageBase64: string): Promise; /** * 完整的验证码处理流程 * 最多尝试 maxRetries 次 */ solve(unitid: string, jytype?: string): Promise; /** * 获取验证码图片(用于调试) */ getCaptchaImages(jytype?: string): Promise<{ captcha: CaptchaResponse; estimatedXpos: number; }>; private sleep; } //# sourceMappingURL=captcha.d.ts.map