mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-05 07:56:50 +08:00
support push choice
This commit is contained in:
@@ -31,3 +31,8 @@ func (p *pushRepository) DeletePushConfig(id int) error {
|
|||||||
Id: int64(id),
|
Id: int64(id),
|
||||||
}).Error
|
}).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *pushRepository) GetPushConfigByIds(ids []int) (result []model.Push) {
|
||||||
|
db.Model(&model.Push{}).Where("id in ?", ids).Find(&result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@@ -56,6 +56,7 @@ type ProcessBase struct {
|
|||||||
statuPush bool
|
statuPush bool
|
||||||
logReport bool
|
logReport bool
|
||||||
cgroupEnable bool
|
cgroupEnable bool
|
||||||
|
PushIds []int
|
||||||
memoryLimit *float32
|
memoryLimit *float32
|
||||||
cpuLimit *float32
|
cpuLimit *float32
|
||||||
}
|
}
|
||||||
@@ -240,7 +241,7 @@ func (p *ProcessBase) push(message string) {
|
|||||||
"{$message}": message,
|
"{$message}": message,
|
||||||
"{$status}": strconv.Itoa(int(p.State.State)),
|
"{$status}": strconv.Itoa(int(p.State.State)),
|
||||||
}
|
}
|
||||||
PushService.Push(messagePlaceholders)
|
PushService.Push(p.Config.PushIds, messagePlaceholders)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,8 +13,8 @@ type pushService struct{}
|
|||||||
|
|
||||||
var PushService = new(pushService)
|
var PushService = new(pushService)
|
||||||
|
|
||||||
func (p *pushService) Push(placeholders map[string]string) {
|
func (p *pushService) Push(ids []int, placeholders map[string]string) {
|
||||||
pl := repository.PushRepository.GetPushList()
|
pl := repository.PushRepository.GetPushConfigByIds(ids)
|
||||||
for _, v := range pl {
|
for _, v := range pl {
|
||||||
if v.Enable {
|
if v.Enable {
|
||||||
if v.Method == http.MethodGet {
|
if v.Method == http.MethodGet {
|
||||||
|
Reference in New Issue
Block a user