This commit is contained in:
LHK
2025-10-13 15:39:49 +09:00
부모 b1c7861ee9
커밋 51deb07fab
7개의 변경된 파일2325개의 추가작업 그리고 269개의 파일을 삭제

파일 보기

@@ -7,13 +7,11 @@ const { runBot } = require('./bot');
const app = express();
const PORT = 3000;
// JSON 요청 본문을 파싱하기 위한 미들웨어
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// ### 1. 크론 스케줄러 설정 ###
// 5분마다 runBot 함수를 실행
cron.schedule('*/5 * * * *', () => {
console.log(`[CRON] 스케줄된 작업을 실행합니다...`);
runBot();
@@ -21,8 +19,6 @@ cron.schedule('*/5 * * * *', () => {
// ### 2. 웹 서버 API (라우트) 설정 ###
// 기본 페이지: 계정 목록 조회
app.get('/', async (req, res) => {
try {
const accounts = await db.query(`
@@ -31,17 +27,22 @@ app.get('/', async (req, res) => {
JOIN DOMAIN_LIST dl ON dal.DOMAIN_SEQ_ID = dl.DOMAIN_SEQ_ID
ORDER BY dal.DOMAIN_SEQ_ID, dal.DOMAIN_ACCNT_ID
`);
// 간단한 HTML 테이블 형태로 결과 표시
let html = `<h1>출석 계정 목록</h1>
<table border="1">
<tr><th>사이트</th><th>계정 ID</th><th>상태</th><th>다음 실행</th><th>사용여부</th></tr>`;
<table border="1" style="width:100%; border-collapse: collapse;">
<tr style="background-color:#f2f2f2;">
<th style="padding: 8px;">사이트</th>
<th style="padding: 8px;">계정 ID</th>
<th style="padding: 8px;">상태</th>
<th style="padding: 8px;">다음 실행</th>
<th style="padding: 8px;">사용여부</th>
</tr>`;
accounts.forEach(acc => {
html += `<tr>
<td>${acc.DOMAIN_NM}</td>
<td>${acc.DOMAIN_ACCNT_ID}</td>
<td>${acc.ATNDNC_STTS_CD}</td>
<td>${acc.ATNDNC_STRT_DTTM}</td>
<td>${acc.USE_YN}</td>
<td style="padding: 8px;">${acc.DOMAIN_NM}</td>
<td style="padding: 8px;">${acc.DOMAIN_ACCNT_ID}</td>
<td style="padding: 8px;">${acc.ATNDNC_STTS_CD}</td>
<td style="padding: 8px;">${acc.ATNDNC_STRT_DTTM}</td>
<td style="padding: 8px;">${acc.USE_YN}</td>
</tr>`;
});
html += '</table>';
@@ -51,8 +52,6 @@ app.get('/', async (req, res) => {
}
});
// TODO: 계정 정보 수정, 추가, 삭제 등의 API 엔드포인트를 여기에 추가할 수 있습니다.
// ### 3. 웹 서버 실행 ###
app.listen(PORT, () => {