修复通道提取接口权限与数据映射问题
This commit is contained in:
@@ -11,11 +11,13 @@ import (
|
||||
e "platform/web/events"
|
||||
g "platform/web/globals"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
s "platform/web/services"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hibiken/asynq"
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
func HandleCompleteTrade(_ context.Context, task *asynq.Task) (err error) {
|
||||
@@ -58,7 +60,7 @@ func HandleRemoveChannel(_ context.Context, task *asynq.Task) (err error) {
|
||||
}
|
||||
|
||||
func HandleFlushGateway(_ context.Context, task *asynq.Task) (err error) {
|
||||
now := time.Now()
|
||||
start := time.Now()
|
||||
|
||||
// 获取所有网关:配置组
|
||||
proxies, err := s.Proxy.AllProxies(m.ProxyTypeBaiYin, true)
|
||||
@@ -120,16 +122,26 @@ func HandleFlushGateway(_ context.Context, task *asynq.Task) (err error) {
|
||||
}
|
||||
|
||||
if env.DebugExternalChange {
|
||||
g.Cloud.CloudConnect(g.CloudConnectReq{
|
||||
err := g.Cloud.CloudConnect(g.CloudConnectReq{
|
||||
Uuid: proxy.Mac,
|
||||
AutoConfig: configs,
|
||||
})
|
||||
if err != nil {
|
||||
slog.Error("提交代理后备配置失败", "error", err)
|
||||
}
|
||||
} else {
|
||||
bytes, _ := json.Marshal(configs)
|
||||
slog.Debug("更新代理后备配置", "config", string(bytes))
|
||||
}
|
||||
|
||||
_, err := q.Proxy.
|
||||
Where(q.Proxy.ID.Eq(proxy.ID)).
|
||||
UpdateSimple(q.Proxy.Meta.Value(datatypes.NewJSONType(configs)))
|
||||
if err != nil {
|
||||
slog.Error("更新代理后备配置失败", "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
slog.Debug("更新代理后备配置", "time", time.Since(now).String())
|
||||
slog.Debug("更新代理后备配置", "time", time.Since(start).String())
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user