New task
배포됩니다. **로직:** - 40103(OCR 오인식) → **30초 대기 → 재시도 → 무한 반복** (성공할 때까지) - 성공 → 다음 쿠폰으로 - 40103 외 다른 에러(만료, 이미수령 등) → 즉시 종료
This commit is contained in:
parent
8c70714ed6
commit
68bb9e2863
@ -113,9 +113,11 @@ export class WosService {
|
|||||||
fid: string,
|
fid: string,
|
||||||
code: string,
|
code: string,
|
||||||
): Promise<{ success: boolean; message: string; err_code?: number }> {
|
): Promise<{ success: boolean; message: string; err_code?: number }> {
|
||||||
for (let attempt = 1; attempt <= 2; attempt++) {
|
let attempt = 0;
|
||||||
|
while (true) {
|
||||||
|
attempt++;
|
||||||
if (attempt > 1) {
|
if (attempt > 1) {
|
||||||
this.logger.warn(`[${fid}] ${code} 캡차 오인식, 30초 대기 후 재시도`);
|
this.logger.warn(`[${fid}] ${code} 캡차 오인식 (${attempt - 1}회), 30초 대기 후 재시도`);
|
||||||
await new Promise((r) => setTimeout(r, 30000));
|
await new Promise((r) => setTimeout(r, 30000));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,15 +140,13 @@ export class WosService {
|
|||||||
this.logger.log(`[${fid}] ${code} attempt=${attempt} captcha=${captchaCode} → code=${data.code} err=${data.err_code} msg=${data.msg}`);
|
this.logger.log(`[${fid}] ${code} attempt=${attempt} captcha=${captchaCode} → code=${data.code} err=${data.err_code} msg=${data.msg}`);
|
||||||
|
|
||||||
if (data.code === 0) return { success: true, message: SUCCESS_MSG };
|
if (data.code === 0) return { success: true, message: SUCCESS_MSG };
|
||||||
if (data.err_code === 40103 && attempt < 2) continue;
|
if (data.err_code === 40103) continue;
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: data.msg || `실패 (${data.err_code})`,
|
message: data.msg || `실패 (${data.err_code})`,
|
||||||
err_code: data.err_code,
|
err_code: data.err_code,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return { success: false, message: '알 수 없는 오류' };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async redeemAll(fid: string) {
|
async redeemAll(fid: string) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user