新增:冷电表-更新冷水表信息API
新增:热电表-更新热水表信息API
This commit is contained in:
parent
fcf1a6e4f6
commit
0416f06071
20
api.js
20
api.js
@ -196,4 +196,24 @@ export function updateElecSettingRequest(data) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//冷水表-刷新水表数据
|
||||||
|
export function coldWaterRefreshWaterInfoRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/v1/coldWater/refreshWaterInfo',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//热水表-刷新水表数据
|
||||||
|
export function hotWaterRefreshWaterInfoRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/v1/hotWater/refreshWaterInfo',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@ -7,6 +7,8 @@ import * as record from './star-cloud/record.js'
|
|||||||
import * as user from './star-cloud/user.js'
|
import * as user from './star-cloud/user.js'
|
||||||
import * as common from './common.js'
|
import * as common from './common.js'
|
||||||
import * as elec from './star-cloud/elec.js'
|
import * as elec from './star-cloud/elec.js'
|
||||||
|
import * as coldWater from './star-cloud/coldWater.js'
|
||||||
|
import * as hotWater from './star-cloud/hotWater.js'
|
||||||
import { onBLECharacteristicValueChange } from './uni/basic'
|
import { onBLECharacteristicValueChange } from './uni/basic'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -138,7 +140,7 @@ class StarCloud {
|
|||||||
* @param {Boolean} params.isReportLog 是否上报日志
|
* @param {Boolean} params.isReportLog 是否上报日志
|
||||||
*/
|
*/
|
||||||
init(params) {
|
init(params) {
|
||||||
Object.assign(StarCloud.prototype, device, lock, other, password, record, user, common, elec)
|
Object.assign(StarCloud.prototype, device, lock, other, password, record, user, common, elec,coldWater, hotWater)
|
||||||
|
|
||||||
const { clientId, clientSecret, env, platform, accounts,clientUrl } = params
|
const { clientId, clientSecret, env, platform, accounts,clientUrl } = params
|
||||||
this.envVersion = 'release'
|
this.envVersion = 'release'
|
||||||
|
|||||||
20
star-cloud/coldWater.js
Normal file
20
star-cloud/coldWater.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
import {coldWaterRefreshWaterInfoRequest} from "../api.js";
|
||||||
|
import {Result} from "../constant.js";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冷电表-刷新电表信息
|
||||||
|
* @param params
|
||||||
|
* @param {Number} [params.uid] 用户ID
|
||||||
|
* @param {Number} params.waterId 冷水表ID
|
||||||
|
* @returns {Promise<Result>}
|
||||||
|
*/
|
||||||
|
export async function refreshColdWaterInfo(params) {
|
||||||
|
// 设置执行账号
|
||||||
|
const result = await this.login(params.uid)
|
||||||
|
if (result.code !== Result.Success.code) {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
return await coldWaterRefreshWaterInfoRequest(params)
|
||||||
|
}
|
||||||
20
star-cloud/hotWater.js
Normal file
20
star-cloud/hotWater.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
import {hotWaterRefreshWaterInfoRequest} from "../api.js";
|
||||||
|
import {Result} from "../constant.js";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 热电表-刷新电表信息
|
||||||
|
* @param params
|
||||||
|
* @param {Number} [params.uid] 用户ID
|
||||||
|
* @param {Number} params.waterId 热水表ID
|
||||||
|
* @returns {Promise<Result>}
|
||||||
|
*/
|
||||||
|
export async function refreshHotWaterInfo(params) {
|
||||||
|
// 设置执行账号
|
||||||
|
const result = await this.login(params.uid)
|
||||||
|
if (result.code !== Result.Success.code) {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
return await hotWaterRefreshWaterInfoRequest(params)
|
||||||
|
}
|
||||||
48
web.md
48
web.md
@ -348,3 +348,51 @@ updateElecSetting(params)
|
|||||||
|
|
||||||
**返回**
|
**返回**
|
||||||
无
|
无
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 冷电表
|
||||||
|
|
||||||
|
## 冷电表-更新冷水表信息
|
||||||
|
|
||||||
|
**调用方法**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { refreshColdWaterInfo } from 'star-cloud-web'
|
||||||
|
|
||||||
|
refreshColdWaterInfo(params)
|
||||||
|
```
|
||||||
|
|
||||||
|
**入参**
|
||||||
|
|
||||||
|
| 参数名称 | 数据类型 | 必须 | 描述 |
|
||||||
|
|---------|----------------|----|-------|
|
||||||
|
| uid | Number | N | 用户uid |
|
||||||
|
| waterId | Number | N | 冷水表ID |
|
||||||
|
|
||||||
|
**返回**
|
||||||
|
无
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 热电表
|
||||||
|
|
||||||
|
## 热电表-更新热水表信息
|
||||||
|
|
||||||
|
**调用方法**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { refreshHotWaterInfo } from 'star-cloud-web'
|
||||||
|
|
||||||
|
refreshHotWaterInfo(params)
|
||||||
|
```
|
||||||
|
|
||||||
|
**入参**
|
||||||
|
|
||||||
|
| 参数名称 | 数据类型 | 必须 | 描述 |
|
||||||
|
|---------|----------------|----|-------|
|
||||||
|
| uid | Number | N | 用户uid |
|
||||||
|
| waterId | Number | N | 热水表ID |
|
||||||
|
|
||||||
|
**返回**
|
||||||
|
无
|
||||||
24
web/index.js
24
web/index.js
@ -122,3 +122,27 @@ export const refreshElecInfo = async params => {
|
|||||||
export const updateElecSetting = async params => {
|
export const updateElecSetting = async params => {
|
||||||
return await starCloudInstance.updateElecSetting(params)
|
return await starCloudInstance.updateElecSetting(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冷电表-刷新水表信息
|
||||||
|
* @param params
|
||||||
|
* @param {Number} [params.uid] 用户ID
|
||||||
|
* @param {Number} [params.waterId] 冷水表ID
|
||||||
|
* @returns Result
|
||||||
|
*/
|
||||||
|
export const refreshColdWaterInfo = async params => {
|
||||||
|
return await starCloudInstance.refreshColdWaterInfo(params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 热电表-刷新水表信息
|
||||||
|
* @param params
|
||||||
|
* @param {Number} [params.uid] 用户ID
|
||||||
|
* @param {Number} [params.waterId] 热水表ID
|
||||||
|
* @returns Result
|
||||||
|
*/
|
||||||
|
export const refreshHotWaterInfo = async params => {
|
||||||
|
return await starCloudInstance.refreshHotWaterInfo(params)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user