Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
- 新增六对成对迁移 000232–000237:H5 弹窗类型、退款结算标识与申请人备注、优先轮询事实字段与两个新终态、通道阈值命中留痕、手机号最近解绑人、提现资格校验留痕 - 退款:原因必填与申请人备注、来源支付与渠道流水冻结、线下处理流水号补录审计、按订单查询可选退款方式、企微审批材料补齐且新增字段缺失映射即明确失败 - 优先轮询:人工关闭、有效期到期独立周期任务、失败与过期人工重触发、事实字段与异常重试查询、资产解析端点只读投影 - 通道阈值:命中事实同事务留痕与命中记录查询;员工账单:列表筛选与详情投影;商户池:列表投影与统计周期语义;H5:弹窗类型与类别排序 - 手机号:有效关联数量与最近解绑人、短信验证码失败次数限制;导出:佣金明细十五列与报表序号列 - 时间筛选:三处新增筛选纳入统一严格解析契约,员工账单产生时间参数改名 - 同步 12 份主 Spec 需求、两端点与异步任务证据链,门禁 context-health 与 OpenSpec 校验通过
56 lines
4.4 KiB
Go
56 lines
4.4 KiB
Go
package model
|
||
|
||
import (
|
||
"time"
|
||
|
||
"gorm.io/gorm"
|
||
)
|
||
|
||
// CarrierTrafficThresholdLock 是「卡在某运营商计费周期内已触发通道流量阈值停机」的持久化事实。
|
||
//
|
||
// 一行表达一个 (carrier_id, card_id, period_start) 组合,由部分唯一索引保证至多一条:
|
||
// Status 表达整行生命周期(locked 进行中 / unlocked 已跨期解锁);StopStatus 与 ResumeStatus
|
||
// 分别表达停机与复机两个子任务;StopSubmittedAt/ResumeSubmittedAt 是提交认领字段,
|
||
// 由消费者以「字段为 NULL」条件更新取得至多一次的外部调用权;AnomalyFlag 与 FailureReason
|
||
// 承载查询窗口超期等需人工核对的结果。周期起点按触发时该运营商的 data_reset_day 计算,
|
||
// 换运营商后旧周期锁保留、新周期按新运营商的重置日另建一行。
|
||
type CarrierTrafficThresholdLock struct {
|
||
gorm.Model
|
||
CarrierID uint `gorm:"column:carrier_id;type:bigint;not null" json:"carrier_id"`
|
||
CardID uint `gorm:"column:card_id;type:bigint;not null" json:"card_id"`
|
||
PeriodStart time.Time `gorm:"column:period_start;type:timestamptz;not null" json:"period_start"`
|
||
Status string `gorm:"column:status;type:varchar(16);not null;default:'locked'" json:"status"`
|
||
StopStatus string `gorm:"column:stop_status;type:varchar(16);not null;default:'pending'" json:"stop_status"`
|
||
ResumeStatus string `gorm:"column:resume_status;type:varchar(16);not null;default:'pending'" json:"resume_status"`
|
||
StopSubmittedAt *time.Time `gorm:"column:stop_submitted_at;type:timestamptz" json:"stop_submitted_at,omitempty"`
|
||
ResumeSubmittedAt *time.Time `gorm:"column:resume_submitted_at;type:timestamptz" json:"resume_submitted_at,omitempty"`
|
||
StopIntegrationID string `gorm:"column:stop_integration_id;type:varchar(64);not null;default:''" json:"stop_integration_id"`
|
||
// ResumeIntegrationID 记录复机 Gateway 调用的 Integration Log 标识,便于人工核对。
|
||
ResumeIntegrationID string `gorm:"column:resume_integration_id;type:varchar(64);not null;default:''" json:"resume_integration_id"`
|
||
// AnomalyFlag 为 1 表示查询窗口超期或失败无法自动确认,必须退出自动扫描转人工核对。
|
||
AnomalyFlag int `gorm:"column:anomaly_flag;type:smallint;not null;default:0" json:"anomaly_flag"`
|
||
FailureReason string `gorm:"column:failure_reason;type:varchar(500);not null;default:''" json:"failure_reason"`
|
||
// HitTrafficMB 是命中时该卡当前计费周期的累计流量读数(MB)。
|
||
// 取与停机判定同一来源的运营商网关累计读数换算值,不使用本地用量统计或套餐真流量;
|
||
// 本次上线前的历史行为空,表示读数不可重建,读侧按「无」展示。
|
||
HitTrafficMB *float64 `gorm:"column:hit_traffic_mb;type:numeric(18,2)" json:"hit_traffic_mb,omitempty"`
|
||
// HitThresholdValue 是本次判定实际生效的通道阈值数值,冻结命中时值:
|
||
// 之后修改通道阈值不会改写历史命中;历史行为空。
|
||
HitThresholdValue *float64 `gorm:"column:hit_threshold_value;type:numeric(18,2)" json:"hit_threshold_value,omitempty"`
|
||
// HitThresholdUnit 是本次判定阈值的单位(MB/GB);空串表示历史行未记录。
|
||
HitThresholdUnit string `gorm:"column:hit_threshold_unit;type:varchar(8);not null;default:''" json:"hit_threshold_unit"`
|
||
// JudgedAt 是本次达量判定的时刻,既有行以创建时间回填,是命中记录查询与排序的业务时间。
|
||
JudgedAt time.Time `gorm:"column:judged_at;type:timestamptz;not null" json:"judged_at"`
|
||
// TriggerSource 是触发本次判定的流量观测来源(constants.CardObservationSource*);空串表示未记录。
|
||
TriggerSource string `gorm:"column:trigger_source;type:varchar(20);not null;default:''" json:"trigger_source"`
|
||
// UnlockedAt 是周期恢复时的解锁时间,只在跨期解锁成功时写入;绝不覆盖上面的命中事实。
|
||
UnlockedAt *time.Time `gorm:"column:unlocked_at;type:timestamptz" json:"unlocked_at,omitempty"`
|
||
// ResumeResult 是周期恢复的复机结果(resumed/skipped/manual);跳过原因沿用 FailureReason。
|
||
ResumeResult string `gorm:"column:resume_result;type:varchar(30);not null;default:''" json:"resume_result"`
|
||
}
|
||
|
||
// TableName 指定运营商通道流量阈值周期锁表名。
|
||
func (CarrierTrafficThresholdLock) TableName() string {
|
||
return "tb_carrier_traffic_threshold_lock"
|
||
}
|