mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-05 08:30:26 +08:00
实现API节点下载更新IP库、基本的分析函数
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
@@ -109,3 +111,20 @@ func (this *SysSettingDAO) CompareInt64Setting(code string, anotherValue int64)
|
||||
}
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
// 读取全局配置
|
||||
func (this *SysSettingDAO) ReadGlobalConfig() (*serverconfigs.GlobalConfig, error) {
|
||||
globalConfigData, err := this.ReadSetting(SettingCodeServerGlobalConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(globalConfigData) == 0 {
|
||||
return &serverconfigs.GlobalConfig{}, nil
|
||||
}
|
||||
config := &serverconfigs.GlobalConfig{}
|
||||
err = json.Unmarshal(globalConfigData, config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user