Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
- 新增六对成对迁移 000232–000237:H5 弹窗类型、退款结算标识与申请人备注、优先轮询事实字段与两个新终态、通道阈值命中留痕、手机号最近解绑人、提现资格校验留痕 - 退款:原因必填与申请人备注、来源支付与渠道流水冻结、线下处理流水号补录审计、按订单查询可选退款方式、企微审批材料补齐且新增字段缺失映射即明确失败 - 优先轮询:人工关闭、有效期到期独立周期任务、失败与过期人工重触发、事实字段与异常重试查询、资产解析端点只读投影 - 通道阈值:命中事实同事务留痕与命中记录查询;员工账单:列表筛选与详情投影;商户池:列表投影与统计周期语义;H5:弹窗类型与类别排序 - 手机号:有效关联数量与最近解绑人、短信验证码失败次数限制;导出:佣金明细十五列与报表序号列 - 时间筛选:三处新增筛选纳入统一严格解析契约,员工账单产生时间参数改名 - 同步 12 份主 Spec 需求、两端点与异步任务证据链,门禁 context-health 与 OpenSpec 校验通过
73 lines
3.7 KiB
Go
73 lines
3.7 KiB
Go
package model
|
||
|
||
import (
|
||
"database/sql/driver"
|
||
"time"
|
||
|
||
"github.com/bytedance/sonic"
|
||
)
|
||
|
||
// H5PopupConfiguration 是 H5 运营弹窗全局配置的 PostgreSQL 持久化事实。
|
||
// 配置只决定后续投放:启停与有效期不删除行,停用走 Enabled 置 0;
|
||
// Version 是配置版本而非乐观锁,更新事务内递增并参与频率去重键,旧版本通知保留原快照不被改写。
|
||
// 范围四维统一用 JSONB 字符串数组:空数组表示该维度未配置即全量,已配置而资产该维度无值时不命中。
|
||
type H5PopupConfiguration struct {
|
||
ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||
Title string `gorm:"column:title;type:varchar(100);not null" json:"title"`
|
||
Content string `gorm:"column:content;type:varchar(2000);not null" json:"content"`
|
||
// PopupType 是运营弹窗类型(套餐政策推广/通用公告),必填单选。
|
||
// 它决定候选排序的第一顺位类别,类别顺序由查询侧的显式排序表达式表达,不依赖取值字典序。
|
||
PopupType string `gorm:"column:popup_type;type:varchar(20);not null;default:'announcement'" json:"popup_type"`
|
||
Pages StringJSONBArray `gorm:"column:pages;type:jsonb;not null;default:'[]'" json:"pages"`
|
||
ShopIDs StringJSONBArray `gorm:"column:shop_ids;type:jsonb;not null;default:'[]'" json:"shop_ids"`
|
||
DeviceTypes StringJSONBArray `gorm:"column:device_types;type:jsonb;not null;default:'[]'" json:"device_types"`
|
||
CardTypes StringJSONBArray `gorm:"column:card_types;type:jsonb;not null;default:'[]'" json:"card_types"`
|
||
Priority int `gorm:"column:priority;type:integer;not null;default:0" json:"priority"`
|
||
Frequency string `gorm:"column:frequency;type:varchar(20);not null;default:'once'" json:"frequency"`
|
||
ActionType string `gorm:"column:action_type;type:varchar(40);not null;default:''" json:"action_type"`
|
||
Enabled int `gorm:"column:enabled;type:smallint;not null;default:0" json:"enabled"`
|
||
StartsAt time.Time `gorm:"column:starts_at;type:timestamptz;not null" json:"starts_at"`
|
||
EndsAt time.Time `gorm:"column:ends_at;type:timestamptz;not null" json:"ends_at"`
|
||
Version int64 `gorm:"column:version;type:bigint;not null;default:1" json:"version"`
|
||
BaseModel `gorm:"embedded"`
|
||
CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null;autoCreateTime" json:"created_at"`
|
||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null;autoUpdateTime" json:"updated_at"`
|
||
}
|
||
|
||
// TableName 返回 H5 运营弹窗配置表名。
|
||
func (H5PopupConfiguration) TableName() string {
|
||
return "tb_h5_popup_configuration"
|
||
}
|
||
|
||
// NotificationPopupSnapshot 是弹窗投放通知冻结的投放快照,作为可空 JSONB 写入 tb_notification。
|
||
// 只承载配置标识与受控动作,不含任何 URL 或前端路由;风险换卡弹窗没有配置,ConfigID 与 ConfigVersion 为 0。
|
||
type NotificationPopupSnapshot struct {
|
||
ConfigID uint `json:"config_id"`
|
||
ConfigVersion int64 `json:"config_version"`
|
||
AssetType string `json:"asset_type"`
|
||
AssetID uint `json:"asset_id"`
|
||
ActionType string `json:"action_type"`
|
||
}
|
||
|
||
// Value 将弹窗快照序列化为 JSONB;nil 接收者写入 NULL,供非弹窗通知保持该列为空。
|
||
func (s *NotificationPopupSnapshot) Value() (driver.Value, error) {
|
||
if s == nil {
|
||
return nil, nil
|
||
}
|
||
return sonic.Marshal(s)
|
||
}
|
||
|
||
// Scan 从 JSONB 读取弹窗快照;数据库 NULL 时清空快照。
|
||
func (s *NotificationPopupSnapshot) Scan(value any) error {
|
||
if value == nil {
|
||
*s = NotificationPopupSnapshot{}
|
||
return nil
|
||
}
|
||
data, ok := value.([]byte)
|
||
if !ok {
|
||
*s = NotificationPopupSnapshot{}
|
||
return nil
|
||
}
|
||
return sonic.Unmarshal(data, s)
|
||
}
|