feat(admin): R176-R180 公示表与新闻撤回 + 管理端多管理员权限(C 层)+ 交卷冻结
- R176 成绩公示表引擎(lib/publicitySheet.js + lib/assets/publicity-template.xlsx 官方模板基底) 与指导教师回填(lib/teacherBackfill.js);赛项名称/编号改为配置项 - R177 新闻「发布 ↔ 撤回」互斥:撤回只置 is_draft=1,不删除数据 - R178 C 层 RBAC:lib/adminPermissions.js(13 权限点 / 70 条路由规则,唯一 SoT) + middleware/auth.js 三段判定(默认拒绝 · is_super 单点 · token_version) + controller/service/adminUser.js + lib/auditLog.js + model/adminAuditLog.js - R178 B1 交卷冻结:service.exam.assertNotSubmitted(bizCode 4006 单一判据源) - R178 B④ 提交口径拆分:formalSubmitted / submitted / answeredCount 三字段 - R178 成绩总览补小组编号:resolveTeamLabels(与选手管理同源,含兜底与三态) - R181 生产迁移配套:admins +7 列、admin_audit_logs(scripts/migrate_r178_admin_rbac.py)
This commit is contained in:
@@ -37,7 +37,11 @@ class NewsService extends Service {
|
||||
const offset = (currentPage - 1) * currentPageSize;
|
||||
|
||||
// 构建查询条件
|
||||
const where = {};
|
||||
const where = {
|
||||
// 🔴 R176:草稿只允许后台可见。成绩发布时会自动生成一条「成绩公示」预览新闻,
|
||||
// 人工编辑确认前绝不能出现在前台列表(否则等于提前公示未定稿成绩)。
|
||||
is_draft: 0,
|
||||
};
|
||||
|
||||
// 组别过滤:同时包含指定组别和通用(all)新闻
|
||||
if (group) {
|
||||
@@ -90,7 +94,8 @@ class NewsService extends Service {
|
||||
|
||||
// 并行查询各分组计数
|
||||
await Promise.all(groups.map(async group => {
|
||||
const where = {};
|
||||
// 🔴 R176:计数口径必须与 list 一致,否则首页 Tab 显示「3 条」点进去只有 2 条
|
||||
const where = { is_draft: 0 };
|
||||
// 对于具体组别,同时包含该组别和 all 通用新闻
|
||||
if (group !== 'all') {
|
||||
where.group = { [Sequelize.Op.in]: [group, 'all'] };
|
||||
@@ -110,9 +115,10 @@ class NewsService extends Service {
|
||||
async findById(id) {
|
||||
const { ctx } = this;
|
||||
|
||||
// 🔴 R176:草稿不可通过 id 直接访问(前台详情页按 id 拉取 ⇒ 只过滤列表等于没防住)
|
||||
return await ctx.model.News.findOne({
|
||||
where: { id },
|
||||
attributes: ['id', 'title', 'content', 'publish_time', 'pinned', 'group', 'tags', 'sort_order', 'created_at', 'updated_at'],
|
||||
where: { id, is_draft: 0 },
|
||||
attributes: ['id', 'title', 'content', 'publish_time', 'pinned', 'group', 'tags', 'sort_order', 'attachment_url', 'attachment_name', 'created_at', 'updated_at'],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user