From d7ade821f49a74da64809c0d74e551852beeb392 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 31 Mar 2026 18:11:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=20carrier=20=E8=A1=A8?= =?UTF-8?q?=20billing=5Fday=20=E5=AD=97=E6=AE=B5=EF=BC=88=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=20+=20=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- internal/model/carrier.go | 1 - migrations/000100_remove_carrier_billing_day.down.sql | 3 +++ migrations/000100_remove_carrier_billing_day.up.sql | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 migrations/000100_remove_carrier_billing_day.down.sql create mode 100644 migrations/000100_remove_carrier_billing_day.up.sql diff --git a/internal/model/carrier.go b/internal/model/carrier.go index da36df3..9f5bdfb 100644 --- a/internal/model/carrier.go +++ b/internal/model/carrier.go @@ -12,7 +12,6 @@ type Carrier struct { 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"` - BillingDay int `gorm:"column:billing_day;type:int;default:1;comment:运营商计费日(用于流量查询接口的计费周期计算,联通=27,其他=1)" json:"billing_day"` 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"` diff --git a/migrations/000100_remove_carrier_billing_day.down.sql b/migrations/000100_remove_carrier_billing_day.down.sql new file mode 100644 index 0000000..8fb2c45 --- /dev/null +++ b/migrations/000100_remove_carrier_billing_day.down.sql @@ -0,0 +1,3 @@ +-- 回滚:恢复 billing_day 字段 +ALTER TABLE tb_carrier ADD COLUMN IF NOT EXISTS billing_day INT DEFAULT 1; +COMMENT ON COLUMN tb_carrier.billing_day IS '运营商计费日(用于流量查询接口的计费周期计算,联通=27,其他=1)'; diff --git a/migrations/000100_remove_carrier_billing_day.up.sql b/migrations/000100_remove_carrier_billing_day.up.sql new file mode 100644 index 0000000..922da27 --- /dev/null +++ b/migrations/000100_remove_carrier_billing_day.up.sql @@ -0,0 +1,4 @@ +-- 删除运营商计费日字段 +-- billing_day 从未被业务代码引用,实际使用的是 data_reset_day(网关重置日) +-- 两个字段功能重叠且 billing_day 从未被实际使用,故删除以清理表结构 +ALTER TABLE tb_carrier DROP COLUMN IF EXISTS billing_day;