智能小程序开发 —— 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',
};

👉 立即开发

相关推荐
前端小巷子3 分钟前
跨域问题解决方案:CORS(跨域资源共享)
前端·网络协议·面试
大大。4 分钟前
van-tabbar-item选中active数据变了,图标没变
java·服务器·前端
MonkeyKing_sunyuhua5 分钟前
微信小程序能不能获取物联网的上的设备数据
物联网·微信小程序·小程序
Mintopia6 分钟前
Three.js 3D 世界中的噪声运动:当数学与像素共舞
前端·javascript·three.js
paopaokaka_luck6 分钟前
基于SpringBoot+Vue的酒类仓储管理系统
数据库·vue.js·spring boot·后端·小程序
nc_kai6 分钟前
Flutter 之 每日翻译 PreferredSizeWidget
java·前端·flutter
来碗疙瘩汤9 分钟前
使用 Three.js 与 CSS3DRenderer 在 Vue3 中加载网页为 3D 模型
前端·javascript
满分观察网友z10 分钟前
富文本解析终极指南:从Quill到小程序,我如何用正则摆平所有坑?
前端
打野赵怀真11 分钟前
在TypeScript中装饰器有哪些应用场景?
前端·javascript
destinying12 分钟前
vite学习笔记
前端·javascript