This commit is contained in:
x2Skyz
2025-11-27 21:55:02 +07:00
parent f416b065e3
commit 8d112178d1
5 changed files with 251 additions and 4 deletions

View File

@@ -0,0 +1,32 @@
import { GeneralService } from '../share/generalservice.js'
import { getDTM } from '../utils/date.js'
export class SocketService {
constructor() {
this.generalService = new GeneralService()
}
getCurrentDTM() {
return getDTM()
}
// ตัวอย่างฟังก์ชันบันทึก Notification
async saveNotificationLog(database, fromUserSeq, toUserSeq, title, msg) {
// สมมติว่ามีตาราง comhtr
// ตรวจสอบก่อนว่ามีตารางไหม หรือข้ามไปถ้ายังไม่ได้สร้าง
/*
const sql = `
INSERT INTO ${database}.comhtr
(from_seq, to_seq, title, message, created_dtm)
VALUES ($1, $2, $3, $4, $5)
`
const params = [fromUserSeq, toUserSeq, title, msg, getDTM()]
await this.generalService.executeQueryParam(database, sql, params)
*/
// Demo: แค่ Log ไว้ก่อน
this.generalService.devhint(2, 'SocketService', `Saving Log DB: [${database}] From ${fromUserSeq} to ${toUserSeq}`)
return true
}
}