fix: 第1批 M9 套餐临期提醒按资产、扫码进入时触发
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 10m17s

- 每日扫描不再给个人客户写临期通知,店铺通知不变
- H5 资产信息在当前资产剩余 0~15 天且当天首次进入时返回 expiry_reminder,并为该客户、该资产写一条临期通知(Redis 去重,失败不占键)
- 个人通知列表、未读数、全部已读中临期提醒只处理当前资产(按 ref_key)
- OpenSpec Change scope-expiry-reminder-to-current-asset:6/9,临期 fixture 端到端验证与每日扫描验证待测试部署后完成
This commit is contained in:
邹进
2026-10-12 00:15:27 +09:00
parent 9ced14fa1b
commit 0f1ea5bc3e
18 changed files with 418 additions and 100 deletions

View File

@@ -59,6 +59,9 @@ const (
NotificationRefTypePackage = "package"
// NotificationRefTypeAsset 表示个人客户资产资源引用。
NotificationRefTypeAsset = "asset"
// NotificationPersonalExpiringAssetCondition 个人通知中心只保留当前资产的套餐临期提醒:
// 参数依次为临期通知类型、资产引用类型、当前资产标识(卡 ICCID;设备虚拟号,空则 IMEI);不按 ref_id 过滤。
NotificationPersonalExpiringAssetCondition = "(NOT (type = ? AND ref_type = ?) OR ref_key = ?)"
// NotificationRefTypeRefund 表示退款详情资源引用。
NotificationRefTypeRefund = "refund"
// NotificationRefTypeAgentRecharge 表示代理充值详情资源引用。

View File

@@ -1,6 +1,9 @@
package constants
import "fmt"
import (
"fmt"
"time"
)
// ========================================
// 认证相关 Redis Key
@@ -556,6 +559,16 @@ func RedisPollingConfigChangedChannel() string {
// 系统全局配置 Redis Key
// ========================================
// RedisPackageExpiryEntryReminderKey H5 进入资产时套餐临期提醒的去重键
// 用途:同一客户、同一资产、同一上海自然日至多返回一次提醒字段
// 过期时间:当天上海时间结束后再加缓冲,由调用方计算
func RedisPackageExpiryEntryReminderKey(customerID uint, assetType, assetIdentifier, shanghaiDate string) string {
return fmt.Sprintf("package_expiry:entry_reminder:%d:%s:%s:%s", customerID, assetType, assetIdentifier, shanghaiDate)
}
// PackageExpiryEntryReminderTTLBuffer 临期提醒去重键在当天结束后保留的缓冲时长。
const PackageExpiryEntryReminderTTLBuffer = time.Hour
// RedisSystemOperationPasswordKey 全局操作密码 Redis 键
// 用途:存储超级管理员设置的全局操作密码(bcrypt 哈希值)
// 过期时间:永久存储(无 TTL)