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

👉 立即开发

相关推荐
Moment几秒前
面试官:一个接口使用postman这些测试很快,但是页面加载很慢怎么回事 😤😤😤
前端·后端·面试
诗书画唱4 分钟前
【前端面试题】JavaScript 核心知识点解析(第二十二题到第六十一题)
开发语言·前端·javascript
冬天vs不冷5 分钟前
Java基础(九):Object核心类深度剖析
java·开发语言·python
TS的美梦6 分钟前
【1:1复刻R版】python版火山图函数一键出图
开发语言·python·r语言·scanpy·火山图
excel11 分钟前
前端必备:从能力检测到 UA-CH,浏览器客户端检测的完整指南
前端
前端小巷子17 分钟前
Vue 3全面提速剖析
前端·vue.js·面试
悟空聊架构24 分钟前
我的网站被攻击了,被干掉了 120G 流量,还在持续攻击中...
java·前端·架构
CodeSheep26 分钟前
国内 IT 公司时薪排行榜。
前端·后端·程序员
尖椒土豆sss29 分钟前
踩坑vue项目中使用 iframe 嵌套子系统无法登录,不报错问题!
前端·vue.js
遗悲风30 分钟前
html二次作业
前端·html