fix(评论): 表情保留(UTF-8 提示 + 剪贴板输入 + 严格回读)

- 导入报告新增 emoji_rows/含表情数量;页面提示 CSV 必须 UTF-8
- input_text 评论来源优先设备端剪贴板粘贴,send_keys 兜底
- 评论回读改为整段文字校验(原前缀校验会放过被丢掉的表情)
- 测试覆盖表情解析/入库/计数
This commit is contained in:
2026-10-31 10:38:51 +08:00
parent 09848dfaf4
commit aba4583641
7 changed files with 95 additions and 12 deletions
+5 -2
View File
@@ -2027,7 +2027,9 @@ function afOpenCommentImport() {
'<div class="help" style="margin-bottom:8px">每行一条:<b>视频链接 &nbsp;账号 &nbsp;评论内容</b>(制表符/逗号都行)。' +
'账号写账号库里的昵称或抖音号;同一个账号可以对多条视频各有一行。' +
'重复导入按「视频链接 + 账号」去重:未执行的更新,已评论/结果未知的跳过。<br>' +
'CSV 里评论内容带逗号/换行时要用引号包起来。</div>' +
'CSV 里评论内容带逗号/换行时要用引号包起来。<b>CSV 必须存成「CSV UTF-8」</b>' +
'(Excel 默认的普通 CSV/GBK 会把表情变成 ? 或直接丢掉);直接粘贴不受影响。' +
'导入报告会显示「含表情 N 条」,可用来核对表情有没有保留。</div>' +
'<div class="toolbar" style="margin-bottom:6px">' +
'<a class="btn btn-xs" href="/api/af/comments/template" target="_blank">⬇ 下载模板(CSV)</a>' +
'<span class="text-muted" style="font-size:12px">可以从 Excel 直接复制三列粘贴到下面</span></div>' +
@@ -2081,7 +2083,8 @@ async function afDoCommentImport(dry) {
const rows = res.rows || [];
const head = (dry ? '试导' : '导入') + '完成:新增 ' + (res.added || 0) +
' / 更新 ' + (res.updated || 0) + ' / 跳过 ' + (res.skipped || 0) +
' / 错误 ' + (res.errors || 0) + (dry ? '(没有写库)' : '');
' / 错误 ' + (res.errors || 0) + ' / 含表情 ' + (res.emoji_rows || 0) + ' 条' +
(dry ? '(没有写库)' : '');
log.innerHTML = '<div style="color:' + ((res.errors || 0) ? '#b45309' : '#16a34a') +
';margin-bottom:4px"><b>' + esc(head) + '</b></div>' +
'<table class="table" style="font-size:12px"><thead><tr>' +