mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-23 15:00:25 +08:00
查询带宽统计时,自动调整开始和结束日期顺序
This commit is contained in:
@@ -396,6 +396,10 @@ func (this *ServerBandwidthStatDAO) FindMonthlyPercentile(tx *dbs.Tx, serverId i
|
|||||||
|
|
||||||
// FindPercentileBetweenDays 获取日期段内内百分位
|
// FindPercentileBetweenDays 获取日期段内内百分位
|
||||||
func (this *ServerBandwidthStatDAO) FindPercentileBetweenDays(tx *dbs.Tx, serverId int64, dayFrom string, dayTo string, percentile int32) (result *ServerBandwidthStat, err error) {
|
func (this *ServerBandwidthStatDAO) FindPercentileBetweenDays(tx *dbs.Tx, serverId int64, dayFrom string, dayTo string, percentile int32) (result *ServerBandwidthStat, err error) {
|
||||||
|
if dayFrom > dayTo {
|
||||||
|
dayFrom, dayTo = dayTo, dayFrom
|
||||||
|
}
|
||||||
|
|
||||||
if percentile <= 0 {
|
if percentile <= 0 {
|
||||||
percentile = 95
|
percentile = 95
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,10 @@ func (this *UserBandwidthStatDAO) FindUserPeekBandwidthInMonth(tx *dbs.Tx, userI
|
|||||||
|
|
||||||
// FindPercentileBetweenDays 获取日期段内内百分位
|
// FindPercentileBetweenDays 获取日期段内内百分位
|
||||||
func (this *UserBandwidthStatDAO) FindPercentileBetweenDays(tx *dbs.Tx, userId int64, dayFrom string, dayTo string, percentile int32) (result *UserBandwidthStat, err error) {
|
func (this *UserBandwidthStatDAO) FindPercentileBetweenDays(tx *dbs.Tx, userId int64, dayFrom string, dayTo string, percentile int32) (result *UserBandwidthStat, err error) {
|
||||||
|
if dayFrom > dayTo {
|
||||||
|
dayFrom, dayTo = dayTo, dayFrom
|
||||||
|
}
|
||||||
|
|
||||||
if percentile <= 0 {
|
if percentile <= 0 {
|
||||||
percentile = 95
|
percentile = 95
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user