This commit is contained in:
张成
2026-02-28 10:38:28 +08:00
parent 1a011bcc01
commit dfd3119163
44 changed files with 449 additions and 13555 deletions

View File

@@ -69,12 +69,7 @@ module.exports = {
}),
chat_records.count({
where: {
sn_code: deviceSn,
direction: 'sent',
sendTime: {
[op.gte]: todayStart,
[op.lte]: todayEnd
}
sn_code: deviceSn
}
}).catch(err => {
console.error('[统计] 查询聊天数量失败:', err);
@@ -189,14 +184,9 @@ module.exports = {
}),
chat_records.findAll({
where: {
sn_code: deviceSn,
direction: 'sent',
sendTime: {
[op.gte]: start,
[op.lte]: end
}
sn_code: deviceSn
},
attributes: ['sendTime'],
attributes: ['updateTime'],
raw: true
}).catch(err => {
console.error('[统计] 查询聊天记录失败:', err);
@@ -226,7 +216,7 @@ module.exports = {
}).length;
const chatCount = allChats.filter(item => {
const itemDate = dayjs(item.sendTime);
const itemDate = dayjs(item.updateTime);
return !itemDate.isBefore(dayStart, 'day') && !itemDate.isAfter(dayEnd, 'day');
}).length;
@@ -499,14 +489,9 @@ module.exports = {
const allChats = await chat_records.findAll({
where: {
sn_code: deviceSn,
direction: 'sent',
sendTime: {
[op.gte]: start,
[op.lte]: end
}
sn_code: deviceSn
},
attributes: ['sendTime'],
attributes: ['updateTime'],
raw: true
}).catch(err => {
console.error('[统计] 查询聊天记录失败:', err);
@@ -523,7 +508,7 @@ module.exports = {
const dayEnd = currentDate.endOf('day');
const count = allChats.filter(item => {
const itemDate = dayjs(item.sendTime);
const itemDate = dayjs(item.updateTime);
return !itemDate.isBefore(dayStart, 'day') && !itemDate.isAfter(dayEnd, 'day');
}).length;