feat(training): 企业培训迭代:推送深链接与签名下载、课程管理修复与收集模板调整
推送域(000155):
- 广播通知支持 link_url:demand_collect 场景自动签发教育训练需求表模板
匿名下载直链(HMAC token,20 天有效,免登录路由),企微消息尾部拼
「下载模板 + 查看更多详情」链接;站内文本保持纯文本不受影响
- 配置中心新增「推送链接基址」(notify_link_base_url,多入口/内外网部署固定
权威地址,留空跟随推送人访问地址)与「年培训计划收集推送文案」
(demand_collect_*,{year} 渲染收集年度);空标题/内容按模板回落渲染
- 迁移 000155:tr_training_notifications 增 link_url/link_token 列
课程管理:
- 修复点【发布/下线】报「不支持的操作」:动作取值兼容字面量路由(FullPath
末段)与 :action 通配两种注册形态
- 列表新增「创建人」列:creator_id 联查 users 带出姓名,导出 Excel 同步;
新增课程「所属部门」默认当前登录用户所在部门
- 导入加固:表头归一化 + 别名模糊匹配(兼容内置模板/旧口径/自定义模板变体);
导入与新增行支持按部门名兜底解析为 id(前端名册未命中时传 owner_dept_name)
年培训计划:
- 需求列表新增「创建人/创建时间」列(submitter_id 联查 users 带出姓名)
- 收集模板调整:下载时动态删除「培训费用(RMB)」列(旧版自定义模板同步归一,
右侧列/合并/下拉随删列平移);备注右侧追加「调研维度/培训策划要求」说明列
(合并至数据区末行,自动换行带边框,已带说明的自定义模板不覆盖)
开发工具:
- air 热重载适配 Windows:构建收敛到 scripts/air_build.sh(规避 air 经
PowerShell 执行不支持 bash 命令替换),产物改 .exe 后缀;CGO_CFLAGS 取
持久化值并集追加,不覆盖 go env -w 的头文件包含路径
This commit is contained in:
1 parent
242dd7e1a6
commit
4e25fce9aa
30 files changed
+1150
-143
No files matched your search
@@ -185,9 +185,11 @@ export interface TrainingDemand {
|
||||
check_status: 'pending' | 'passed' | 'fixed'
|
||||
check_msg: string
|
||||
status: string
|
||||
/** 联查展示字段:部门名称/讲师姓名 */
|
||||
/** 联查展示字段:部门名称/讲师姓名/创建人姓名(提报人,联查 users 只读) */
|
||||
dept_name?: string
|
||||
lecturer_name?: string
|
||||
submitter_name?: string
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export interface TrainingAnnualPlan {
|
||||
@@ -460,6 +462,8 @@ export interface TrainingLibraryCourse {
|
||||
clear_file?: boolean
|
||||
/** 讲师姓名(联查 users 只读) */
|
||||
lecturer_name?: string
|
||||
/** 创建人姓名(联查 users 只读;导入/新增时落 creator_id 后带出) */
|
||||
creator_name?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
@@ -1270,6 +1274,8 @@ export const markNotificationsRead = () =>
|
||||
post<{ success: boolean }>(`${base}/notifications/read`, {})
|
||||
|
||||
// BroadcastNotification 培训运营向指定平台用户批量推送站内通知(收集下年度计划等场景)。
|
||||
// link_url 传前端 origin:demand_collect 场景企微消息尾部由后端拼
|
||||
// 「下载教育训练需求表模板(签名直链)+ 查看更多详情」两行链接。
|
||||
export const broadcastTrainingNotification = (payload: {
|
||||
user_ids: string[]
|
||||
scene?: string
|
||||
@@ -1277,9 +1283,45 @@ export const broadcastTrainingNotification = (payload: {
|
||||
content?: string
|
||||
ref_type?: string
|
||||
ref_id?: string
|
||||
link_url?: string
|
||||
}) =>
|
||||
post<{ success: boolean; data: { sent: number } }>(`${base}/notifications/broadcast`, payload)
|
||||
|
||||
// ---- 年培训计划收集推送文案(配置中心「提醒推送文案」卡可配) ----
|
||||
|
||||
/** notify_text_templates 规则键(与后端 ruleKeyNotifyTextTemplates 一致)。 */
|
||||
export const NOTIFY_TEXT_TEMPLATES_RULE_KEY = 'notify_text_templates'
|
||||
|
||||
// [2026-11 需求] 收集推送默认文案(与后端 defaultDemandCollect* 逐字一致):
|
||||
// 配置中心 demand_collect_title/demand_collect_content 可编辑,{year} 在
|
||||
// 收集弹窗预填与后端广播回落渲染时替换为收集年度(下一年)。
|
||||
export const DEFAULT_DEMAND_COLLECT_TITLE = '【培训需求收集】{year}年度培训计划收集'
|
||||
export const DEFAULT_DEMAND_COLLECT_CONTENT =
|
||||
'请各部门于 {year} 年 1 月 31 日前提报 {year} 年度培训需求:' +
|
||||
'可点击消息中的「教育训练需求表模板」链接直接下载批量填写后导入,或登录 AIDO → 企业培训 → 培训计划 → 年度需求收集在线逐条提报。'
|
||||
|
||||
/** 读取年培训计划收集推送文案模板(配置中心 notify_text_templates;字段为空/
|
||||
* 拉取失败回落内置默认,与后端 parseNotifyTextTemplates 同口径)。 */
|
||||
export async function fetchDemandCollectText(): Promise<{ title: string; content: string }> {
|
||||
let title = DEFAULT_DEMAND_COLLECT_TITLE
|
||||
let content = DEFAULT_DEMAND_COLLECT_CONTENT
|
||||
try {
|
||||
const res = await listRuleConfigs()
|
||||
const saved = (unwrap<TrainingRuleConfig[]>(res) || []).find(
|
||||
(c) => c.rule_key === NOTIFY_TEXT_TEMPLATES_RULE_KEY,
|
||||
)?.rule_value
|
||||
if (typeof saved?.demand_collect_title === 'string' && saved.demand_collect_title.trim()) {
|
||||
title = saved.demand_collect_title
|
||||
}
|
||||
if (typeof saved?.demand_collect_content === 'string' && saved.demand_collect_content.trim()) {
|
||||
content = saved.demand_collect_content
|
||||
}
|
||||
} catch {
|
||||
// 拉取失败回退内置默认,收集弹窗预填不受影响
|
||||
}
|
||||
return { title, content }
|
||||
}
|
||||
|
||||
// ---- 推送管理(2026-11 推学员/推讲师需求,配置中心展示) ----
|
||||
|
||||
// TrainingPushLog 推送逐人明细行(镜像 internal/types.TrainingPushLog)。
|
||||
|
||||
Reference in new issue
Block a user