Files
junhong_cmp_fiber/internal/routes/personal_notification.go
邹进 0f1ea5bc3e
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 10m17s
fix: 第1批 M9 套餐临期提醒按资产、扫码进入时触发
- 每日扫描不再给个人客户写临期通知,店铺通知不变
- H5 资产信息在当前资产剩余 0~15 天且当天首次进入时返回 expiry_reminder,并为该客户、该资产写一条临期通知(Redis 去重,失败不占键)
- 个人通知列表、未读数、全部已读中临期提醒只处理当前资产(按 ref_key)
- OpenSpec Change scope-expiry-reminder-to-current-asset:6/9,临期 fixture 端到端验证与每日扫描验证待测试部署后完成
2026-10-12 00:15:27 +09:00

51 lines
2.8 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 routes
import (
"github.com/gofiber/fiber/v2"
apphandler "github.com/break/junhong_cmp_fiber/internal/handler/app"
"github.com/break/junhong_cmp_fiber/internal/model/dto"
"github.com/break/junhong_cmp_fiber/pkg/openapi"
)
// registerPersonalNotificationRoutes 注册当前个人客户的简化站内通知路由。
func registerPersonalNotificationRoutes(router fiber.Router, handler *apphandler.ClientNotificationHandler, doc *openapi.Generator, basePath string) {
notifications := router.Group("/notifications")
groupPath := basePath + "/notifications"
Register(notifications, doc, groupPath, "GET", "/unread-count", handler.UnreadCount, RouteSpec{
Summary: "查询个人客户通知未读数",
Description: "仅查询当前认证个人客户的未过期业务通知,平台同步和系统运维通知不会进入结果;套餐临期提醒只计当前登录资产的。",
Tags: []string{"个人客户 - 站内通知"},
Output: new(dto.NotificationUnreadCountResponse),
Auth: true,
})
Register(notifications, doc, groupPath, "GET", "", handler.List, RouteSpec{
Summary: "查询个人客户通知列表",
Description: "仅返回当前认证个人客户的未过期业务通知,可按已读状态筛选,固定按创建时间和通知 ID 倒序;套餐临期提醒只返回当前登录资产的(按 ref_key 匹配,卡为 ICCID、设备为虚拟号或 IMEI),其他类型不受影响。当前 C 端契约只承诺列表展示和未读弹窗;ref_type/ref_id/ref_key 是资源引用与展示快照,不是URL,也不承诺可直接拼接页面路由。",
Tags: []string{"个人客户 - 站内通知"},
Input: new(dto.PersonalNotificationListRequest),
Output: new(dto.PersonalNotificationListResponse),
Auth: true,
})
// 静态路径必须先于通知 ID 动态路径,避免被动态参数吞掉。
Register(notifications, doc, groupPath, "PUT", "/read-all", handler.MarkAllRead, RouteSpec{
Summary: "全部标记个人客户通知已读",
Description: "只更新当前认证个人客户可见的未过期未读业务通知,重复调用幂等成功;其他资产的套餐临期提醒保持未读。",
Tags: []string{"个人客户 - 站内通知"},
Output: new(dto.NotificationReadAllResponse),
Auth: true,
})
Register(notifications, doc, groupPath, "PUT", "/:id/read", handler.MarkRead, RouteSpec{
Summary: "标记个人客户单条通知已读",
Description: "仅更新当前认证个人客户可见的通知;通知不存在、属于别人或已经已读均幂等成功。",
Tags: []string{"个人客户 - 站内通知"},
Input: new(dto.NotificationIDParams),
Output: new(dto.NotificationReadResponse),
Auth: true,
})
}