智能小程序开发 —— meature API 汇总(一)

getStatisticsConfig

获取统计配置,获取开通智能计量的 dp 点及配置。

请求参数

参数 数据类型 说明 是否必填
devId string 设备 ID 是

返回值

复制代码
Array<{
  algorithmType: 'sum' | 'avg' | 'minux' | 'max' | 'min' | 'count';
  dpId: number;
  productId: string;
  statisticInterval: number;
  storageDuration: number;
}>
参数 数据类型 说明
algorithmType string 统计类型,'sum' | 'avg' | 'minux' | 'max' | 'min' | 'count';默认 sum
dpId number dp id
productId string 产品 id
statisticInterval number 统计间隔,数据保存天数,1(天)、2(小时)、4(月)、16(15 分钟)
storageDuration number 数据保存天数

请求示例

复制代码
// @ray-js/ray^1.2.12
import { getStatisticsConfig } from '@ray-js/ray';
 
getStatisticsConfig({
  devId: 'vdevo166789063330437',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

返回示例

复制代码
var response = [
  {
    storageDuration: 365,
    productId: 'lcrxzqjqojafatrv',
    dpId: 18,
    statisticInterval: 1,
    algorithmType: 'avg',
  },
  {
    storageDuration: 365,
    productId: 'lcrxzqjqojafatrv',
    dpId: 1,
    statisticInterval: 1,
    algorithmType: 'count',
  },
  {
    storageDuration: 7,
    productId: 'lcrxzqjqojafatrv',
    dpId: 1,
    statisticInterval: 2,
    algorithmType: 'count',
  },
];

👉 立即开发。

getStatisticsRang15min

15min 为时间间隔,获取设备日期区间的统计数据。

请求参数

参数 数据类型 说明 是否必填
devId string 设备 ID 是
dpId string | number DP 点的 ID 是
date string 要查询的日期,yyyyMMdd 格式 是
type string 统计类型,'sum' | 'avg' | 'minux' | 'max' | 'min' | 'count';默认 sum 否

请求示例

复制代码
// @ray-js/ray^1.2.12
import { getStatisticsRang15min } from '@ray-js/ray';
 
getStatisticsRang15min({
  devId: 'vdevo161733425146241',
  dpId: '18',
  date: '20230511',
  type: 'avg',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

返回示例

复制代码
var response = {
  202105260000: '1312.02',
  202105260015: '1249.49',
  202105262345: '#',
  '...': '...',
};

getStatisticsRangHour

小时 为时间间隔,获取设备日期区间的统计数据。

请求参数

参数 数据类型 说明 是否必填
devId string 设备 ID 是
dpId string | number DP 点的 ID 是
date string 要查询的日期,yyyyMMdd 格式 是
type string 统计类型,'sum' | 'avg' | 'minux' | 'max' | 'min' | 'count';默认 sum 否

请求示例

复制代码
// @ray-js/ray^1.2.12
import { getStatisticsRangHour } from '@ray-js/ray';
 
getStatisticsRangHour({
  devId: 'vdevo161733425146241',
  dpId: '18',
  date: '20230511',
  type: 'avg',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

返回示例

复制代码
var response = {
  2023051117: '0.00',
  2023051118: '24.00',
  2023051119: '0.00',
  '...': '...',
};

getStatisticsRangDay

天 为时间间隔,获取设备日期区间的统计数据。

请求参数

参数 数据类型 说明 是否必填
devId string 设备 ID 是
dpId string | number DP 点的 ID 是
startDay string 开始日期,yyyyMMdd 格式 是
endDay string 结束日期, yyyyMMdd 格式 是
type string 统计类型,'sum' | 'avg' | 'minux' | 'max' | 'min' | 'count';默认 sum 否

请求示例

复制代码
// @ray-js/ray^1.2.12
import { getStatisticsRangDay } from '@ray-js/ray';
 
getStatisticsRangDay({
  devId: 'vdevo161733425146241',
  dpId: '18',
  startDay: '20230510',
  endDay: '20230511',
  type: 'avg',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

返回示例

复制代码
var response = {
  20230501: '0',
  20230502: '0',
  20230503: '0',
  20230504: '0',
  20230505: '0',
  20230506: '0',
  20230507: '0',
  20230508: '0',
  20230509: '0',
  20230510: '26.00',
  20230511: '24.00',
};

getStatisticsRangMonth

月 为时间间隔,获取设备日期区间的统计数据。

请求参数

参数 数据类型 说明 是否必填
devId string 设备 ID 是
dpId string | number DP 点的 ID 是
startMonth string 开始月份,yyyyMMdd 格式 是
endMonth string 结束月份, yyyyMMdd 格式 是
type string 统计类型,'sum' | 'avg' | 'minux' | 'max' | 'min' | 'count';默认 sum 否

请求示例

复制代码
// @ray-js/ray^1.2.12
import { getStatisticsRangMonth } from '@ray-js/ray';
 
getStatisticsRangMonth({
  devId: 'vdevo161733425146241',
  dpId: '18',
  startMonth: '202304',
  endMonth: '202305',
  type: 'avg',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

返回示例

复制代码
var response = {
  202304: '0',
  202305: '24.00',
};

👉 立即开发。

相关推荐
excel12 分钟前
双 Token 与前端使用 Crypto 公私钥鉴权换 Token,哪种方案更好?
前端·后端
外收内放12 分钟前
Python基础语法练习题(73)
java·前端·python
风骏时光牛马1 小时前
面向复杂场景的大模型应用落地与能力优化实践
前端
小小善后师1 小时前
我做了个病历归档小程序,被 AI 识别的"最后一公里"狠狠上了一课
前端
小嘉丶学长1 小时前
Day14 · 字典与集合
java·开发语言·网络·python·学习·1024程序员节
H_Lisa1 小时前
我用 Express 写了个 MCP,Claude 直接调用我的 API 了
前端
IT_陈寒1 小时前
React的useEffect依赖数组把我坑惨了
前端·人工智能·后端
迪菲赫尔曼1 小时前
【基础篇 11】把官方源码放到服务器:版本、解压层级和安装位置,一次弄清楚
运维·服务器·开发语言·人工智能·python·yolo·目标检测
chari克里2 小时前
QT5.15.2 + msvc2022部署全流程说明(windows可联网环境)
开发语言·c++·qt
Hello.Reader2 小时前
tsrs 技术解析用 Rust 移植 TypeScript 7,类型检查还能怎样提速?
开发语言·rust·typescript