Commit 84b167d8 by zhangxw

话术萃取数据问题bug修复

1 parent 27ad4e7a
...@@ -150,18 +150,26 @@ export class ClueService { ...@@ -150,18 +150,26 @@ export class ClueService {
} }
if (params.table == 'script_record_browse_log') { // 话术萃取 if (params.table == 'script_record_browse_log') { // 话术萃取
const uniqueAccounts = new Set(data.map(user => user.staff_phone)) const uniqueAccounts = new Set(data.map(user => user.staff_phone))
const uniqueDates = data.reduce((set, val) => { const uniqueDates = new Set(
const dateStr = new Date(val.start_time).toISOString().split('T')[0]; data.map(user => {
set.add(dateStr); const d = new Date(user.start_time);
return set; // 格式化成 YYYY-MM-DD HH:mm:ss
}, new Set()); 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 { return {
code: RESPONSE_CODE.SUCCESS, code: RESPONSE_CODE.SUCCESS,
message: '查询成功', message: '查询成功',
data: [{ data: [{
count: total, count: total,
batchTotal: uniqueAccounts.size, batchTotal: uniqueDates.size,
peopleTotal: uniqueDates.size, peopleTotal: uniqueAccounts.size,
formattedStart, formattedStart,
formattedEnd, formattedEnd,
}], }],
...@@ -201,7 +209,7 @@ export class ClueService { ...@@ -201,7 +209,7 @@ export class ClueService {
const date = new Date(utcStr); const date = new Date(utcStr);
if (isNaN(date.getTime())) return ''; 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 year = datePlus8.getUTCFullYear();
const month = (datePlus8.getUTCMonth() + 1).toString().padStart(2, '0'); 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!