All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m23s
新增 000225 迁移:运营弹窗配置表 tb_h5_popup_configuration(页面/范围/优先级/频率/受控动作/启停/有效期/版本) 与 tb_notification 可空 JSONB 列 popup_snapshot。 新增通知直建窄接口 DirectWriter.CreateOrGetPersonal:与 Outbox 消费共用 prepareDelivery 的渲染、 展示期与 CreateIdempotent 规则,冲突时回查返回既有行;同步扩展个人通知查询与已读两处类型白名单, 并按个人客户入口补齐投递审计来源。 新增 H5 候选与风险换卡:GET /api/c/v1/popup-candidates 先判风险资格(广电卡 + 风险停机 + 无活动物流换货单),命中只返回风险候选;未命中再按时间/启停/页面/店铺/设备类型/卡类型范围/频率 匹配运营配置。POST /api/c/v1/risk-exchanges/:asset_id/address 锁资产行后幂等创建待发货物流换货单, 首次地址锁定,不沿用资产级群发通知。 新增后台运营弹窗配置 CRUD 与启停(仅超级管理员与平台账号),更新递增版本并刷新最近更新时间, 标题与正文统一拒绝 URL 与前端路由,全部写操作记录操作者、前后值、版本与时间。 同步 OpenAPI(cmd/gendocs、cmd/api/docs.go、pkg/openapi/handlers.go)与参数校验中文提示共用实现。
73 lines
3.4 KiB
Go
73 lines
3.4 KiB
Go
package routes
|
||
|
||
import (
|
||
"github.com/gofiber/fiber/v2"
|
||
|
||
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
|
||
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
||
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
||
)
|
||
|
||
// registerH5PopupConfigurationRoutes 注册 H5 运营弹窗配置的维护路由。
|
||
// 全部接口仅超级管理员与平台账号可用,代理与企业统一返回 403。
|
||
func registerH5PopupConfigurationRoutes(router fiber.Router, handler *admin.H5PopupConfigurationHandler, doc *openapi.Generator, basePath string) {
|
||
configurations := router.Group("/h5-popup-configurations")
|
||
groupPath := basePath + "/h5-popup-configurations"
|
||
|
||
Register(configurations, doc, groupPath, "GET", "", handler.ListH5PopupConfigurations, RouteSpec{
|
||
Summary: "查询运营弹窗配置列表",
|
||
Description: "按最近更新时间倒序分页返回运营弹窗配置,可按启停筛选。",
|
||
Tags: []string{"H5 运营弹窗配置"},
|
||
Auth: true,
|
||
Input: new(dto.H5PopupConfigurationListRequest),
|
||
Output: new(dto.H5PopupConfigurationListResponse),
|
||
})
|
||
|
||
Register(configurations, doc, groupPath, "POST", "", handler.CreateH5PopupConfiguration, RouteSpec{
|
||
Summary: "创建运营弹窗配置",
|
||
Description: "创建全局运营弹窗配置,初始版本为 1。范围同一维度多选取任一命中,未配置范围即全量;" +
|
||
"页面必选;受控动作只允许套餐购买或资产钱包充值,不接受 URL、前端路由或任意动作;结束时间不得早于开始时间。",
|
||
Tags: []string{"H5 运营弹窗配置"},
|
||
Auth: true,
|
||
Input: new(dto.CreateH5PopupConfigurationRequest),
|
||
Output: new(dto.H5PopupConfigurationResponse),
|
||
})
|
||
|
||
Register(configurations, doc, groupPath, "GET", "/:id", handler.GetH5PopupConfiguration, RouteSpec{
|
||
Summary: "查询运营弹窗配置详情",
|
||
Tags: []string{"H5 运营弹窗配置"},
|
||
Auth: true,
|
||
Input: new(dto.H5PopupConfigurationIDParams),
|
||
Output: new(dto.H5PopupConfigurationResponse),
|
||
})
|
||
|
||
Register(configurations, doc, groupPath, "PUT", "/:id", handler.UpdateH5PopupConfiguration, RouteSpec{
|
||
Summary: "更新运营弹窗配置",
|
||
Description: "更新运营弹窗配置并递增版本;旧版本已投放通知的内容与快照不被改写," +
|
||
"新版本可向原命中客户按频率重新投放一次。",
|
||
Tags: []string{"H5 运营弹窗配置"},
|
||
Auth: true,
|
||
Input: new(dto.UpdateH5PopupConfigurationParams),
|
||
Output: new(dto.H5PopupConfigurationResponse),
|
||
})
|
||
|
||
// 静态后缀必须先于 /:id 动态路径注册,避免被动态参数吞掉。
|
||
Register(configurations, doc, groupPath, "POST", "/:id/enable", handler.EnableH5PopupConfiguration, RouteSpec{
|
||
Summary: "启用运营弹窗配置",
|
||
Description: "启用后参与候选匹配,并刷新最近更新时间,影响同优先级排序。",
|
||
Tags: []string{"H5 运营弹窗配置"},
|
||
Auth: true,
|
||
Input: new(dto.H5PopupConfigurationIDParams),
|
||
Output: new(dto.H5PopupConfigurationResponse),
|
||
})
|
||
|
||
Register(configurations, doc, groupPath, "POST", "/:id/disable", handler.DisableH5PopupConfiguration, RouteSpec{
|
||
Summary: "停用运营弹窗配置",
|
||
Description: "停用后停止新投放,并刷新最近更新时间;历史通知在展示期内仍可见。",
|
||
Tags: []string{"H5 运营弹窗配置"},
|
||
Auth: true,
|
||
Input: new(dto.H5PopupConfigurationIDParams),
|
||
Output: new(dto.H5PopupConfigurationResponse),
|
||
})
|
||
}
|