mirror of
https://gitee.com/fit2cloud-feizhiyun/1Panel.git
synced 2024-12-05 21:38:26 +08:00
feat: 增加短信告警功能 (#6184)
This commit is contained in:
parent
7901c26d32
commit
e770254b65
@ -50,7 +50,6 @@ func (w WebsiteSSLRepo) WithByCAID(caID uint) DBOption {
|
||||
return db.Where("ca_id = ?", caID)
|
||||
}
|
||||
}
|
||||
|
||||
func (w WebsiteSSLRepo) Page(page, size int, opts ...DBOption) (int64, []model.WebsiteSSL, error) {
|
||||
var sslList []model.WebsiteSSL
|
||||
db := getDb(opts...).Model(&model.WebsiteSSL{})
|
||||
|
11
backend/constant/alert.go
Normal file
11
backend/constant/alert.go
Normal file
@ -0,0 +1,11 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
AlertEnable = "Enable"
|
||||
AlertDisable = "Disable"
|
||||
AlertSuccess = "Success"
|
||||
AlertError = "Error"
|
||||
AlertSyncError = "SyncError"
|
||||
AlertPushError = "PushError"
|
||||
AlertPushSuccess = "PushSuccess"
|
||||
)
|
@ -95,7 +95,7 @@ var (
|
||||
ErrPathNotFound = "ErrPathNotFound"
|
||||
ErrMovePathFailed = "ErrMovePathFailed"
|
||||
ErrLinkPathNotFound = "ErrLinkPathNotFound"
|
||||
ErrFileIsExist = "ErrFileIsExist"
|
||||
ErrFileIsExist = "ErrFileIsExist"
|
||||
ErrFileUpload = "ErrFileUpload"
|
||||
ErrFileDownloadDir = "ErrFileDownloadDir"
|
||||
ErrCmdNotFound = "ErrCmdNotFound"
|
||||
@ -162,3 +162,12 @@ var (
|
||||
ErrLicenseSave = "ErrLicenseSave"
|
||||
ErrLicenseSync = "ErrLicenseSync"
|
||||
)
|
||||
|
||||
// alert
|
||||
var (
|
||||
ErrAlert = "ErrAlert"
|
||||
ErrAlertPush = "ErrAlertPush"
|
||||
ErrAlertSave = "ErrAlertSave"
|
||||
ErrAlertSync = "ErrAlertSync"
|
||||
ErrAlertRemote = "ErrAlertRemote"
|
||||
)
|
||||
|
@ -196,3 +196,11 @@ ErrLicenseSync: "Failed to sync license information, no license information dete
|
||||
ErrXpackNotFound: "This section is a professional edition feature, please import the license first in Panel Settings-License interface"
|
||||
ErrXpackNotActive: "This section is a professional edition feature, please synchronize the license status first in Panel Settings-License interface"
|
||||
ErrXpackOutOfDate: "The current license has expired, please re-import the license in Panel Settings-License interface"
|
||||
|
||||
|
||||
#license
|
||||
ErrAlert: "Alert information format error, please check and try again!"
|
||||
ErrAlertPush: "Alert push error, please check and try again!"
|
||||
ErrAlertSave: "Alert save error, please check and try again!"
|
||||
ErrAlertSync: "Alert sync error, please check and try again!"
|
||||
ErrAlertRemote: "Remote alert error, please check and try again!"
|
@ -198,3 +198,10 @@ ErrLicenseSync: "許可證信息同步失敗,資料庫中未檢測到許可證
|
||||
ErrXpackNotFound: "該部分為專業版功能,請先在 面板設置-許可證 界面導入許可證"
|
||||
ErrXpackNotActive: "該部分為專業版功能,請先在 面板設置-許可證 界面同步許可證狀態"
|
||||
ErrXpackOutOfDate: "當前許可證已過期,請重新在 面板設置-許可證 界面導入許可證"
|
||||
|
||||
#license
|
||||
ErrAlert: "告警資訊格式錯誤,請檢查後重試!"
|
||||
ErrAlertPush: "告警資訊推送錯誤,請檢查後重試!"
|
||||
ErrAlertSave: "告警資訊保存錯誤,請檢查後重試!"
|
||||
ErrAlertSync: "告警資訊同步錯誤,請檢查後重試!"
|
||||
ErrAlertRemote: "告警資訊遠端錯誤,請檢查後重試!"
|
||||
|
@ -200,3 +200,10 @@ ErrXpackNotFound: "该部分为专业版功能,请先在 面板设置-许可
|
||||
ErrXpackNotActive: "该部分为专业版功能,请先在 面板设置-许可证 界面同步许可证状态"
|
||||
ErrXpackOutOfDate: "当前许可证已过期,请重新在 面板设置-许可证 界面导入许可证"
|
||||
|
||||
#license
|
||||
ErrAlert: "告警信息格式错误,请检查后重试!"
|
||||
ErrAlertPush: "告警信息推送错误,请检查后重试!"
|
||||
ErrAlertSave: "告警信息保存错误,请检查后重试!"
|
||||
ErrAlertSync: "告警信息同步错误,请检查后重试!"
|
||||
ErrAlertRemote: "告警信息远端错误,请检查后重试!"
|
||||
|
||||
|
@ -93,6 +93,7 @@ func Init() {
|
||||
migrations.AddShellColumn,
|
||||
migrations.AddClam,
|
||||
migrations.AddClamStatus,
|
||||
migrations.AddAlertMenu,
|
||||
})
|
||||
if err := m.Migrate(); err != nil {
|
||||
global.LOG.Error(err)
|
||||
|
@ -288,3 +288,29 @@ var AddClamStatus = &gormigrate.Migration{
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var AddAlertMenu = &gormigrate.Migration{
|
||||
ID: "20240706-update-xpack-hide-menu",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
var (
|
||||
setting model.Setting
|
||||
menu dto.XpackHideMenu
|
||||
)
|
||||
tx.Model(&model.Setting{}).Where("key", "XpackHideMenu").First(&setting)
|
||||
if err := json.Unmarshal([]byte(setting.Value), &menu); err != nil {
|
||||
return err
|
||||
}
|
||||
menu.Children = append(menu.Children, dto.XpackHideMenu{
|
||||
ID: "7",
|
||||
Title: "xpack.alert.alert",
|
||||
Path: "/xpack/alert/dashboard",
|
||||
Label: "XAlertDashboard",
|
||||
IsCheck: true,
|
||||
})
|
||||
data, err := json.Marshal(menu)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Model(&model.Setting{}).Where("key", "XpackHideMenu").Updates(map[string]interface{}{"value": string(data)}).Error
|
||||
},
|
||||
}
|
||||
|
@ -1681,6 +1681,7 @@ const message = {
|
||||
'Upgrading to the professional version allows customization of panel logo, welcome message, and other information.',
|
||||
monitor:
|
||||
'Upgrade to the professional version to view the real-time status of the website, visitor trends, visitor sources, request logs and other information. ',
|
||||
alert: 'Upgrading to the professional version allows you to receive alarm information via SMS.',
|
||||
},
|
||||
clean: {
|
||||
scan: 'Start Scanning',
|
||||
|
@ -1562,6 +1562,7 @@ const message = {
|
||||
gpu: '升級專業版可以幫助用戶實時直觀查看到 GPU 的工作負載、溫度、顯存等重要參數。',
|
||||
setting: '升級專業版可以自定義面板 Logo、歡迎簡介等信息。',
|
||||
monitor: '升級專業版可以查看網站的即時狀態、訪客趨勢、訪客來源、請求日誌等資訊。 ',
|
||||
alert: '升級專業版可以簡訊接收告警資訊等。',
|
||||
},
|
||||
clean: {
|
||||
scan: '開始掃描',
|
||||
|
@ -1564,6 +1564,7 @@ const message = {
|
||||
gpu: '升级专业版可以帮助用户实时直观查看到 GPU 的工作负载、温度、显存等重要参数。',
|
||||
setting: '升级专业版可以自定义面板 Logo、欢迎简介等信息。',
|
||||
monitor: '升级专业版可以查看网站的实时状态、访客趋势、访客来源、请求日志等信息。',
|
||||
alert: '升级专业版可以短信接收告警信息等。',
|
||||
},
|
||||
clean: {
|
||||
scan: '开始扫描',
|
||||
|
Loading…
Reference in New Issue
Block a user