fix: 캡차 TOO FREQUENT 해결 + 모바일 반응형 추가
All checks were successful
Build and Deploy / deploy-front (push) Successful in 8s
Build and Deploy / deploy-back (push) Successful in 21s

This commit is contained in:
hyoseung 2026-05-19 17:48:56 +09:00
parent 30b4125af7
commit 4b399c0189
2 changed files with 20 additions and 16 deletions

View File

@ -114,15 +114,11 @@ export class WosService {
code: string, code: string,
maxRetries = 5, maxRetries = 5,
): Promise<{ success: boolean; message: string; err_code?: number }> { ): Promise<{ success: boolean; message: string; err_code?: number }> {
const ts1 = this.now();
const playerSign = this.makePlayerSign(fid, ts1);
await axios.post(
`${WOS_API_BASE}/player`,
new URLSearchParams({ fid, time: String(ts1), sign: playerSign }),
{ headers: { ...COMMON_HEADERS } },
);
for (let attempt = 1; attempt <= maxRetries; attempt++) { for (let attempt = 1; attempt <= maxRetries; attempt++) {
if (attempt > 1) {
await new Promise((r) => setTimeout(r, 2000));
}
let captchaCode: string; let captchaCode: string;
try { try {
captchaCode = await this.solveCaptcha(fid); captchaCode = await this.solveCaptcha(fid);
@ -130,11 +126,11 @@ export class WosService {
return { success: false, message: `캡차 오류: ${err.message}` }; return { success: false, message: `캡차 오류: ${err.message}` };
} }
const ts2 = this.now(); const ts = this.now();
const giftSign = this.makeGiftSign(fid, ts2, code, captchaCode); const giftSign = this.makeGiftSign(fid, ts, code, captchaCode);
const response = await axios.post( const response = await axios.post(
`${WOS_API_BASE}/gift_code`, `${WOS_API_BASE}/gift_code`,
new URLSearchParams({ fid, time: String(ts2), sign: giftSign, cdk: code, captcha_code: captchaCode }), new URLSearchParams({ fid, time: String(ts), sign: giftSign, cdk: code, captcha_code: captchaCode }),
{ headers: { ...COMMON_HEADERS } }, { headers: { ...COMMON_HEADERS } },
); );
@ -143,10 +139,7 @@ export class WosService {
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) { if (data.err_code === 40103) {
if (attempt < maxRetries) { if (attempt < maxRetries) continue;
await new Promise((r) => setTimeout(r, 500));
continue;
}
return { success: false, message: `캡차 인식 실패 (${maxRetries}회 시도)`, err_code: data.err_code }; return { success: false, message: `캡차 인식 실패 (${maxRetries}회 시도)`, err_code: data.err_code };
} }
return { success: false, message: data.msg || `실패 (${data.err_code})`, err_code: data.err_code }; return { success: false, message: data.msg || `실패 (${data.err_code})`, err_code: data.err_code };
@ -194,7 +187,7 @@ export class WosService {
await this.couponLogRepo.save({ fid, coupon_code: coupon.code, result_msg: result.message }); await this.couponLogRepo.save({ fid, coupon_code: coupon.code, result_msg: result.message });
results.push({ name: coupon.name, code: coupon.code, status, message: result.message }); results.push({ name: coupon.name, code: coupon.code, status, message: result.message });
await new Promise((r) => setTimeout(r, 1500)); await new Promise((r) => setTimeout(r, 3000));
} }
return results; return results;

View File

@ -209,4 +209,15 @@ header h1 { font-size: 1.9rem; color: #1e293b; margin: 0 0 8px; }
.btn-primary:hover:not(:disabled) { background: #2563eb; } .btn-primary:hover:not(:disabled) { background: #2563eb; }
.error-msg { color: #dc2626; font-size: 0.9rem; margin: 8px 0 0; } .error-msg { color: #dc2626; font-size: 0.9rem; margin: 8px 0 0; }
.empty { color: #94a3b8; font-size: 0.9rem; margin: 0; text-align: center; padding: 12px 0; } .empty { color: #94a3b8; font-size: 0.9rem; margin: 0; text-align: center; padding: 12px 0; }
@media (max-width: 640px) {
.layout { padding: 16px 12px 40px; }
header h1 { font-size: 1.4rem; }
.columns { flex-direction: column; }
.col-left { width: 100%; }
.user-list { max-height: 180px; }
.search-row { flex-direction: column; }
.search-row .btn { width: 100%; }
.card { padding: 14px; }
}
</style> </style>