Files
NetworkAuth/models/card.go
2025-10-24 00:09:45 +08:00

28 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import (
"time"
)
// Card 卡密模型
// 用于存储和管理系统中的卡密信息,包括卡密号码、状态、使用情况等
type Card struct {
// ID主键自增
ID uint `gorm:"primaryKey;comment:卡密ID自增主键" json:"id"`
// CardNumber卡密号码唯一且非空
CardNumber string `gorm:"size:200;not null;comment:卡密号码(十六进制字符串)" json:"card_number"`
// CardTypeID所属卡密类型ID外键
CardTypeID uint `gorm:"not null;index;comment:所属卡密类型ID外键" json:"card_type_id"`
// Status状态0=未使用1=已使用2=禁用)
Status int `gorm:"default:0;not null;comment:状态0=未使用1=已使用2=禁用" json:"status"`
// Batch批次标识用于区分导入或生成批次
Batch string `gorm:"size:100;comment:批次标识" json:"batch"`
// Remark备注信息
Remark string `gorm:"size:255;comment:备注信息" json:"remark"`
// UsedAt使用时间未使用为NULL调整到创建时间前面以便前端展示顺序一致
UsedAt *time.Time `gorm:"comment:使用时间" json:"used_at"`
// CreatedAt/UpdatedAt时间字段
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
}