feat: Introduce core application structure, configuration, monitoring, and team management features.
This commit is contained in:
@@ -148,11 +148,11 @@ func HandleBanCheckSettings(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
settings := map[string]interface{}{
|
||||
"enabled": false,
|
||||
"interval": 1800, // 检查服务间隔(秒)
|
||||
"check_hours": 24, // 多少小时后重新检查
|
||||
"last_check": lastBanCheckTime,
|
||||
"task_state": banCheckTaskState,
|
||||
"enabled": false,
|
||||
"interval": 1800, // 检查服务间隔(秒)
|
||||
"check_hours": 24, // 多少小时后重新检查
|
||||
"last_check": lastBanCheckTime,
|
||||
"task_state": banCheckTaskState,
|
||||
"service_running": banCheckRunning,
|
||||
}
|
||||
|
||||
@@ -225,9 +225,9 @@ func HandleManualBanCheck(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
var req struct {
|
||||
IDs []int64 `json:"ids"` // 指定检查的母号 ID,为空则检查所有有效母号
|
||||
Concurrency int `json:"concurrency"` // 并发数
|
||||
ForceCheck bool `json:"force_check"` // 是否强制检查(忽略上次检查时间)
|
||||
IDs []int64 `json:"ids"` // 指定检查的母号 ID,为空则检查所有有效母号
|
||||
Concurrency int `json:"concurrency"` // 并发数
|
||||
ForceCheck bool `json:"force_check"` // 是否强制检查(忽略上次检查时间)
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
// 允许空 body
|
||||
@@ -315,10 +315,10 @@ func runBanCheckTask(owners []database.TeamOwner, concurrency int) {
|
||||
taskChan := make(chan database.TeamOwner, len(owners))
|
||||
var wg sync.WaitGroup
|
||||
|
||||
// 获取代理配置
|
||||
proxy := ""
|
||||
// 获取代理配置模式
|
||||
proxyStr := ""
|
||||
if config.Global != nil {
|
||||
proxy = config.Global.GetProxy()
|
||||
proxyStr = config.Global.GetProxy()
|
||||
}
|
||||
|
||||
// 启动 worker
|
||||
@@ -327,7 +327,9 @@ func runBanCheckTask(owners []database.TeamOwner, concurrency int) {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for owner := range taskChan {
|
||||
result := checkSingleOwnerBan(owner, proxy)
|
||||
// 每次循环重新解析代理,支持轮询
|
||||
resolvedProxy := database.Instance.ResolveProxy(proxyStr)
|
||||
result := checkSingleOwnerBan(owner, resolvedProxy)
|
||||
|
||||
// 更新计数
|
||||
atomic.AddInt32(&banCheckTaskState.Checked, 1)
|
||||
|
||||
Reference in New Issue
Block a user