mirror of
https://github.com/woodchen-ink/random-api-go.git
synced 2025-07-18 13:52:02 +08:00
Compare commits
No commits in common. "main" and "v1.0.4" have entirely different histories.
@ -14,7 +14,7 @@
|
||||
|
||||
## 部署and讨论
|
||||
|
||||
<https://www.sunai.net/t/topic/127>
|
||||
<https://www.q58.club/t/topic/127>
|
||||
|
||||
## 许可证
|
||||
|
||||
|
@ -149,9 +149,9 @@ func (s *DomainStatsService) hasFileExtension(path string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// startPeriodicSave 启动定期保存任务(每1分钟保存一次)
|
||||
// startPeriodicSave 启动定期保存任务(每5分钟保存一次)
|
||||
func (s *DomainStatsService) startPeriodicSave() {
|
||||
ticker := time.NewTicker(1 * time.Minute)
|
||||
ticker := time.NewTicker(5 * time.Minute)
|
||||
defer ticker.Stop()
|
||||
|
||||
// 定期清理任务(每天执行一次)
|
||||
@ -287,11 +287,10 @@ func (s *DomainStatsService) GetTop24HourDomains() ([]model.DomainStatsResult, e
|
||||
})
|
||||
}
|
||||
|
||||
// 按访问次数降序排序,次数相同时按域名首字母排序
|
||||
// 按访问次数降序排序
|
||||
for i := 0; i < len(results)-1; i++ {
|
||||
for j := i + 1; j < len(results); j++ {
|
||||
if results[i].Count < results[j].Count ||
|
||||
(results[i].Count == results[j].Count && results[i].Domain > results[j].Domain) {
|
||||
if results[i].Count < results[j].Count {
|
||||
results[i], results[j] = results[j], results[i]
|
||||
}
|
||||
}
|
||||
@ -346,11 +345,10 @@ func (s *DomainStatsService) GetTopTotalDomains() ([]model.DomainStatsResult, er
|
||||
})
|
||||
}
|
||||
|
||||
// 按访问次数降序排序,次数相同时按域名首字母排序
|
||||
// 按访问次数降序排序
|
||||
for i := 0; i < len(results)-1; i++ {
|
||||
for j := i + 1; j < len(results); j++ {
|
||||
if results[i].Count < results[j].Count ||
|
||||
(results[i].Count == results[j].Count && results[i].Domain > results[j].Domain) {
|
||||
if results[i].Count < results[j].Count {
|
||||
results[i], results[j] = results[j], results[i]
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user