feat(P1-1本地/P2-1): beforeUpdate草稿转发布合并旧文档fail-closed / es.json ASCII安全西语(备份.zcode/bak)
This commit is contained in:
@@ -184,6 +184,24 @@ module.exports = {
|
|||||||
// 如果是草稿,不检测
|
// 如果是草稿,不检测
|
||||||
if (updateData.article_status !== 1) return
|
if (updateData.article_status !== 1) return
|
||||||
|
|
||||||
|
// P1-1 草稿转发布合并旧文档:仅带 article_status=1 而无内容字段时,
|
||||||
|
// 直接审 updateData 会审空漏过。读库合并标题/摘要/正文/封面后再审。
|
||||||
|
// 读库失败则拒绝放行(fail-closed),避免静默漏审。
|
||||||
|
let auditSrc = updateData;
|
||||||
|
const hasContentField = updateData.title !== undefined || updateData.excerpt !== undefined ||
|
||||||
|
updateData.content !== undefined || updateData.cmsLst !== undefined || updateData.thumbnail !== undefined;
|
||||||
|
if (updateData.article_status === 1 && !hasContentField) {
|
||||||
|
let oldDoc = null;
|
||||||
|
try {
|
||||||
|
const found = await db.collection(articleDBName).doc(id).get();
|
||||||
|
oldDoc = found && found.data && found.data[0];
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error("发布审核需读取原文失败,请重试");
|
||||||
|
}
|
||||||
|
if (!oldDoc) throw new Error("发布审核需读取原文失败,请重试");
|
||||||
|
auditSrc = Object.assign({}, oldDoc, updateData);
|
||||||
|
}
|
||||||
|
|
||||||
// 检测内容安全开关
|
// 检测内容安全开关
|
||||||
const allowCheckContent = checkContentSecurityEnable('content')
|
const allowCheckContent = checkContentSecurityEnable('content')
|
||||||
const allowCheckImage = checkContentSecurityEnable('image')
|
const allowCheckImage = checkContentSecurityEnable('image')
|
||||||
@@ -192,20 +210,20 @@ module.exports = {
|
|||||||
const parallel = []
|
const parallel = []
|
||||||
|
|
||||||
// 检测标题
|
// 检测标题
|
||||||
if (allowCheckContent && updateData.title) {
|
if (allowCheckContent && auditSrc.title) {
|
||||||
parallel.push(checkContentSec(updateData.title, clientInfo.requestId, '标题存在敏感字,请修改后提交'))
|
parallel.push(checkContentSec(auditSrc.title, clientInfo.requestId, '标题存在敏感字,请修改后提交'))
|
||||||
}
|
}
|
||||||
// 检测摘要
|
// 检测摘要
|
||||||
if (allowCheckContent && updateData.excerpt) {
|
if (allowCheckContent && auditSrc.excerpt) {
|
||||||
parallel.push(checkContentSec(updateData.excerpt, clientInfo.requestId, '摘要存在敏感字,请修改后提交'))
|
parallel.push(checkContentSec(auditSrc.excerpt, clientInfo.requestId, '摘要存在敏感字,请修改后提交'))
|
||||||
}
|
}
|
||||||
// 检测内容:兼容标准 Delta 与移动端 cmsLst
|
// 检测内容:兼容标准 Delta 与移动端 cmsLst
|
||||||
const text = contentText(updateData.content, updateData.cmsLst)
|
const text = contentText(auditSrc.content, auditSrc.cmsLst)
|
||||||
if (allowCheckContent && text) {
|
if (allowCheckContent && text) {
|
||||||
parallel.push(checkContentSec(text, clientInfo.requestId, '内容存在敏感字,请修改后提交'))
|
parallel.push(checkContentSec(text, clientInfo.requestId, '内容存在敏感字,请修改后提交'))
|
||||||
}
|
}
|
||||||
// 检测封面、正文图片和视频封面
|
// 检测封面、正文图片和视频封面
|
||||||
const images = [...(Array.isArray(updateData.thumbnail) ? updateData.thumbnail : []), ...contentImages(updateData.content, updateData.cmsLst)]
|
const images = [...(Array.isArray(auditSrc.thumbnail) ? auditSrc.thumbnail : []), ...contentImages(auditSrc.content, auditSrc.cmsLst)]
|
||||||
if (allowCheckImage && images.length) {
|
if (allowCheckImage && images.length) {
|
||||||
parallel.push(checkImageSec(images, clientInfo.requestId, '图片存在违规,请修改后提交'))
|
parallel.push(checkImageSec(images, clientInfo.requestId, '图片存在违规,请修改后提交'))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"uni-pagination.prevText": "anterior",
|
"uni-pagination.prevText": "anterior",
|
||||||
"uni-pagination.nextText": "prxima",
|
"uni-pagination.nextText": "siguiente",
|
||||||
"uni-pagination.piecePerPage": "Art¨ªculo/P¨¢gina"
|
"uni-pagination.piecePerPage": "elementos/pagina"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user