mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 21:24:53 +00:00
Change log retrieval period to one hour in DeviceService
This commit is contained in:
@ -721,8 +721,8 @@ export class DeviceService {
|
|||||||
): Promise<getDeviceLogsInterface> {
|
): Promise<getDeviceLogsInterface> {
|
||||||
try {
|
try {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const oneDayAgo = now - 1 * 24 * 60 * 60 * 1000;
|
const oneHourAgo = now - 1 * 60 * 60 * 1000;
|
||||||
const path = `/v2.0/cloud/thing/${deviceId}/report-logs?start_time=${oneDayAgo}&end_time=${now}&codes=${code}&size=50`;
|
const path = `/v2.0/cloud/thing/${deviceId}/report-logs?start_time=${oneHourAgo}&end_time=${now}&codes=${code}&size=50`;
|
||||||
const response = await this.tuya.request({
|
const response = await this.tuya.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path,
|
path,
|
||||||
@ -731,7 +731,7 @@ export class DeviceService {
|
|||||||
const camelCaseResponse = convertKeysToCamelCase(response);
|
const camelCaseResponse = convertKeysToCamelCase(response);
|
||||||
const logs = camelCaseResponse.result.logs ?? [];
|
const logs = camelCaseResponse.result.logs ?? [];
|
||||||
return {
|
return {
|
||||||
startTime: oneDayAgo,
|
startTime: oneHourAgo,
|
||||||
endTime: now,
|
endTime: now,
|
||||||
data: logs,
|
data: logs,
|
||||||
} as getDeviceLogsInterface;
|
} as getDeviceLogsInterface;
|
||||||
|
|||||||
Reference in New Issue
Block a user