package model import ( "time" "gorm.io/gorm" ) // EnterpriseCardAuthorization 企业卡授权模型 // 记录企业被授权可见的卡,卡的归属(owner)始终是代理商店铺 type EnterpriseCardAuthorization struct { gorm.Model BaseModel `gorm:"embedded"` EnterpriseID uint `gorm:"column:enterprise_id;index;not null;comment:企业ID" json:"enterprise_id"` IotCardID uint `gorm:"column:iot_card_id;index;not null;comment:IoT卡ID" json:"iot_card_id"` ShopID uint `gorm:"column:shop_id;index;not null;comment:店铺ID(授权方)" json:"shop_id"` AuthorizedBy uint `gorm:"column:authorized_by;not null;comment:授权人ID" json:"authorized_by"` AuthorizedAt *time.Time `gorm:"column:authorized_at;default:now();comment:授权时间" json:"authorized_at"` Status int `gorm:"column:status;type:int;default:1;comment:状态 1=有效 0=已回收" json:"status"` } func (EnterpriseCardAuthorization) TableName() string { return "tb_enterprise_card_authorization" }