From 4bdf1ad7b49f3fa10469e789f323049ecc0212fc Mon Sep 17 00:00:00 2001 From: harid Date: Wed, 26 Nov 2025 16:48:35 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=89=E0=B8=9E=E0=B8=B2=E0=B8=B0?= =?UTF-8?q?=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87=20C-PM-1?= =?UTF-8?q?0=20=E0=B9=83=E0=B8=AB=E0=B9=89=E0=B8=95=E0=B8=B1=E0=B8=94=20pr?= =?UTF-8?q?ofilesNotiRequest=20=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B8=AA?= =?UTF-8?q?=E0=B9=88=E0=B8=87=20noti=20=E0=B8=84=E0=B8=A3=E0=B8=B1?= =?UTF-8?q?=E0=B9=89=E0=B8=87=E0=B9=81=E0=B8=A3=E0=B8=81=E0=B8=AD=E0=B8=AD?= =?UTF-8?q?=E0=B8=81=20=E0=B9=80=E0=B8=9E=E0=B8=A3=E0=B8=B2=E0=B8=B0=20UI?= =?UTF-8?q?=20=E0=B8=9B=E0=B8=B4=E0=B8=94=20Tab=20=E0=B8=99=E0=B8=B5?= =?UTF-8?q?=E0=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/rabbitmq.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index 74df4dc0..0c18117c 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -445,11 +445,6 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise isSendNotification: true, })) : []; - /*เฉพาะคำสั่ง C-PM-10 ให้ตัด receiverUserId ที่ส่ง noti ครั้งแรกออก*/ - if (command && command.commandType && ["C-PM-10"].includes(command.commandType.code)) { - const firstNotiIds = profiles.map((p:any) => p.receiverUserId); - profilesSend = profilesSend.filter((x:any) => !firstNotiIds.includes(x.receiverUserId)); - } const payloadStr = await PayloadSendNoti(command.id); const profilesSendRequest = new CallAPI() .PostData( @@ -479,7 +474,14 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise console.error("Full error object:", error); }); - await Promise.all([profilesNotiRequest, profilesSendRequest]); + /*เฉพาะคำสั่ง C-PM-10 ให้ตัด profilesNotiRequest ที่ส่ง noti ครั้งแรกออก*/ + if (command && command.commandType && ["C-PM-10"].includes(command.commandType.code)) { + await Promise.all([profilesSendRequest]); + } + else { + await Promise.all([profilesNotiRequest, profilesSendRequest]); + } + console.log("[AMQ] Send Notification Success"); return true;