fix: 主题/样式继承查询跳过观看计数——前后端配合 noread 标记
前端 inheritThemeStyle 的 fetch 体附加 noread:true,后端 dnfs2 _handle_get_notes 检测到该标记时跳过 _bump_views,避免静默查询 污染节点的观看次数统计。
This commit is contained in:
1 parent
2d4c60f643
commit
49d9a33420
2 files changed
+8
-3
No files matched your search
+7
-2
@@ -934,9 +934,14 @@ private:
|
|||||||
return make_json_obj(http::status::internal_server_error, err, req);
|
return make_json_obj(http::status::internal_server_error, err, req);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开节点 pid 时观看人数 +1(pid=0 为虚拟根节点,无对应行,跳过)。
|
// 打开节点 pid 时观看人数 +1(pid=0 为虚拟根节点或无 noread 标记时,
|
||||||
|
// 前端样式继承等静默查询传 {"noread":true} 来跳过)。
|
||||||
// best-effort:失败仅记日志,不影响返回结果。
|
// best-effort:失败仅记日志,不影响返回结果。
|
||||||
if (pid != 0) {
|
bool noread = false;
|
||||||
|
if (auto it2 = body.find("noread"); it2 != body.end() && it2->value().is_bool()) {
|
||||||
|
noread = it2->value().as_bool();
|
||||||
|
}
|
||||||
|
if (pid != 0 && !noread) {
|
||||||
_bump_views(pid);
|
_bump_views(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -722,7 +722,7 @@ function inheritThemeStyle() {
|
|||||||
var res = await fetch('/get_notes', {
|
var res = await fetch('/get_notes', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ pid: pid })
|
body: JSON.stringify({ pid: pid, noread: true })
|
||||||
});
|
});
|
||||||
if (gen !== _inherit_gen) return;
|
if (gen !== _inherit_gen) return;
|
||||||
if (!res.ok) continue;
|
if (!res.ok) continue;
|
||||||
|
|||||||
Reference in new issue
Block a user