fix(backend): JWT config mapstructure tag 修复 + 模型从 hotel 重构为 shop
- 修复 JWTConfig 缺少 mapstructure tag 导致 access_expire_min 解析为 0, token 签发即过期,所有 API 请求返回 401 - 全部 config struct 补齐 mapstructure tag(secret/dsn/hmac_secret 等) - 模型层从 hotel/HotelID 统一重命名为 shop/ShopID - 删除旧 migrations(001-004),新增 001_init 综合迁移文件 - 更新 schema.sql、testutil、handler/service/model 相关引用 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,22 +14,22 @@ type Config struct {
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
Port string
|
||||
Mode string // debug | release
|
||||
Port string `mapstructure:"port"`
|
||||
Mode string `mapstructure:"mode"` // debug | release
|
||||
}
|
||||
|
||||
type DatabaseConfig struct {
|
||||
DSN string
|
||||
DSN string `mapstructure:"dsn"`
|
||||
}
|
||||
|
||||
type JWTConfig struct {
|
||||
Secret string
|
||||
AccessExpireMin int // Access Token 有效分钟数
|
||||
RefreshExpireH int // Refresh Token 有效小时数
|
||||
Secret string `mapstructure:"secret"`
|
||||
AccessExpireMin int `mapstructure:"access_expire_min"` // Access Token 有效分钟数
|
||||
RefreshExpireH int `mapstructure:"refresh_expire_h"` // Refresh Token 有效小时数
|
||||
}
|
||||
|
||||
type LicenseConfig struct {
|
||||
HMACSecret string // 许可证签名密钥
|
||||
HMACSecret string `mapstructure:"hmac_secret"` // 许可证签名密钥
|
||||
}
|
||||
|
||||
var C Config
|
||||
|
||||
Reference in New Issue
Block a user