2021-04-17 23:36:37 +08:00
|
|
|
package model
|
|
|
|
|
|
|
|
type ServiceItemResponse struct {
|
2021-09-02 23:45:21 +08:00
|
|
|
Monitor *Monitor
|
2021-04-17 23:36:37 +08:00
|
|
|
CurrentUp uint64
|
|
|
|
CurrentDown uint64
|
2022-05-02 10:33:21 +08:00
|
|
|
TotalUp uint64
|
|
|
|
TotalDown uint64
|
2021-04-17 23:36:37 +08:00
|
|
|
Delay *[30]float32
|
|
|
|
Up *[30]int
|
|
|
|
Down *[30]int
|
|
|
|
}
|
2022-05-02 00:45:03 +08:00
|
|
|
|
2022-05-02 10:33:21 +08:00
|
|
|
func (r ServiceItemResponse) TotalUptime() float32 {
|
|
|
|
if r.TotalUp+r.TotalDown == 0 {
|
2022-05-02 00:45:03 +08:00
|
|
|
return 0
|
|
|
|
}
|
2022-05-02 10:33:21 +08:00
|
|
|
return float32(r.TotalUp) / (float32(r.TotalUp + r.TotalDown)) * 100
|
2022-05-02 00:45:03 +08:00
|
|
|
}
|