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:
@@ -2,20 +2,11 @@ package model
|
||||
|
||||
type User struct {
|
||||
TenantBase
|
||||
Username string `gorm:"size:50;uniqueIndex:uk_hotel_username" json:"username"`
|
||||
Username string `gorm:"size:50;uniqueIndex:uk_shop_username" json:"username"`
|
||||
PasswordHash string `gorm:"size:255" json:"-"`
|
||||
RealName string `gorm:"size:50" json:"real_name"`
|
||||
Phone string `gorm:"size:30" json:"phone"`
|
||||
Role string `gorm:"type:enum('admin','operator');default:'operator'" json:"role"`
|
||||
Role string `gorm:"type:enum('admin','operator','readonly');default:'operator'" json:"role"`
|
||||
IsActive bool `gorm:"default:true" json:"is_active"`
|
||||
CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"`
|
||||
}
|
||||
|
||||
type OAuthProvider struct {
|
||||
Base
|
||||
UserID uint64 `gorm:"not null;index" json:"user_id"`
|
||||
Provider string `gorm:"type:enum('wechat','google','apple')" json:"provider"`
|
||||
ProviderUserID string `gorm:"size:255" json:"provider_user_id"`
|
||||
AccessToken string `gorm:"type:text" json:"-"`
|
||||
RefreshToken string `gorm:"type:text" json:"-"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user