2026-08-28 15:06:01 +08:00
|
|
|
package config
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bj_power_mes/common/logx"
|
|
|
|
|
"bj_power_mes/internal/db"
|
|
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/stores/redis"
|
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Config 全局配置
|
|
|
|
|
type Config struct {
|
2026-08-28 17:03:03 +08:00
|
|
|
rest.RestConf // 自带 Host/Port 等
|
|
|
|
|
Database db.DatabaseConf
|
|
|
|
|
Redis RedisConfWrapper
|
|
|
|
|
Auth AuthConf
|
|
|
|
|
Internal InternalConf
|
|
|
|
|
Cli CliConf
|
|
|
|
|
Logger logx.LogConf
|
|
|
|
|
Wms WmsConf
|
|
|
|
|
Plc PlcConf
|
2026-08-31 08:06:55 +08:00
|
|
|
Upload UploadConf
|
2026-08-28 15:06:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RedisConfWrapper struct {
|
|
|
|
|
redis.RedisConf
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AuthConf 鉴权配置:JWT Secret / 有效期
|
2026-09-10 16:59:15 +08:00
|
|
|
// 只保留滑动续签:AccessExpire = 会话闲置窗口
|
2026-08-28 15:06:01 +08:00
|
|
|
type AuthConf struct {
|
2026-09-10 16:59:15 +08:00
|
|
|
AccessSecret string `json:",default=Hardman_2026"`
|
|
|
|
|
AccessExpire int64 `json:",default=3600"` // 会话闲置窗口(秒),滑动续签下 = 距最后请求多久后需重登
|
2026-08-28 15:06:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// InternalConf 内部服务间鉴权
|
|
|
|
|
type InternalConf struct {
|
|
|
|
|
Token string `json:",default=Hardman_2026"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-28 17:03:03 +08:00
|
|
|
// CliConf 命令行敏感操作门禁密码(与管理员账号密码保持一致,改密时自动同步)
|
|
|
|
|
type CliConf struct {
|
|
|
|
|
AdminPassword string `json:"AdminPassword,default=Hardman_2026"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-28 15:06:01 +08:00
|
|
|
// WmsConf WMS 内部服务地址
|
|
|
|
|
type WmsConf struct {
|
|
|
|
|
BaseURL string `json:",default="`
|
|
|
|
|
Token string `json:",default=Hardman_2026"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PlcConf PLC 对接配置(mock 时不用)
|
|
|
|
|
type PlcConf struct {
|
2026-08-28 17:03:03 +08:00
|
|
|
Enable bool `json:",default=false"`
|
|
|
|
|
Host string `json:",default=127.0.0.1"`
|
|
|
|
|
Port int `json:",default=102"`
|
|
|
|
|
}
|
2026-08-31 08:06:55 +08:00
|
|
|
|
|
|
|
|
// UploadConf 工艺图纸 PDF / 巡检照片 等文件上传目录
|
|
|
|
|
type UploadConf struct {
|
|
|
|
|
Dir string `json:",default=uploads"`
|
|
|
|
|
MaxMB int64 `json:",default=20"`
|
|
|
|
|
}
|