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。弹窗类型 `popup_type` 必填" + "(promotion:套餐政策推广, announcement:通用公告),取值域外或缺失一律以参数非法拒绝;" + "未传优先级时按类型的缺省优先级取值。候选排序先按类型类别(风险换卡提醒 > 套餐政策推广 > 通用公告)," + "再按显式优先级降序、同优先级取最近更新时间最新。范围同一维度多选取任一命中,未配置范围即全量;" + "页面必选;受控动作只允许套餐购买或资产钱包充值,不接受 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: "更新运营弹窗配置并递增版本;旧版本已投放通知的内容与快照不被改写," + "新版本可向原命中客户按频率重新投放一次。`popup_type` 传入时必须落在" + "(promotion:套餐政策推广, announcement:通用公告)取值域内,否则以参数非法拒绝;不传保持原值。", 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), }) }