Files
junhong_cmp_fiber/internal/domain/carrierthreshold/hit.go
break 5ed6b39deb
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
feat(收口): 补齐 8 月迭代缺口并同步 Spec 与证据链
- 新增六对成对迁移 000232–000237:H5 弹窗类型、退款结算标识与申请人备注、优先轮询事实字段与两个新终态、通道阈值命中留痕、手机号最近解绑人、提现资格校验留痕
- 退款:原因必填与申请人备注、来源支付与渠道流水冻结、线下处理流水号补录审计、按订单查询可选退款方式、企微审批材料补齐且新增字段缺失映射即明确失败
- 优先轮询:人工关闭、有效期到期独立周期任务、失败与过期人工重触发、事实字段与异常重试查询、资产解析端点只读投影
- 通道阈值:命中事实同事务留痕与命中记录查询;员工账单:列表筛选与详情投影;商户池:列表投影与统计周期语义;H5:弹窗类型与类别排序
- 手机号:有效关联数量与最近解绑人、短信验证码失败次数限制;导出:佣金明细十五列与报表序号列
- 时间筛选:三处新增筛选纳入统一严格解析契约,员工账单产生时间参数改名
- 同步 12 份主 Spec 需求、两端点与异步任务证据链,门禁 context-health 与 OpenSpec 校验通过
2026-09-18 15:34:29 +08:00

52 lines
2.1 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 carrierthreshold
import "github.com/break/junhong_cmp_fiber/pkg/constants"
// TriggerSourceUnrecorded 表示命中来源未记录。
//
// 取值与 tb_carrier_traffic_threshold_lock.trigger_source 的 CHECK 允许的空串一致:
// 本次上线前的历史行与无法归类的观测来源都记为未记录,读侧按「无」展示。
const TriggerSourceUnrecorded = ""
// triggerSources 是 trigger_source 列 CHECK 允许的全部非空取值,与
// pkg/constants.CardObservationSource* 完全一致,两处必须同时演进。
var triggerSources = []string{
constants.CardObservationSourcePolling,
constants.CardObservationSourceManualSync,
constants.CardObservationSourceManualOverride,
constants.CardObservationSourceCarrierCallback,
constants.CardObservationSourceBusinessEvent,
}
// IsTriggerSource 判断取值是否为列约束允许的命中来源。
func IsTriggerSource(source string) bool {
for _, allowed := range triggerSources {
if source == allowed {
return true
}
}
return false
}
// SafeTriggerSource 把流量观测来源归一到列约束允许的取值集合。
//
// 命中事实与停机锁是同一条 INSERT来源列带 CHECK 约束:若把未归类的来源(上游新增观测来源而
// 本处枚举尚未同步原样写库INSERT 会因约束失败并回滚整个流量观测事务,等价于因留痕失败而
// 延迟停机。因此无法归类的来源一律记为「未记录」,停机事实与留痕写入都不会因此失败。
func SafeTriggerSource(source string) string {
if IsTriggerSource(source) {
return source
}
return TriggerSourceUnrecorded
}
// 周期恢复的复机结果取值,与 tb_carrier_traffic_threshold_lock.resume_result 的 CHECK 一致。
const (
// ResumeResultResumed 表示新周期条件满足、已发起复机;最终确认结果由 resume_status 承载。
ResumeResultResumed = "resumed"
// ResumeResultSkipped 表示新周期仅解锁、未发起复机,跳过原因写入既有失败原因列。
ResumeResultSkipped = "skipped"
// ResumeResultManual 表示周期归属不可判定,已按跨期语义解锁并转人工核对。
ResumeResultManual = "manual"
)