Files
junhong_cmp_fiber/internal/model/number_card.go
huang fba8e9e76b
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m18s
refactor(account): 移除卡类型字段、优化账号列表查询和权限检查
- 移除 IoT 卡和号卡的 card_type 字段(数据库迁移)
- 优化账号列表查询,支持按店铺和企业筛选
- 账号响应增加店铺名称和企业名称字段
- 实现批量加载店铺和企业名称,避免 N+1 查询
- 更新权限检查中间件,完善权限验证逻辑
- 更新相关测试用例,确保功能正确性
2026-02-03 10:59:44 +08:00

26 lines
1.2 KiB
Go

package model
import (
"gorm.io/gorm"
)
// NumberCard 号卡模型
// 完全独立的业务线,从上游平台下单
// 使用虚拟商品编码映射运营商订单
type NumberCard struct {
gorm.Model
BaseModel `gorm:"embedded"`
VirtualProductCode string `gorm:"column:virtual_product_code;type:varchar(100);uniqueIndex:idx_number_card_code,where:deleted_at IS NULL;not null;comment:虚拟商品编码(用于对应运营商订单)" json:"virtual_product_code"`
CardName string `gorm:"column:card_name;type:varchar(255);not null;comment:号卡名称" json:"card_name"`
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 int64 `gorm:"column:price;type:bigint;comment:价格(分为单位)" json:"price"`
AgentID uint `gorm:"column:agent_id;index;comment:代理用户ID" json:"agent_id"`
Status int `gorm:"column:status;type:int;default:1;not null;comment:状态 1-在售 2-下架" json:"status"`
}
// TableName 指定表名
func (NumberCard) TableName() string {
return "tb_number_card"
}