From 657e55cde300123c56975e72f7a26260db8f05f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Tue, 22 Jul 2025 18:39:26 +0800 Subject: [PATCH] fix: Fix offline alert issue (#9608) --- agent/app/repo/alert.go | 7 +++++++ frontend/src/api/modules/alert.ts | 2 +- frontend/src/views/setting/alert/log/index.vue | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/agent/app/repo/alert.go b/agent/app/repo/alert.go index 5e37eba6e..0194387ca 100644 --- a/agent/app/repo/alert.go +++ b/agent/app/repo/alert.go @@ -20,6 +20,7 @@ type IAlertRepo interface { WithByCreateAt(date *date.Date) DBOption WithByLicenseId(licenseId string) DBOption WithByRecordId(recordId uint) DBOption + WithByMethod(method string) DBOption Create(alert *model.Alert) error Get(opts ...DBOption) (model.Alert, error) @@ -100,6 +101,12 @@ func (a *AlertRepo) WithByRecordId(recordId uint) DBOption { } } +func (a *AlertRepo) WithByMethod(method string) DBOption { + return func(g *gorm.DB) *gorm.DB { + return g.Where("method = ?", method) + } +} + func (a *AlertRepo) WithByCreateAt(createAt *date.Date) DBOption { return func(g *gorm.DB) *gorm.DB { return g.Where("DATE(created_at) = DATE(?)", createAt) diff --git a/frontend/src/api/modules/alert.ts b/frontend/src/api/modules/alert.ts index 33f447ca0..29c2b7600 100644 --- a/frontend/src/api/modules/alert.ts +++ b/frontend/src/api/modules/alert.ts @@ -69,5 +69,5 @@ export const SyncAlertAll = () => { }; export const SyncOfflineAlert = () => { - return http.post(`/xpack/core/alert/offline/sync`); + return http.post(`/core/xpack/alert/offline/sync`); }; diff --git a/frontend/src/views/setting/alert/log/index.vue b/frontend/src/views/setting/alert/log/index.vue index e3381c736..13f9db17a 100644 --- a/frontend/src/views/setting/alert/log/index.vue +++ b/frontend/src/views/setting/alert/log/index.vue @@ -125,7 +125,7 @@ const buttons = [ syncAlert(row); }, disabled: (row: Alert.AlertLog) => { - return row.status != 'PushSuccess' && row.status != 'SyncError'; + return row.method != 'sms' && row.status != 'PushSuccess' && row.status != 'SyncError'; }, }, ];