---
name: "getDpLogDays"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.5.2" }
title: "getDpLogDays - 获取设备每日上报的数据统计。"
---

## getDpLogDays

> [VERSION] @ray-js/ray >= 1.5.2

### 描述

获取指定日期范围内 DP 点每日上报的数据统计

### 参数

`Params`

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `params` | `IGetDpLogDays` | 是 | 请求参数 |

### 返回值

类型: `Promise<IGetDpLogDaysResponse>`

每日统计数据，包含总条数、日期列表、对应每天的值列表

##### IGetDpLogDaysResponse

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `total` | `string` | 总条数 |
| `values` | `string[]` | 每天对应的值 |
| `days` | `string[]` | 天的集合 |

### 引用对象

##### `interface` IGetDpLogDays

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `devId` | `string` | 设备 ID |
| `dpId` | `string` | DP 点 ID |
| `type` | `string` | 统计类型：sum（求和）、min（最小值）或 max（最大值） |
| `startDay` | `string` | 开始日期，格式为 yyyyMMdd，例如 20180529 |
| `endDay` | `string` | 结束日期，格式为 yyyyMMdd，例如 20180531 |


### 示例代码

#### 基础用法

```ts
import { getDpLogDays } from '@ray-js/ray';

getDpLogDays({
  devId: 'vdevo169477319679442',
  dpId: '1',
  startDay: '20240101',
  endDay: '20240131',
  type: 'sum',
}).then((res) => {
  console.log('每日统计:', res);
}).catch((error) => {
  console.error(error);
});
```
