[Log] Log, IF-LGSP-LOG-018, Live 방송 알람 팝업 Ok/No 반영

This commit is contained in:
younghoon100.park
2024-05-28 13:42:49 +09:00
parent cd9f22ee92
commit 49fd64a078
4 changed files with 148 additions and 7 deletions

View File

@@ -69,6 +69,11 @@ export const getUrlByLogTpNo = (logTpNo) => {
case LOG_TP_NO.ALARM_POP:
return URLS.LOG_ALARM_POP;
// IF-LGSP-LOG-018 / 알람 팝업 OK/NO 클릭
case LOG_TP_NO.ALARM_CLICK.OK:
case LOG_TP_NO.ALARM_CLICK.NO:
return URLS.LOG_ALARM_CLICK;
// IF-LGSP-LOG-110 / Featured Brands View 이력
case LOG_TP_NO.BRANDS:
return URLS.LOG_BRANDS;

View File

@@ -651,6 +651,83 @@ export default function useLogService() {
[dispatch, entryMenuRef, nowMenuRef]
);
/**
* IF-LGSP-LOG-018 / 알람 팝업 OK/NO 클릭
*
* (M) alarmDt 알람 발생 시간
*
* (M) alarmType 알람 유형 Upcoming/Keyword
*
* (M) clickFlag 클릭 유형 Ok/No
*
* (M) cnt 키워드 개수
*
* (M) entryMenu 진입 메뉴
*
* (O) hstNm 호스트 이름
*
* (M) keywordList 키워드 리스트(콤마 구분자)
*
* (O) lgCatCd 카테고리 코드
*
* (O) lgCatNm 카테고리 이름
*
* (M) logTpNo 로그 타입 넘버
*
* (M) nowMenu 현재 메뉴
*
* (M) patncNm 파트너 이름
*
* (M) patnrId 파트너 아이디
*
* (M) showId 방송 아이디
*
* (M) showNm 방송 이름
*/
const sendLogAlarmClick = useCallback(
(params) => {
const {
alarmDt,
alarmType,
clickFlag,
cnt,
keywordList,
logTpNo,
patncNm,
patnrId,
showId,
showNm,
} = params;
if (
!alarmDt ||
!alarmType ||
!clickFlag ||
!cnt ||
!logTpNo ||
!patncNm ||
!patnrId ||
!showId ||
!showNm
) {
console.error("sendLogAlarmClick invalid params", params);
return;
}
const newParams = {
...params,
entryMenu: entryMenuRef.current,
hstNm: params?.hstNm ?? "",
lgCatCd: params?.lgCatCd ?? "",
lgCatNm: params?.lgCatNm ?? "",
nowMenu: nowMenuRef.current,
};
dispatch(postLog(newParams));
},
[dispatch, entryMenuRef, nowMenuRef]
);
/**
* IF-LGSP-LOG-110 / Featured Brands View 이력
*
@@ -746,6 +823,7 @@ export default function useLogService() {
sendLogUpcomingFlag,
sendLogPartners,
sendLogAlarmPop,
sendLogAlarmClick,
sendLogFeaturedBrands,
sendLogTerms,
};

View File

@@ -101,6 +101,11 @@ export const LOG_TP_NO = {
ALARM_POP: "281",
ALARM_CLICK: {
OK: "282",
NO: "283",
},
BRANDS: "290",
PARTNERS: "500",

View File

@@ -69,7 +69,7 @@ const panelMap = {
};
export default function MainView({ className }) {
const { sendLogAlarmPop } = useLogService();
const { sendLogAlarmPop, sendLogAlarmClick } = useLogService();
const dispatch = useDispatch();
const mainIndex = useSelector((state) => state.appData.mainIndex);
const panels = useSelector((state) => state.panels.panels);
@@ -285,7 +285,7 @@ export default function MainView({ className }) {
if (intervalActive) {
checkForAlerts();
}
}, 60000);
}, 10000);
return () => clearInterval(interval);
}, [intervalActive, upComingAlertShow]);
@@ -300,7 +300,7 @@ export default function MainView({ className }) {
) {
// isSameDateTime -> "2024-04-30 13:29:00" , "upComingAlertShow.alertShows[i].strDt"
for (let i = 0; i < upComingAlertShow.alertShows.length; i++) {
if (isSameDateTime("2024-05-17 15:25:00")) {
if (isSameDateTime(upComingAlertShow.alertShows[i].strDt)) {
alertList.push(upComingAlertShow.alertShows[i]);
setAlertItems(alertList);
setWatchPopOpen(true);
@@ -326,12 +326,38 @@ export default function MainView({ className }) {
// 알림 확인 FEATURED_BRANDS_PANEL 이동
const handleClick = useCallback(() => {
let patnrIdNumber = alertItems[0].patnrId.toString();
const {
hstNm,
lgCatCd,
lgCatNm,
patncNm,
patnrId,
showId,
showNm,
strtDt: alarmDt,
} = alertItems[0];
sendLogAlarmClick({
alarmDt,
alarmType: "Upcoming",
clickFlag: "Ok",
cnt: "0",
hstNm,
keywordList: "",
lgCatCd,
lgCatNm,
logTpNo: Config.LOG_TP_NO.ALARM_CLICK.OK,
patncNm,
patnrId: patnrId.toString(),
showId,
showNm,
});
dispatch(resetPanels());
dispatch(
pushPanel({
name: panel_names.FEATURED_BRANDS_PANEL,
panelInfo: { patnrId: patnrIdNumber },
panelInfo: { patnrId: patnrId.toString() },
})
);
setWatchPopOpen(false);
@@ -340,12 +366,39 @@ export default function MainView({ className }) {
if (popupTimer) {
clearTimeout(popupTimer); // 버튼 클릭 시 타이머 제거
}
}, [dispatch, alertItems, popupTimer]);
}, [dispatch, alertItems, popupTimer, sendLogAlarmClick]);
const onWatchClose = useCallback(() => {
const {
hstNm,
lgCatCd,
lgCatNm,
patncNm,
patnrId,
showId,
showNm,
strtDt: alarmDt,
} = alertItems[0];
sendLogAlarmClick({
alarmDt,
alarmType: "Upcoming",
clickFlag: "No",
cnt: "0",
hstNm,
keywordList: "",
lgCatCd,
lgCatNm,
logTpNo: Config.LOG_TP_NO.ALARM_CLICK.NO,
patncNm,
patnrId: patnrId.toString(),
showId,
showNm,
});
setIntervalActive((prev) => !prev);
setWatchPopOpen(false);
}, []);
}, [alertItems, sendLogAlarmClick]);
return (
<div className={classNames(css.mainViewWrap, className)}>