[251124] fix: Log정리-5
🕐 커밋 시간: 2025. 11. 24. 12:43:58 📊 변경 통계: • 총 파일: 40개 • 추가: +774줄 • 삭제: -581줄 📝 수정된 파일: ~ com.twin.app.shoptime/src/actions/appDataActions.js ~ com.twin.app.shoptime/src/actions/billingActions.js ~ com.twin.app.shoptime/src/actions/brandActions.js ~ com.twin.app.shoptime/src/actions/cancelActions.js ~ com.twin.app.shoptime/src/actions/cardActions.js ~ com.twin.app.shoptime/src/actions/cartActions.js ~ com.twin.app.shoptime/src/actions/checkoutActions.js ~ com.twin.app.shoptime/src/actions/commonActions.js ~ com.twin.app.shoptime/src/actions/convertActions.js ~ com.twin.app.shoptime/src/actions/couponActions.js ~ com.twin.app.shoptime/src/actions/deviceActions.js ~ com.twin.app.shoptime/src/actions/empActions.js ~ com.twin.app.shoptime/src/actions/eventActions.js ~ com.twin.app.shoptime/src/actions/forYouActions.js ~ com.twin.app.shoptime/src/actions/homeActions.js ~ com.twin.app.shoptime/src/actions/logActions.js ~ com.twin.app.shoptime/src/actions/mediaActions.js ~ com.twin.app.shoptime/src/actions/mockCartActions.js ~ com.twin.app.shoptime/src/actions/myPageActions.js ~ com.twin.app.shoptime/src/actions/onSaleActions.js ~ com.twin.app.shoptime/src/actions/orderActions.js ~ com.twin.app.shoptime/src/actions/panelActions.js ~ com.twin.app.shoptime/src/actions/panelNavigationActions.js ~ com.twin.app.shoptime/src/actions/pinCodeActions.js ~ com.twin.app.shoptime/src/actions/productActions.js ~ com.twin.app.shoptime/src/actions/queuedPanelActions.js ~ com.twin.app.shoptime/src/actions/searchActions.js ~ com.twin.app.shoptime/src/actions/shippingActions.js ~ com.twin.app.shoptime/src/actions/voiceActions.js ~ com.twin.app.shoptime/src/actions/webSpeechActions.js ~ com.twin.app.shoptime/src/reducers/localSettingsReducer.js ~ com.twin.app.shoptime/src/reducers/mediaOverlayReducer.js ~ com.twin.app.shoptime/src/reducers/mockCartReducer.js ~ com.twin.app.shoptime/src/reducers/playReducer.js ~ com.twin.app.shoptime/src/reducers/productReducer.js ~ com.twin.app.shoptime/src/reducers/videoOverlayReducer.js ~ com.twin.app.shoptime/src/views/UserReview/ShowUserReviews.jsx ~ com.twin.app.shoptime/src/views/UserReview/UserReviewPanel.jsx ~ com.twin.app.shoptime/src/views/UserReview/components/UserReviewsList.jsx ~ com.twin.app.shoptime/src/views/UserReview/components/VirtualScrollBar.jsx 🔧 함수 변경 내용: 📊 Function-level changes summary across 40 files: • Functions added: 14 • Functions modified: 34 • Functions deleted: 18 📋 By language: • javascript: 40 files, 66 function changes 🔧 주요 변경 내용: • 핵심 비즈니스 로직 개선 • 로깅 시스템 개선 • 설정 관리 시스템 개선 • UI 컴포넌트 아키텍처 개선
This commit is contained in:
@@ -2,6 +2,11 @@ import { URLS } from '../api/apiConfig';
|
||||
import { TAxios } from '../api/TAxios';
|
||||
import { types } from './actionTypes';
|
||||
import { getReAuthenticationCode } from './deviceActions';
|
||||
import { createDebugHelpers } from '../utils/debug';
|
||||
|
||||
// 디버그 헬퍼 설정
|
||||
const DEBUG_MODE = false;
|
||||
const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE);
|
||||
|
||||
/**
|
||||
* PDF를 이미지로 변환 (재시도 로직 포함)
|
||||
@@ -18,7 +23,7 @@ export const convertPdfToImage =
|
||||
|
||||
const attemptConversion = () => {
|
||||
attempts++;
|
||||
// console.log(`🔄 [EnergyLabel] Converting PDF attempt ${attempts}/${maxRetries + 1}:`, pdfUrl);
|
||||
// dlog(`🔄 [EnergyLabel] Converting PDF attempt ${attempts}/${maxRetries + 1}:`, pdfUrl);
|
||||
|
||||
// 타임아웃 설정
|
||||
timeoutId = setTimeout(() => {
|
||||
@@ -26,15 +31,15 @@ export const convertPdfToImage =
|
||||
const timeoutError = new Error(
|
||||
`Conversion timeout after ${timeout}ms (attempt ${attempts})`
|
||||
);
|
||||
console.warn(`⏱️ [EnergyLabel] Timeout on attempt ${attempts}:`, timeoutError.message);
|
||||
dwarn(`⏱️ [EnergyLabel] Timeout on attempt ${attempts}:`, timeoutError.message);
|
||||
|
||||
// 재시도 가능한 경우
|
||||
if (attempts < maxRetries + 1) {
|
||||
// console.log(`🔄 [EnergyLabel] Retrying... (${attempts}/${maxRetries + 1})`);
|
||||
// dlog(`🔄 [EnergyLabel] Retrying... (${attempts}/${maxRetries + 1})`);
|
||||
attemptConversion();
|
||||
} else {
|
||||
// 최종 실패
|
||||
console.error(`❌ [EnergyLabel] Final failure after ${attempts} attempts:`, pdfUrl);
|
||||
derror(`❌ [EnergyLabel] Final failure after ${attempts} attempts:`, pdfUrl);
|
||||
dispatch({
|
||||
type: types.CONVERT_PDF_TO_IMAGE_FAILURE,
|
||||
payload: { pdfUrl, error: timeoutError },
|
||||
@@ -53,22 +58,20 @@ export const convertPdfToImage =
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
|
||||
|
||||
// retCode 체크 (프로젝트 API 규약: 200이어도 retCode로 성공/실패 구분)
|
||||
const retCode = response.headers?.retcode || response.headers?.retCode;
|
||||
|
||||
|
||||
if (retCode !== undefined && retCode !== 0 && retCode !== '0') {
|
||||
const error = new Error(`API Error: retCode=${retCode}`);
|
||||
console.warn(`⚠️ [EnergyLabel] API returned error on attempt ${attempts}:`, retCode);
|
||||
dwarn(`⚠️ [EnergyLabel] API returned error on attempt ${attempts}:`, retCode);
|
||||
|
||||
// retCode 에러도 재시도
|
||||
if (attempts < maxRetries + 1) {
|
||||
console.log(
|
||||
`🔄 [EnergyLabel] Retrying due to API error... (${attempts}/${maxRetries + 1})`
|
||||
);
|
||||
dlog(`🔄 [EnergyLabel] Retrying due to API error... (${attempts}/${maxRetries + 1})`);
|
||||
attemptConversion();
|
||||
} else {
|
||||
console.error(
|
||||
derror(
|
||||
`❌ [EnergyLabel] Final failure after ${attempts} attempts (API error):`,
|
||||
pdfUrl
|
||||
);
|
||||
@@ -80,62 +83,62 @@ export const convertPdfToImage =
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.data.type !== "image/png"){
|
||||
dispatch(getReAuthenticationCode());
|
||||
|
||||
if (response.data.type !== 'image/png') {
|
||||
dispatch(getReAuthenticationCode());
|
||||
attemptConversion();
|
||||
return;
|
||||
}
|
||||
|
||||
let imageUrl;
|
||||
try {
|
||||
if (response.data instanceof Blob) {
|
||||
if (response.data.size === 0) {
|
||||
throw new Error('Invalid image data (empty blob)');
|
||||
}
|
||||
imageUrl = URL.createObjectURL(response.data);
|
||||
} else if (response.data instanceof ArrayBuffer) {
|
||||
if (response.data.byteLength === 0) {
|
||||
throw new Error('Invalid image data (empty buffer)');
|
||||
}
|
||||
const blob = new Blob([response.data], { type: 'image/png' });
|
||||
imageUrl = URL.createObjectURL(blob);
|
||||
} else {
|
||||
const blob = new Blob([response.data], { type: 'image/png' });
|
||||
if (blob.size === 0) {
|
||||
throw new Error('Invalid image data (empty blob)');
|
||||
}
|
||||
imageUrl = URL.createObjectURL(blob);
|
||||
}
|
||||
|
||||
dlog(`✅ [EnergyLabel] Conversion successful on attempt ${attempts}:`, pdfUrl);
|
||||
dispatch({
|
||||
type: types.CONVERT_PDF_TO_IMAGE_SUCCESS,
|
||||
payload: { pdfUrl, imageUrl },
|
||||
});
|
||||
|
||||
callback && callback(null, imageUrl);
|
||||
} catch (error) {
|
||||
derror(`❌ [EnergyLabel] Image creation failed on attempt ${attempts}:`, error);
|
||||
|
||||
// 이미지 생성 실패도 재시도
|
||||
if (attempts < maxRetries + 1) {
|
||||
dlog(
|
||||
`🔄 [EnergyLabel] Retrying due to image creation error... (${attempts}/${maxRetries + 1})`
|
||||
);
|
||||
attemptConversion();
|
||||
return;
|
||||
}
|
||||
|
||||
let imageUrl;
|
||||
try {
|
||||
if (response.data instanceof Blob) {
|
||||
if (response.data.size === 0) {
|
||||
throw new Error('Invalid image data (empty blob)');
|
||||
}
|
||||
imageUrl = URL.createObjectURL(response.data);
|
||||
} else if (response.data instanceof ArrayBuffer) {
|
||||
if (response.data.byteLength === 0) {
|
||||
throw new Error('Invalid image data (empty buffer)');
|
||||
}
|
||||
const blob = new Blob([response.data], { type: 'image/png' });
|
||||
imageUrl = URL.createObjectURL(blob);
|
||||
} else {
|
||||
const blob = new Blob([response.data], { type: 'image/png' });
|
||||
if (blob.size === 0) {
|
||||
throw new Error('Invalid image data (empty blob)');
|
||||
}
|
||||
imageUrl = URL.createObjectURL(blob);
|
||||
}
|
||||
|
||||
console.log(`✅ [EnergyLabel] Conversion successful on attempt ${attempts}:`, pdfUrl);
|
||||
} else {
|
||||
derror(
|
||||
`❌ [EnergyLabel] Final failure after ${attempts} attempts (image error):`,
|
||||
pdfUrl
|
||||
);
|
||||
dispatch({
|
||||
type: types.CONVERT_PDF_TO_IMAGE_SUCCESS,
|
||||
payload: { pdfUrl, imageUrl },
|
||||
type: types.CONVERT_PDF_TO_IMAGE_FAILURE,
|
||||
payload: { pdfUrl, error },
|
||||
});
|
||||
|
||||
callback && callback(null, imageUrl);
|
||||
} catch (error) {
|
||||
console.error(`❌ [EnergyLabel] Image creation failed on attempt ${attempts}:`, error);
|
||||
|
||||
// 이미지 생성 실패도 재시도
|
||||
if (attempts < maxRetries + 1) {
|
||||
console.log(
|
||||
`🔄 [EnergyLabel] Retrying due to image creation error... (${attempts}/${maxRetries + 1})`
|
||||
);
|
||||
attemptConversion();
|
||||
} else {
|
||||
console.error(
|
||||
`❌ [EnergyLabel] Final failure after ${attempts} attempts (image error):`,
|
||||
pdfUrl
|
||||
);
|
||||
dispatch({
|
||||
type: types.CONVERT_PDF_TO_IMAGE_FAILURE,
|
||||
payload: { pdfUrl, error },
|
||||
});
|
||||
callback && callback(error, null);
|
||||
}
|
||||
callback && callback(error, null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onFail = (error) => {
|
||||
@@ -144,16 +147,14 @@ export const convertPdfToImage =
|
||||
timeoutId = null;
|
||||
}
|
||||
|
||||
console.warn(`⚠️ [EnergyLabel] Network error on attempt ${attempts}:`, error.message);
|
||||
dwarn(`⚠️ [EnergyLabel] Network error on attempt ${attempts}:`, error.message);
|
||||
|
||||
// 네트워크 에러도 재시도
|
||||
if (attempts < maxRetries + 1) {
|
||||
console.log(
|
||||
`🔄 [EnergyLabel] Retrying due to network error... (${attempts}/${maxRetries + 1})`
|
||||
);
|
||||
dlog(`🔄 [EnergyLabel] Retrying due to network error... (${attempts}/${maxRetries + 1})`);
|
||||
attemptConversion();
|
||||
} else {
|
||||
console.error(
|
||||
derror(
|
||||
`❌ [EnergyLabel] Final failure after ${attempts} attempts (network error):`,
|
||||
pdfUrl
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user