mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 22:04: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> {
|
||||
try {
|
||||
const now = Date.now();
|
||||
const oneDayAgo = now - 1 * 24 * 60 * 60 * 1000;
|
||||
const path = `/v2.0/cloud/thing/${deviceId}/report-logs?start_time=${oneDayAgo}&end_time=${now}&codes=${code}&size=50`;
|
||||
const oneHourAgo = now - 1 * 60 * 60 * 1000;
|
||||
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({
|
||||
method: 'GET',
|
||||
path,
|
||||
@ -731,7 +731,7 @@ export class DeviceService {
|
||||
const camelCaseResponse = convertKeysToCamelCase(response);
|
||||
const logs = camelCaseResponse.result.logs ?? [];
|
||||
return {
|
||||
startTime: oneDayAgo,
|
||||
startTime: oneHourAgo,
|
||||
endTime: now,
|
||||
data: logs,
|
||||
} as getDeviceLogsInterface;
|
||||
|
||||
Reference in New Issue
Block a user