---
name: "getLogUserAction"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.5.2" }
title: "getLogUserAction - 获取用户操作的下发日志。"
---

## getLogUserAction

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

### 描述

获取用户操作的下发日志（支持分页）

### 参数

`Params`

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

### 返回值

类型: `Promise<IGetDpReportLogResponse>`

用户操作日志数据，包含总条数、DP 日志列表、是否有下一页

##### IGetDpReportLogResponse

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `total` | `number` | 总条数 |
| `dps` | `Dp[]` | 见Dp |
| `hasNext` | `boolean` | 是否有下一页 |

### 引用对象

##### `interface` IGetDpReportLog

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `devId` | `string` | 设备 ID |
| `dpIds` | `string` | DP 点 ID，多个 ID 用英文逗号隔开 |
| `offset` | `number` | 分页偏移量 |
| `limit` | `number` | 每页数量，最大值上限为 1000 |
| `sortType` | `"DESC" \| "ASC"` | 排序方式：'DESC' 倒序（默认）或 'ASC' 顺序 |

##### `type` Dp

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `timeStamp` | `number` | 上报数据的时间戳格式 |
| `dpId` | `number` | dp点的id |
| `timeStr` | `string` | 根据设备时区转换后的时间格式 yyyy-MM-dd HH:mm:ss |
| `value` | `string` | dp点的值 |


### 示例代码

#### 基础用法

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

getLogUserAction({
  devId: 'vdevo169477319679442',
  dpIds: '1,2',
  offset: 0,
  limit: 50,
  sortType: 'DESC',
}).then((res) => {
  console.log('用户操作日志:', res);
}).catch((error) => {
  console.error(error);
});
```
