31ea370cea
- 修复 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>
31 lines
1.3 KiB
Go
31 lines
1.3 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type FinanceRecord struct {
|
|
Base
|
|
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(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"`
|
|
RecordDate time.Time `gorm:"type:date" json:"record_date"`
|
|
CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"`
|
|
Remark string `gorm:"size:500" json:"remark"`
|
|
|
|
Partner *Partner `gorm:"foreignKey:PartnerID" json:"partner,omitempty"`
|
|
}
|
|
|
|
type NumberRule struct {
|
|
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"`
|
|
}
|