服务流量接口增加5分钟查询接口

This commit is contained in:
GoEdgeLab
2022-09-24 18:36:27 +08:00
parent 7db5a8174e
commit 1fa071babc
2 changed files with 48 additions and 0 deletions

View File

@@ -437,6 +437,22 @@ func (this *ServerDailyStatDAO) FindDailyStats(tx *dbs.Tx, serverId int64, dayFr
return
}
// FindStatsWithDay 按天查找5分钟级统计
// day YYYYMMDD
func (this *ServerDailyStatDAO) FindStatsWithDay(tx *dbs.Tx, serverId int64, day string) (result []*ServerDailyStat, err error) {
if !regexp.MustCompile(`^\d{8}$`).MatchString(day) {
return
}
_, err = this.Query(tx).
Attr("serverId", serverId).
Attr("day", day).
AscPk().
Slice(&result).
FindAll()
return
}
// FindMonthlyStatsWithPlan 查找某月有套餐的流量
// month YYYYMM
func (this *ServerDailyStatDAO) FindMonthlyStatsWithPlan(tx *dbs.Tx, month string) (result []*ServerDailyStat, err error) {