mirror of
https://github.com/tnb-labs/panel.git
synced 2026-09-01 14:55:12 +08:00
fix: Geo区域模式下数据重复
This commit is contained in:
@@ -239,17 +239,11 @@ func (r *websiteStatRepo) TopGeos(start, end string, sites []string, groupBy str
|
||||
|
||||
switch groupBy {
|
||||
case "region":
|
||||
q = q.Select("country, region, '' as city, SUM(requests) as requests, SUM(bandwidth) as bandwidth")
|
||||
q = q.Select("'' as country, region, '' as city, SUM(requests) as requests, SUM(bandwidth) as bandwidth")
|
||||
if country != "" {
|
||||
q = q.Where("country = ?", country)
|
||||
}
|
||||
q = q.Group("country, region")
|
||||
case "city":
|
||||
q = q.Select("country, region, city, SUM(requests) as requests, SUM(bandwidth) as bandwidth")
|
||||
if country != "" {
|
||||
q = q.Where("country = ?", country)
|
||||
}
|
||||
q = q.Group("country, region, city")
|
||||
q = q.Group("region")
|
||||
default: // country
|
||||
q = q.Select("country, '' as region, '' as city, SUM(requests) as requests, SUM(bandwidth) as bandwidth")
|
||||
q = q.Group("country")
|
||||
|
||||
Reference in New Issue
Block a user