mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-23 00:21:28 +00:00
feat(ui): update ui style
This commit is contained in:
parent
ca6dfd3f64
commit
47d7c9105b
35 changed files with 1577 additions and 591 deletions
|
|
@ -4,7 +4,7 @@ export interface MessageTracker {
|
|||
delete(eventId: string, targetId: string): Promise<void>;
|
||||
}
|
||||
|
||||
const MESSAGE_KEY_TTL_SECONDS = 604800;
|
||||
const MESSAGE_KEY_TTL_SECONDS = 86400;
|
||||
|
||||
export function kvMessageTracker(kv: KVNamespace): MessageTracker {
|
||||
const key = (eventId: string, targetId: string): string => `msg:${eventId}:${targetId}`;
|
||||
|
|
|
|||
|
|
@ -147,12 +147,20 @@ export async function getSendLogByDelivery(
|
|||
}
|
||||
}
|
||||
|
||||
export async function getFailedSendLog(db: D1Database, limit = 20): Promise<SendRecord[]> {
|
||||
export async function getFailedSendLog(
|
||||
db: D1Database,
|
||||
limit = 20,
|
||||
groupId?: string,
|
||||
): Promise<SendRecord[]> {
|
||||
try {
|
||||
const { results } = await db
|
||||
.prepare(`SELECT ${COLUMNS} FROM send_logs WHERE ok = 0 ORDER BY ts DESC LIMIT ?`)
|
||||
.bind(limit)
|
||||
.all<LogRow>();
|
||||
const stmt = groupId
|
||||
? db
|
||||
.prepare(
|
||||
`SELECT ${COLUMNS} FROM send_logs WHERE ok = 0 AND group_id = ? ORDER BY ts DESC LIMIT ?`,
|
||||
)
|
||||
.bind(groupId, limit)
|
||||
: db.prepare(`SELECT ${COLUMNS} FROM send_logs WHERE ok = 0 ORDER BY ts DESC LIMIT ?`).bind(limit);
|
||||
const { results } = await stmt.all<LogRow>();
|
||||
return results.map(toRecord);
|
||||
} catch (err) {
|
||||
log.warn({ err }, "Failed to load failed send log");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue