Commit 84b167d8 by zhangxw

话术萃取数据问题bug修复

1 parent 27ad4e7a
......@@ -150,18 +150,26 @@ export class ClueService {
}
if (params.table == 'script_record_browse_log') { // 话术萃取
const uniqueAccounts = new Set(data.map(user => user.staff_phone))
const uniqueDates = data.reduce((set, val) => {
const dateStr = new Date(val.start_time).toISOString().split('T')[0];
set.add(dateStr);
return set;
}, new Set());
const uniqueDates = new Set(
data.map(user => {
const d = new Date(user.start_time);
// 格式化成 YYYY-MM-DD HH:mm:ss
const Y = d.getFullYear();
const M = String(d.getMonth() + 1).padStart(2, '0');
const D = String(d.getDate()).padStart(2, '0');
const h = String(d.getHours()).padStart(2, '0');
const m = String(d.getMinutes()).padStart(2, '0');
const s = String(d.getSeconds()).padStart(2, '0');
return `${Y}-${M}-${D} ${h}:${m}:${s}`;
})
)
return {
code: RESPONSE_CODE.SUCCESS,
message: '查询成功',
data: [{
count: total,
batchTotal: uniqueAccounts.size,
peopleTotal: uniqueDates.size,
batchTotal: uniqueDates.size,
peopleTotal: uniqueAccounts.size,
formattedStart,
formattedEnd,
}],
......@@ -201,7 +209,7 @@ export class ClueService {
const date = new Date(utcStr);
if (isNaN(date.getTime())) return '';
const datePlus8 = new Date(date.getTime() + 8 * 60 * 60 * 1000);
const datePlus8 = new Date(date.getTime());
const year = datePlus8.getUTCFullYear();
const month = (datePlus8.getUTCMonth() + 1).toString().padStart(2, '0');
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!