新增电表-更新电表信息API
This commit is contained in:
parent
78a70436a3
commit
3f9455504b
18
api.js
18
api.js
@ -179,3 +179,21 @@ export function checkPasswordRequest(data) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//电表-刷新电表数据
|
||||||
|
export function elecRefreshElecInfoRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/v1/elec/refreshElecInfo',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function updateElecSettingRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/v1/elec/updateElecSetting',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -6,6 +6,7 @@ import * as password from './star-cloud/password.js'
|
|||||||
import * as record from './star-cloud/record.js'
|
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 { onBLECharacteristicValueChange } from './uni/basic'
|
import { onBLECharacteristicValueChange } from './uni/basic'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,7 +138,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)
|
Object.assign(StarCloud.prototype, device, lock, other, password, record, user, common, elec)
|
||||||
|
|
||||||
const { clientId, clientSecret, env, platform, accounts,clientUrl } = params
|
const { clientId, clientSecret, env, platform, accounts,clientUrl } = params
|
||||||
this.envVersion = 'release'
|
this.envVersion = 'release'
|
||||||
|
|||||||
37
star-cloud/elec.js
Normal file
37
star-cloud/elec.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import {elecRefreshElecInfoRequest, getOfflinePasswordRequest, updateElecSettingRequest} from "../api.js";
|
||||||
|
import {Result} from "../constant.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电表-刷新电表信息
|
||||||
|
* @param params
|
||||||
|
* @param {Number} [params.uid] 用户ID
|
||||||
|
* @param {Number} params.elecId 电表ID
|
||||||
|
* @returns {Promise<Result>}
|
||||||
|
*/
|
||||||
|
export async function refreshElecInfo(params) {
|
||||||
|
// 设置执行账号
|
||||||
|
const result = await this.login(params.uid)
|
||||||
|
if (result.code !== Result.Success.code) {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
return await elecRefreshElecInfoRequest(params)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新电表设置
|
||||||
|
* @param params
|
||||||
|
* @param {Number} [params.uid] 用户ID
|
||||||
|
* @param {Number} params.elecId 电表ID
|
||||||
|
* @param {Object} params.elecName 电表名称
|
||||||
|
* @param {Object} params.loadLimit 最大负荷:0~99999
|
||||||
|
*/
|
||||||
|
export async function updateElecSetting(params) {
|
||||||
|
// 设置执行账号
|
||||||
|
const result = await this.login(params.uid)
|
||||||
|
if (result.code !== Result.Success.code) {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
return await updateElecSettingRequest(params)
|
||||||
|
}
|
||||||
44
web.md
44
web.md
@ -304,3 +304,47 @@ removeBadLock(params)
|
|||||||
|
|
||||||
**返回**
|
**返回**
|
||||||
无
|
无
|
||||||
|
|
||||||
|
# 电表
|
||||||
|
|
||||||
|
## 电表-更新电表信息
|
||||||
|
|
||||||
|
**调用方法**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { refreshElecInfo } from 'star-cloud-web'
|
||||||
|
|
||||||
|
refreshElecInfo(params)
|
||||||
|
```
|
||||||
|
|
||||||
|
**入参**
|
||||||
|
|
||||||
|
| 参数名称 | 数据类型 | 必须 | 描述 |
|
||||||
|
|---------|----------------|----|------|
|
||||||
|
| uid | Number | N | 用户uid |
|
||||||
|
| elecId | Number | N | 电表ID |
|
||||||
|
|
||||||
|
**返回**
|
||||||
|
无
|
||||||
|
|
||||||
|
## 电表-更新电表设置
|
||||||
|
|
||||||
|
**调用方法**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { updateElecSetting } from 'star-cloud-web'
|
||||||
|
|
||||||
|
updateElecSetting(params)
|
||||||
|
```
|
||||||
|
|
||||||
|
**入参**
|
||||||
|
|
||||||
|
| 参数名称 | 数据类型 | 必须 | 描述 |
|
||||||
|
|---------|----------------|----|------|
|
||||||
|
| uid | Number | N | 用户uid |
|
||||||
|
| elecId | Number | N | 电表ID |
|
||||||
|
| elecName | String | N | 电表名称 |
|
||||||
|
| loadLimit | Number | N | 最大负荷:0~99999|
|
||||||
|
|
||||||
|
**返回**
|
||||||
|
无
|
||||||
|
|||||||
25
web/index.js
25
web/index.js
@ -97,3 +97,28 @@ export const getServerTime = async () => {
|
|||||||
export const getLockSupportFeatures = async params => {
|
export const getLockSupportFeatures = async params => {
|
||||||
return await starCloudInstance.getLockSupportFeatures(params)
|
return await starCloudInstance.getLockSupportFeatures(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电表-刷新电表信息
|
||||||
|
* @param params
|
||||||
|
* @param {Number} [params.uid] 用户ID
|
||||||
|
* @param {Number} [params.elecId] 用户ID
|
||||||
|
* @returns Result
|
||||||
|
*/
|
||||||
|
export const refreshElecInfo = async params => {
|
||||||
|
return await starCloudInstance.refreshElecInfo(params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新电表设置
|
||||||
|
* @param params
|
||||||
|
* @param {Number} [params.uid] 用户ID
|
||||||
|
* @param {Number} params.elecId 电表ID
|
||||||
|
* @param {Object} params.elecName 电表名称
|
||||||
|
* @param {Object} params.loadLimit 最大负荷:0~99999
|
||||||
|
* @returns Result
|
||||||
|
*/
|
||||||
|
export const updateElecSetting = async params => {
|
||||||
|
return await starCloudInstance.updateElecSetting(params)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user