将所有 IoT 相关的数据模型从 internal/iot/model/ 迁移到 internal/model/, 实现全局统一的模型层架构,符合项目横向分层设计原则。 变更内容: - 迁移 11 个 IoT 模型文件(carrier, iot_card, device, order, package 等) - 删除 internal/iot/model/ 目录 - 更新文档中的模型路径引用(25 处) - 创建重构总结文档 - 归档 OpenSpec 变更为 2026-01-12-refactor-iot-model-location - 创建 model-organization 规格文档 验证结果: - 编译通过(go build 成功) - 静态分析通过(go vet 无错误) - 代码格式通过(go fmt 无变更) - 无 Go 代码引用旧路径 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
26 lines
1.5 KiB
Go
26 lines
1.5 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// NumberCard 号卡模型
|
|
// 完全独立的业务线,从上游平台下单
|
|
// 使用虚拟商品编码映射运营商订单
|
|
type NumberCard struct {
|
|
ID uint `gorm:"column:id;primaryKey;comment:号卡ID" json:"id"`
|
|
VirtualProductCode string `gorm:"column:virtual_product_code;type:varchar(100);uniqueIndex;not null;comment:虚拟商品编码(用于对应运营商订单)" json:"virtual_product_code"`
|
|
CardName string `gorm:"column:card_name;type:varchar(255);not null;comment:号卡名称" json:"card_name"`
|
|
CardType string `gorm:"column:card_type;type:varchar(50);comment:号卡类型" json:"card_type"`
|
|
Carrier string `gorm:"column:carrier;type:varchar(50);comment:运营商" json:"carrier"`
|
|
DataAmountMB int64 `gorm:"column:data_amount_mb;type:bigint;comment:流量额度(MB)" json:"data_amount_mb"`
|
|
Price float64 `gorm:"column:price;type:decimal(10,2);comment:价格(元)" json:"price"`
|
|
AgentID uint `gorm:"column:agent_id;type:bigint;comment:代理用户ID" json:"agent_id"`
|
|
Status int `gorm:"column:status;type:int;default:1;not null;comment:状态 1-在售 2-下架" json:"status"`
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;comment:创建时间" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;comment:更新时间" json:"updated_at"`
|
|
}
|
|
|
|
// TableName 指定表名
|
|
func (NumberCard) TableName() string {
|
|
return "number_cards"
|
|
}
|