From 814a2956b3194c75cce56fad2cf889d714937cb2 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 13 Apr 2026 14:48:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=BD=AE=E8=AF=A2?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=A7=A6=E5=8F=91=E9=85=8D=E7=BD=AE=EF=BC=88?= =?UTF-8?q?EnableAutoTrigger=E3=80=81AutoTriggerSystemUserID=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/config/config.go | 33 ++++++++++++++++++++++----------- pkg/config/defaults/config.yaml | 5 +++++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 8e669f7..86b5637 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -13,17 +13,18 @@ var globalConfig atomic.Pointer[Config] // Config 应用配置 type Config struct { - Server ServerConfig `mapstructure:"server"` - Redis RedisConfig `mapstructure:"redis"` - Database DatabaseConfig `mapstructure:"database"` - Queue QueueConfig `mapstructure:"queue"` - Logging LoggingConfig `mapstructure:"logging"` - Middleware MiddlewareConfig `mapstructure:"middleware"` - SMS SMSConfig `mapstructure:"sms"` - JWT JWTConfig `mapstructure:"jwt"` - DefaultAdmin DefaultAdminConfig `mapstructure:"default_admin"` - Storage StorageConfig `mapstructure:"storage"` - Gateway GatewayConfig `mapstructure:"gateway"` + Server ServerConfig `mapstructure:"server"` + Redis RedisConfig `mapstructure:"redis"` + Database DatabaseConfig `mapstructure:"database"` + Queue QueueConfig `mapstructure:"queue"` + Logging LoggingConfig `mapstructure:"logging"` + Middleware MiddlewareConfig `mapstructure:"middleware"` + SMS SMSConfig `mapstructure:"sms"` + JWT JWTConfig `mapstructure:"jwt"` + DefaultAdmin DefaultAdminConfig `mapstructure:"default_admin"` + Storage StorageConfig `mapstructure:"storage"` + Gateway GatewayConfig `mapstructure:"gateway"` + PollingAutoTrigger PollingAutoTriggerConfig `mapstructure:"polling_auto_trigger"` } // ServerConfig HTTP 服务器配置 @@ -139,6 +140,16 @@ type GatewayConfig struct { Timeout int `mapstructure:"timeout"` // 超时时间(秒) } +// PollingAutoTriggerConfig 轮询自动触发配置 +type PollingAutoTriggerConfig struct { + // EnableAutoTrigger 是否启用C端实名自动触发 + // 环境变量:JUNHONG_POLLING_AUTO_TRIGGER_ENABLE_AUTO_TRIGGER + EnableAutoTrigger bool `mapstructure:"enable_auto_trigger"` + // AutoTriggerSystemUserID 自动触发使用的系统用户ID(暂用 SuperAdmin ID=1) + // 环境变量:JUNHONG_POLLING_AUTO_TRIGGER_AUTO_TRIGGER_SYSTEM_USER_ID + AutoTriggerSystemUserID int `mapstructure:"auto_trigger_system_user_id"` +} + // S3Config S3 兼容存储配置 type S3Config struct { Endpoint string `mapstructure:"endpoint"` // 服务端点(如:http://obs-helf.cucloud.cn) diff --git a/pkg/config/defaults/config.yaml b/pkg/config/defaults/config.yaml index 3eac6dd..0895fe5 100644 --- a/pkg/config/defaults/config.yaml +++ b/pkg/config/defaults/config.yaml @@ -116,3 +116,8 @@ gateway: app_secret: "BZeQttaZQt0i73moF" timeout: 30 +# 轮询自动触发配置 +polling_auto_trigger: + enable_auto_trigger: true + auto_trigger_system_user_id: 1 # 暂用 SuperAdmin,生产环境建议创建专用平台账号并更新此值 +