mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-29 01:06:36 +08:00
优化操作系统和浏览器统计相关程序
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -40,6 +40,14 @@ var recordsTables = []*SQLRecordsTable{
|
||||
UniqueFields: []string{"name"},
|
||||
ExceptFields: []string{"customName", "customCodes"},
|
||||
},
|
||||
{
|
||||
TableName: "edgeFormalClientSystems",
|
||||
UniqueFields: []string{"dataId"},
|
||||
},
|
||||
{
|
||||
TableName: "edgeFormalClientBrowsers",
|
||||
UniqueFields: []string{"dataId"},
|
||||
},
|
||||
}
|
||||
|
||||
type sqlItem struct {
|
||||
|
||||
@@ -89,7 +89,7 @@ var upgradeFuncs = []*upgradeVersion{
|
||||
"0.5.6", upgradeV0_5_6,
|
||||
},
|
||||
{
|
||||
"0.5.7", upgradeV0_5_7,
|
||||
"0.5.8", upgradeV0_5_8,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
@@ -178,7 +179,7 @@ func upgradeV0_5_6(db *dbs.DB) error {
|
||||
}
|
||||
|
||||
// v0.5.7
|
||||
func upgradeV0_5_7(db *dbs.DB) error {
|
||||
func upgradeV0_5_8(db *dbs.DB) error {
|
||||
// node task versions
|
||||
{
|
||||
_, err := db.Exec("UPDATE edgeNodeTasks SET version=0 WHERE LENGTH(version)=19")
|
||||
@@ -187,5 +188,20 @@ func upgradeV0_5_7(db *dbs.DB) error {
|
||||
}
|
||||
}
|
||||
|
||||
// 删除操作系统和浏览器相关统计
|
||||
// 只删除当前月,避免因为数据过多阻塞
|
||||
{
|
||||
_, err := db.Exec("DELETE FROM edgeServerClientSystemMonthlyStats WHERE month=?", timeutil.Format("Ym"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
{
|
||||
_, err := db.Exec("DELETE FROM edgeServerClientBrowserMonthlyStats WHERE month=?", timeutil.Format("Ym"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user