Files
junhong_cmp_fiber/internal/model/carrier.go
break 59b3df868a
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 12m59s
feat(通道流量阈值): AUG26-011 运营商通道流量阈值达量停机与周期复机
2026-09-16 15:54:49 +08:00

31 lines
2.5 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 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/GB1 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"
}