feat(公告推送):配置中心-推送管理中增加一个手动推送功能
deploy-hxtesting / build-and-deploy (push) Successful in 1m19s

目的:为和信智汇学院有重要通知时可随时向用户手动推送重要信息使用
推送内容:标题、内容、落地页(均可自定义配置),默认值标题为“和信智汇学院”、内容为“重要通知”、落地页默认系统登录页如果已登录默认登录后系统页面
推送人员:默认全员通知,可根据部门、职位、具体人员进行自定义人员
推送时间:可立即推送也可设定定时推送!
This commit is contained in:
runny committed 2026-11-29 13:41:05 +08:00
1 parent 78e9787793
commit 61fb94744a
14 files changed
+1451 -2

No files matched your search

+58
View File
@@ -1427,6 +1427,8 @@ export interface TrainingNotification {
content: string
ref_type: string
ref_id: string
/** 落地页地址(手动推送可自定义;000155 起通知行可携带)。 */
link_url?: string
sent_at: string
read_at: string | null
}
@@ -1550,6 +1552,62 @@ export const notifySessionStudents = (sessionId: string) =>
export const runWeeklyLecturerReminders = () =>
post<{ success: boolean; data: { queued: number } }>(`${base}/notifications/run-weekly`, {})
// ---- 手动推送([2026-11 需求] 配置中心 · 推送管理) ----
/** 手动推送默认文案(与后端 manualPushDefault* 逐字一致,弹窗预填空值兜底)。 */
export const MANUAL_PUSH_DEFAULT_TITLE = '和信智汇学院'
export const MANUAL_PUSH_DEFAULT_CONTENT = '重要通知'
/** TrainingPushTaskItem 手动推送任务行(镜像 internal/types.TrainingPushTaskItem)。 */
export interface TrainingPushTaskItem {
id: string
title: string
audience_mode: 'all' | 'dept' | 'post' | 'user'
/** 人员范围摘要(全员 / 按部门 财务部、人事部 / 按职位 课长 / 指定人员)。 */
audience_text: string
send_at: string
status: 'pending' | 'sending' | 'sent' | 'cancelled'
created_by: string
created_at: string
sent_at: string | null
sent_count: number
}
// TrainingManualPushResult 创建结果:任务行 + 创建时点人员数(定时任务发送时
// 按当时代名单重新解析)+ 是否定时。
export interface TrainingManualPushResult {
task: TrainingPushTaskItem
audience_count: number
scheduled: boolean
}
// createManualPush 手动推送一次通知(标题/内容/落地页可空走后端默认;人员范围
// 全员/按部门/按职位/按人员;send_at 为空 = 立即推送,ISO 字符串 = 定时)。
export const createManualPush = (payload: {
title?: string
content?: string
link_url?: string
audience_mode?: 'all' | 'dept' | 'post' | 'user'
dept_ids?: string[]
posts?: string[]
user_ids?: string[]
send_at?: string
}) =>
post<{ success: boolean; data: TrainingManualPushResult }>(
`${base}/notifications/manual-push`,
payload,
)
// listManualPushTasks 待发送定时任务列表(配置中心「手动推送」面板展示)。
export const listManualPushTasks = () =>
get<{ success: boolean; data: TrainingPushTaskItem[] }>(
`${base}/notifications/manual-push-tasks`,
)
// cancelManualPushTask 取消待发送定时任务(仅 pending 可取消)。
export const cancelManualPushTask = (id: string) =>
post<{ success: boolean }>(`${base}/notifications/manual-push-tasks/${enc(id)}/cancel`, {})
// ---- 内部小工具 ----
function enc(value: string) {