package model import ( "gorm.io/gorm" ) type Carrier struct { gorm.Model BaseModel `gorm:"embedded"` CarrierCode string `gorm:"column:carrier_code;type:varchar(50);uniqueIndex:idx_carrier_code,where:deleted_at IS NULL;not null;comment:运营商编码" json:"carrier_code"` CarrierName string `gorm:"column:carrier_name;type:varchar(100);not null;comment:运营商名称" json:"carrier_name"` CarrierType string `gorm:"column:carrier_type;type:varchar(20);not null;default:'CMCC';comment:运营商类型(CMCC/CUCC/CTCC/CBN)" json:"carrier_type"` Description string `gorm:"column:description;type:varchar(500);comment:运营商描述" json:"description"` Status int `gorm:"column:status;type:int;default:1;comment:状态 1-启用 0-禁用" json:"status"` RealnameLinkType string `gorm:"column:realname_link_type;type:varchar(20);not null;default:'none';comment:实名链接类型 none-不支持 template-模板URL gateway-Gateway接口" json:"realname_link_type"` RealnameLinkTemplate string `gorm:"column:realname_link_template;type:varchar(500);default:'';comment:实名链接模板URL" json:"realname_link_template"` DataResetDay int `gorm:"column:data_reset_day;type:int;not null;default:1;comment:上游流量重置日(1-28) 运营商每月清零网关计数器的日期" json:"data_reset_day"` // TrafficThresholdEnabled 是通道流量阈值开关,取值 0-未启用 1-已启用(ENG-STATE-001 启停语义)。 // 未启用时达量判定直接跳过;停用只停止后续新锁创建,不删除既有锁与历史任务结果。 TrafficThresholdEnabled int `gorm:"column:traffic_threshold_enabled;type:smallint;not null;default:0;comment:通道流量阈值是否启用 0-未启用 1-已启用" json:"traffic_threshold_enabled"` // TrafficThresholdValue 是阈值数值,单位由 TrafficThresholdUnit 决定,必须为正数;NULL 表示未配置。 TrafficThresholdValue *float64 `gorm:"column:traffic_threshold_value;type:numeric(18,2);comment:通道流量阈值数值,单位由 traffic_threshold_unit 决定" json:"traffic_threshold_value"` // TrafficThresholdUnit 是阈值单位,取值 MB/GB(1 GB = 1024 MB),换算后与网关累计读数同单位比较;空字符串表示未配置。 TrafficThresholdUnit string `gorm:"column:traffic_threshold_unit;type:varchar(8);not null;default:'';comment:通道流量阈值单位 MB/GB,空字符串-未配置" json:"traffic_threshold_unit"` } // TableName 指定表名 func (Carrier) TableName() string { return "tb_carrier" }