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:
wangjia
2026-04-07 22:20:12 +08:00
parent 37112d6599
commit 31ea370cea
50 changed files with 2675 additions and 951 deletions
+10 -10
View File
@@ -4,11 +4,11 @@ import "time"
type FinanceRecord struct {
Base
HotelID uint64 `gorm:"not null;index" json:"hotel_id"`
ShopID uint64 `gorm:"not null;index" json:"shop_id"`
PartnerID *uint64 `json:"partner_id"`
Type string `gorm:"type:enum('receivable','payable','receipt','payment')" json:"type"`
Amount float64 `gorm:"type:decimal(14,2)" json:"amount"`
Balance float64 `gorm:"type:decimal(14,2)" json:"balance"`
Amount float64 `gorm:"type:decimal(16,2)" json:"amount"`
Balance float64 `gorm:"type:decimal(16,2)" json:"balance"`
RefType string `gorm:"size:30" json:"ref_type"`
RefID *uint64 `json:"ref_id"`
OperatorID uint64 `gorm:"not null" json:"operator_id"`
@@ -20,11 +20,11 @@ type FinanceRecord struct {
}
type NumberRule struct {
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
HotelID uint64 `gorm:"not null;uniqueIndex:uk_hotel_type" json:"hotel_id"`
Type string `gorm:"size:30;uniqueIndex:uk_hotel_type" json:"type"`
Prefix string `gorm:"size:20;default:''" json:"prefix"`
CurrentNo int `gorm:"default:0" json:"current_no"`
DateFormat string `gorm:"size:20;default:'YYYYMMDD'" json:"date_format"`
UpdatedAt time.Time `json:"updated_at"`
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
ShopID uint64 `gorm:"not null;uniqueIndex:uk_shop_type" json:"shop_id"`
Type string `gorm:"size:30;uniqueIndex:uk_shop_type" json:"type"`
Prefix string `gorm:"size:20;default:''" json:"prefix"`
CurrentNo int `gorm:"default:0" json:"current_no"`
DateFormat string `gorm:"size:20;default:'YYYYMMDD'" json:"date_format"`
UpdatedAt time.Time `json:"updated_at"`
}