update
This commit is contained in:
@@ -2,7 +2,6 @@ node_modules
|
||||
.git
|
||||
.gitignore
|
||||
*.md
|
||||
.env
|
||||
.env.*
|
||||
*.log
|
||||
dist
|
||||
|
||||
BIN
prisma/dev.db
BIN
prisma/dev.db
Binary file not shown.
@@ -21,13 +21,21 @@ const telegramService = new TelegramService(
|
||||
false
|
||||
);
|
||||
|
||||
function logWithTime(...args: unknown[]) {
|
||||
console.log(`[${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`, ...args);
|
||||
}
|
||||
|
||||
function errorWithTime(...args: unknown[]) {
|
||||
console.error(`[${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`, ...args);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
console.time("sendTelegram");
|
||||
await sendTelegram();
|
||||
console.timeEnd("sendTelegram");
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
errorWithTime(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +43,7 @@ async function sendTelegram() {
|
||||
const sendUsers = isTestMode ? testUsers : telegramUsers;
|
||||
|
||||
for (let telegramUser of sendUsers) {
|
||||
try {
|
||||
const articles = await prisma.realEstateArticle.findMany({
|
||||
where: {
|
||||
isActive: true,
|
||||
@@ -47,7 +56,7 @@ async function sendTelegram() {
|
||||
});
|
||||
|
||||
if (articles.length === 0) {
|
||||
console.log("no articles");
|
||||
logWithTime("no articles");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -61,7 +70,14 @@ async function sendTelegram() {
|
||||
)})`
|
||||
);
|
||||
await unlink(excelFilePath);
|
||||
console.log("excel file deleted");
|
||||
logWithTime("excel file deleted");
|
||||
} catch (error) {
|
||||
errorWithTime(
|
||||
`❌ ${telegramUser.name}(${telegramUser.chatId}) 처리 실패:`,
|
||||
error
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,13 +48,13 @@ export const telegramUsers: TelegramUser[] = [
|
||||
phone: "010-6377-2069",
|
||||
realtorId: "namyeong00",
|
||||
},
|
||||
{
|
||||
site: "부동산써브",
|
||||
chatId: 6864925398,
|
||||
name: "박희영",
|
||||
phone: "010-5387-4521",
|
||||
realtorId: "namyeong00",
|
||||
},
|
||||
// {
|
||||
// site: "부동산써브",
|
||||
// chatId: 6864925398,
|
||||
// name: "박희영",
|
||||
// phone: "010-5387-4521",
|
||||
// realtorId: "namyeong00",
|
||||
// },
|
||||
{
|
||||
site: "부동산포스",
|
||||
chatId: 8155003662,
|
||||
|
||||
Reference in New Issue
Block a user